Skip to content

feat: lens fits use the lazy sparse operator; point/weak on the shared setup mixin (5C-3b) - #886

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/likelihood-lifecycle-p5c3b-lens
Nov 24, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/likelihood-lifecycle-p5c3b-lens

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

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 plain al.FitImaging(dataset, tracer) / al.FitInterferometer uses the lazy operator when the policy is on (aa.Settings(lazy_sparse_operator="auto") or PYAUTO_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's AnalysisSetupMixin, removing the duplicated setup-resolution code.

API Changes

  • al.FitImaging.tracer_to_inversion and al.FitInterferometer.tracer_to_inversion pass self.sparse_operator into aa.DatasetInterface. The interferometer's sparse_chi_squared, precomputed-data-term check and profile-term correction pass it explicitly.
  • AnalysisSetupNoOperator subclasses autogalaxy.analysis.analysis.setup.AnalysisSetupMixin. It keeps the abstract setup_key_from and adds setup_key_and_note_from. Its duplicated setup_environment, _init_setup, resolve_setup, _log_setup_auto_would_choose and save_setup are removed and now inherited, with identical behaviour. setup_environment stays importable from the module as a re-export.
  • Aggregator: the Lens fit loaders already go through PyAutoGalaxy's _imaging_from / _interferometer_from, so reloaded fits reapply setup.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 for AnalysisSetupMixin and aggregator round-trips for imaging (numba) and interferometer (w-tilde).
  • Heart dev gate (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_ROOT
Full API Changes (for automation & release notes)

Changed

  • FitImaging / FitInterferometer (autolens) resolve their sparse operator through self.sparse_operator (sparse_operator_for), at every DatasetInterface and interferometer-helper site.
  • autolens.analysis.analysis.setup.AnalysisSetupNoOperator is now a subclass of AnalysisSetupMixin.

Removed

  • The private duplicates in autolens/analysis/analysis/setup.py: _init_setup, resolve_setup, _log_setup_auto_would_choose and save_setup, which are now inherited from the mixin with the same names and behaviour. setup_environment is re-exported from autogalaxy.analysis.setup_util.

Migration

  • None. With the lazy policy off (the default), fits behave exactly as before.

Notes:

  • lens/to_inversion.py is unchanged. TracerToInversion only ever receives the fit's DatasetInterface, which already carries the resolved operator.
  • potential_correction fits still require an explicit apply_sparse_operator(), unchanged.
  • This completes phase 5C-3. With the policy on, Galaxy and Lens fits outside modeling now get the optimal operator, and reloaded fits take the search's route. The default flip waits for the R6 release.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…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>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Nov 24, 2026
@Jammy2211
Jammy2211 merged commit d19108d into main Nov 24, 2026
5 checks passed
@Jammy2211
Jammy2211 deleted the feature/likelihood-lifecycle-p5c3b-lens branch November 24, 2026 17:18
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant