Repository navigation
feat: lens fits use the lazy sparse operator; point/weak on the shared setup mixin (5C-3b) - #886
Merged
Merged
Conversation
…d setup mixin (5C-3b) FitImaging / FitInterferometer pass self.sparse_operator (resolved through sparse_operator_for) into DatasetInterface and into the interferometer chi-squared, precomputed-data-term and profile-term helpers, so the inversion and the dirty-image correction share one operator. AnalysisSetupNoOperator becomes a thin subclass of PyAutoGalaxy's AnalysisSetupMixin, removing the duplicated setup-resolution code. Closes #885 (likelihood-lifecycle phase 5C-3b). Co-Authored-By: Claude Opus 5.5 <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.
Summary
Likelihood-lifecycle phase 5C-3b, the second of two PRs under #885 (5C-3a was PyAutoGalaxy#753). The PyAutoLens fits now take their sparse operator from the shared choke point
AbstractFitInversion.sparse_operator(PyAutoGalaxy), so a plainal.FitImaging(dataset, tracer)/al.FitInterferometeruses the lazy operator when the policy is on (aa.Settings(lazy_sparse_operator="auto")orPYAUTO_SETUP=auto; off by default). The interferometer dirty-image correction uses the same operator as the inversion.AnalysisSetupNoOperator(point/weak) becomes a thin subclass of PyAutoGalaxy'sAnalysisSetupMixin, removing the duplicated setup-resolution code.API Changes
al.FitImaging.tracer_to_inversionandal.FitInterferometer.tracer_to_inversionpassself.sparse_operatorintoaa.DatasetInterface. The interferometer'ssparse_chi_squared, precomputed-data-term check and profile-term correction pass it explicitly.AnalysisSetupNoOperatorsubclassesautogalaxy.analysis.analysis.setup.AnalysisSetupMixin. It keeps the abstractsetup_key_fromand addssetup_key_and_note_from. Its duplicatedsetup_environment,_init_setup,resolve_setup,_log_setup_auto_would_chooseandsave_setupare removed and now inherited, with identical behaviour.setup_environmentstays importable from the module as a re-export._imaging_from/_interferometer_from, so reloaded fits reapplysetup.json. No code change was needed; it is covered by new round-trip tests.See full details below.
Test Plan
pytest test_autolens: 1101 passed, 1 xfailed. New tests: 5 imaging and 6 interferometer lazy-operator tests, which fail without the source change. Also MRO tests forAnalysisSetupMixinand aggregator round-trips for imaging (numba) and interferometer (w-tilde).pyauto-heart readiness --dev --repos PyAutoLens): GREEN. Non-blocking shown reasons: manifest drift; test run status unknown; no release rehearsal for current source; release push credential check 51 h old.pyauto-heart smoke --affected-by PyAutoLens --jobs 3: 4/4 workspaces PASS (autolens, autolens_test, euclid, howtolens), run against this branch via PYAUTO_ROOTFull API Changes (for automation & release notes)
Changed
FitImaging/FitInterferometer(autolens) resolve their sparse operator throughself.sparse_operator(sparse_operator_for), at everyDatasetInterfaceand interferometer-helper site.autolens.analysis.analysis.setup.AnalysisSetupNoOperatoris now a subclass ofAnalysisSetupMixin.Removed
autolens/analysis/analysis/setup.py:_init_setup,resolve_setup,_log_setup_auto_would_chooseandsave_setup, which are now inherited from the mixin with the same names and behaviour.setup_environmentis re-exported fromautogalaxy.analysis.setup_util.Migration
Notes:
lens/to_inversion.pyis unchanged.TracerToInversiononly ever receives the fit'sDatasetInterface, which already carries the resolved operator.apply_sparse_operator(), unchanged.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code