Repository navigation
feat: matrix-free interferometer route via Settings (#638 phase 5a) - #658
Merged
Merged
Conversation
…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>
This was referenced Oct 26, 2026
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
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 whenSettings(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 Hexact fromMaternSparse. PyAutoGalaxy'sFitInterferometerreaches it throughSettingswith no other change (companion test PR in PyAutoGalaxy).Closes #657.
Decisions taken (flagged for review):
sub_fractionand 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.use_edge_zeroed_pixels=Trueraises: 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 passuse_edge_zeroed_pixels=False(oruse_positive_only_solver=False). The phase-5c workspace example must say so.MaternSparseis accepted (the SLQ probes need its sparse factor); other regularizations raise rather than densify.API Changes
Settings(interferometer_route=...)accepts"matrix_free"besideNone/"fft"/"numba"; packaged default unchanged (null).aa.InversionInterferometerMatrixFree(subclass ofInversionInterferometerSparse). 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) raiseInversionException.InversionExceptionfor the route on a dataset without a sparse operator and for every configuration the class cannot represent; there is no silent fallback.inversion_plotsskips the noise-map panel / CSV column when the inversion raisesInversionException.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; SLQln 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 raisesValueError; JAX backend raises (importorskip).test_autoarray/inversion: 1088 passed, 4 xfailed; rest oftest_autoarray: 1124 passed.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
/prmwith green required checks.Full API Changes (for automation & release notes)
Removed
Added
autoarray.InversionInterferometerMatrixFree(dataset, linear_obj_list, settings=, xp=np, preloads=)— matrix-free interferometer inversion (NumPy/scipy only; oneRectangularUniformmapper withMaternSparse; no linear function lists). Providesreconstruction,regularization_term,fast_chi_squared,log_det_curvature_reg_matrix_term(SLQ),log_det_regularization_matrix_term, the mapped-data dictionaries, andoperator/regularization_matrix_sparse/regularization_factor_sparse/positive_resultdiagnostics.Settings(interferometer_route="matrix_free")— selects the class; documented insettings.pyandconfig/general.yaml.Migration
aa.Settings(interferometer_route="matrix_free", use_edge_zeroed_pixels=False)with aRectangularUniformmesh andaa.reg.MaternSparseon a dataset afterapply_sparse_operator(...).Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code