Skip to content

feat: matrix-free interferometer route via Settings (#638 phase 5a) - #658

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/matrix-free-interferometer-wiring
Oct 26, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/matrix-free-interferometer-wiring

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Phase 5a of #638 (community proposal by @HRSAstro, PyAutoLabs/.github#39). The matrix-free interferometer utilities merged in phases 1–4 (#645, #650, #651, #652) are now selectable from a fit: InversionInterferometerMatrixFree, returned by the inversion factory when Settings(interferometer_route="matrix_free") is set on a dataset with a sparse operator. It never forms the dense (S, S) curvature or regularization matrices: PCG with the Powell preconditioner (or the primal-dual interior point with the positive-only solver), ln det(F + H) by stochastic Lanczos quadrature, ln det H exact from MaternSparse. PyAutoGalaxy's FitInterferometer reaches it through Settings with no other change (companion test PR in PyAutoGalaxy).

Closes #657.

Decisions taken (flagged for review):

  • Over-sampling and a non-trivial primary beam are supported, not rejected as the prompt listed. The sparse mapping matrix is built from the parent's triplets, which already fold in sub_fraction and the beam; both cases match the FFT route to ~1e-11 in the new tests. Reverting to a raise is a few lines in _check_preconditions.
  • The positive-only solver with use_edge_zeroed_pixels=True raises: the matrix-free interior point solves the full system and has no held-pixel set. With the packaged defaults (both flags on) Settings(interferometer_route="matrix_free") alone therefore raises; users pass use_edge_zeroed_pixels=False (or use_positive_only_solver=False). The phase-5c workspace example must say so.
  • Only MaternSparse is accepted (the SLQ probes need its sparse factor); other regularizations raise rather than densify.

API Changes

  • Settings(interferometer_route=...) accepts "matrix_free" beside None / "fft" / "numba"; packaged default unchanged (null).
  • New aa.InversionInterferometerMatrixFree (subclass of InversionInterferometerSparse). Dense-only attributes (curvature_matrix, curvature_matrix_diag, curvature_reg_matrix, curvature_reg_matrix_reduced, reconstruction_covariance_matrix, reconstruction_noise_map, reconstruction_noise_map_with_covariance, reconstruction_noise_map_dict) raise InversionException.
  • The factory raises InversionException for the route on a dataset without a sparse operator and for every configuration the class cannot represent; there is no silent fallback.
  • inversion_plots skips the noise-map panel / CSV column when the inversion raises InversionException.
    See full details below.

Test Plan

  • test_autoarray/inversion/inversion/interferometer/test_matrix_free.py (21 new): factory dispatch; reconstruction vs FFT route ~1.5e-11 relative; chi-squared, regularization term, ln det H ~1e-11; SLQ ln det(F+H) 0.10% from dense (documented tolerance 0.5%); positive-only parity; over-sampling and primary-beam parity; every unsupported configuration and dense attribute raises; Settings typo raises ValueError; JAX backend raises (importorskip).
  • test_autoarray/inversion: 1088 passed, 4 xfailed; rest of test_autoarray: 1124 passed.
  • PyAutoGalaxy companion branch: 90 interferometer tests pass against this branch (fit parity, positive-only, raises, visualizer).

Heart RED override (development only)

Heart was RED at launch and at ship. The live human authorized the override for this task on 2026-10-26 ("I approve of the overrider", then "approve" on the plan naming issue #657). Exact RED reasons at launch: release validation FAILED (stage integrate); PyAutoHeart/workflows/Release Integrate: failure; PyAutoHeart/workflows/Workspace Smoke: failure; manifest_drift/checks/workspace checkouts (manifest ↔ disk): red; Release readiness: release validation FAILED (stage integrate); autolens: red; Workspace validation: NOT ready — 1429p / 1f / 125s @ cloud#40294511523; test_run: red; Release validation: NOT release_ready — v? profile=? (2026-10-26T07:48:52+00:00); validation_report/stages/integrate: fail; PyAutoBrain: red; PyAutoLens: red; autolens_profiling: red; Worktree drift: 1 orphan / 0 missing / 3 dirty. Branch gates passed: PyAutoArray full test suite (above), black. No release, no merge through RED: merge needs its own human /prm with green required checks.

Full API Changes (for automation & release notes)

Removed

  • None

Added

  • autoarray.InversionInterferometerMatrixFree(dataset, linear_obj_list, settings=, xp=np, preloads=) — matrix-free interferometer inversion (NumPy/scipy only; one RectangularUniform mapper with MaternSparse; no linear function lists). Provides reconstruction, regularization_term, fast_chi_squared, log_det_curvature_reg_matrix_term (SLQ), log_det_regularization_matrix_term, the mapped-data dictionaries, and operator / regularization_matrix_sparse / regularization_factor_sparse / positive_result diagnostics.
  • Settings(interferometer_route="matrix_free") — selects the class; documented in settings.py and config/general.yaml.

Migration

  • None required; opt-in only. To use: aa.Settings(interferometer_route="matrix_free", use_edge_zeroed_pixels=False) with a RectangularUniform mesh and aa.reg.MaternSparse on a dataset after apply_sparse_operator(...).

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…ute="matrix_free")

Wires the phase 1-4 matrix-free utilities (#638) into fits as
`InversionInterferometerMatrixFree`, selected by the new
`interferometer_route="matrix_free"` Settings value (packaged default
unchanged, off). The class subclasses `InversionInterferometerSparse`
and never forms the dense curvature or regularization matrices:
reconstruction by Powell-preconditioned PCG (interior point with the
positive-only solver), ln det(F+H) by stochastic Lanczos quadrature,
ln det H exact from MaternSparse. Dense-only attributes raise
`InversionException`; so does every configuration the route cannot
represent (JAX, linear function lists, several mappers, non-rectangular
mesh, non-sparse regularization, positive-only with edge-zeroing,
no sparse operator). The inversion plotter skips the noise-map panel
and CSV column on this route.

Phase 5a of PyAutoArray#638 (community proposal, discussions/39).
Closes #657.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Oct 26, 2026
@Jammy2211
Jammy2211 merged commit 7eba0c0 into main Oct 26, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/matrix-free-interferometer-wiring branch October 26, 2026 17:26
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Oct 26, 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.

feat: matrix-free interferometer route in Settings (#638 phase 5a)

1 participant