Repository navigation
feat: persist the interferometer primary beam through analysis save and aggregator rebuild - #655
Merged
Conversation
… and aggregator rebuild interferometer_hdu_list_from appends the primary beam (native float64, masked pixels 0) as a trailing PRIMARY_BEAM HDU in both the in-memory and array-free layouts, so legacy positional indices are unchanged and beamless datasets write the same file as before. The aggregator detects the HDU by name and passes primary_beam= into Interferometer / from_sparse_terms, so a rebuilt dataset and fit reproduce the beamed likelihood. Old outputs without the HDU reload with primary_beam=None. Refs #654 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #654. Follow-up of PyAutoLabs/PyAutoArray#644 (primary beam; hub PyAutoLabs/.github#35, @HRSAstro).
Summary
The interferometer primary beam was saved nowhere by
AnalysisInterferometer.save_attributes, so an aggregator-rebuiltInterferometer/FitInterferometerlost it and the likelihood changed.interferometer_hdu_list_fromnow appends the beam (float64 native array, masked pixels 0) as a trailingPRIMARY_BEAMHDU in both the in-memory and array-free layouts (after any fine-grid HDUs; legacy positions 0-3 unchanged; a beamless dataset writes exactly the same file as before). The aggregator's_interferometer_fromdetects it by name only (_has_hdu, never positional) and passesprimary_beam=into bothfrom_sparse_termsandaa.Interferometer, soInterferometerAggandFitInterferometerAggreproduce the beamed likelihood.PyAutoLens reuses both functions and needs no source change; its docstring line and mirror test are deferred to a follow-up (checkout claimed by another task).
API Changes
None — internal changes only (one new optional HDU in
dataset.fits; old outputs without it still load withprimary_beam=None).Test Plan
test_autogalaxy/interferometer/model/test_analysis_interferometer.py, five new tests with a Gaussian beam (FWHM 2.2") oninterferometer_7spanning 1 → ~0.32:PRIMARY_BEAMlast;primary_beam_slimandtransformer.primary_beam_slimidentical;log_likelihoodrel 1e-10 for light-profile and pixelization galaxies, differing from the beamless value;from_stream(primary_beam=):sparse_operator.primary_beam_slimidentical;log_evidencerel 1e-10 and differs from beamless;figure_of_meritequal;primary_beam is None;primary_beam=None;_primary_beam_fromto None makes the round-trip tests fail.Worktree runs:
pytest test_autogalaxy/interferometer -q→ 82 passed;pytest test_autogalaxy -q→ 1362 passed.Heart YELLOW acknowledged by the human on 2026-10-21 (manifest drift 1 mismatch; release validation stale: source moved since rehearsal (PyAutoArray)).
Full API Changes (for automation & release notes)
Changed Behaviour
autogalaxy.interferometer.model.analysis.interferometer_hdu_list_from— appends an optional trailingPRIMARY_BEAMHDU when the dataset carries a primary beam.autogalaxy.aggregator.interferometer._interferometer_from— reloadsprimary_beamwhen the HDU is present.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code