fix(interferometer-sparse): guard against Delaunay mappers (issue #314)#315
Merged
Conversation
`InversionInterferometerSparse.curvature_matrix_diag` now raises `NotImplementedError` when paired with a Delaunay mapper. The sparse-operator curvature path (`InterferometerSparseOperator.curvature_matrix_via_sparse_operator_from`) has only been validated against `Rectangular*` meshes; on a Delaunay mapper the returned curvature disagrees with the mapping path by ~34% Frobenius norm and the regularized matrix loses positive-definiteness, raising a numpy LinAlgError deep inside `log_det_curvature_reg_matrix_term`. Guard early at the entry point with a clear message rather than silently mis-computing. Adds a regression test verifying the guard fires for a Delaunay mapper paired with `apply_sparse_operator(use_jax=False)`. The underlying math bug remains: the W-tilde-formalism curvature for interferometer + Delaunay needs rewriting to correctly handle barycentric weights (Pmax > 1). Filed as a follow-up issue; this PR only stops the silent failure. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 16, 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
Guards
InversionInterferometerSparse.curvature_matrix_diagagainst Delaunay mappers with a clearNotImplementedErrorinstead of silently producing a wrong curvature matrix. Surfaced while attempting to enabledataset.apply_sparse_operator(use_jax=True)on Hannah Stacey's ALMA cube profiler (shipped #311 / autolens_workspace_developer#63): the sparse-operator curvature disagrees with the mapping path by ~34% Frobenius norm for Delaunay, the regularized matrix loses positive-definiteness, andInversion.log_det_curvature_reg_matrix_termraisesnumpy.linalg.LinAlgError.The underlying math bug is filed as #314 — that issue tracks the actual fix. This PR is just the silent-failure guard.
API Changes
InversionInterferometerSparse.curvature_matrix_diag(and thereforecurvature_matrix,data_vector, and any downstream method that materialises the curvature) now raisesNotImplementedErrorwhen constructed with a Delaunay-mesh mapper. Users runningInterferometer.apply_sparse_operator(...)+ Delaunay get a clear early failure pointing at #314 instead of a confusing Cholesky error deep inside the inversion solver. See full details below.Test Plan
pytest test_autoarray/inversion/inversion/interferometer/test_interferometer.py -xvs— 3 passed (existing 2 + newtest__apply_sparse_operator__delaunay_mapper__raises_not_implemented).pytest test_autoarray/inversion/— 165 passed.Full API Changes (for automation & release notes)
Changed Behaviour
autoarray.inversion.inversion.interferometer.sparse.InversionInterferometerSparse.curvature_matrix_diag— now raisesNotImplementedErrorwhen the first mapper inlinear_obj_listuses aDelaunaymesh. The previous behaviour returned a numerically-incorrect curvature matrix (~34% Frobenius disagreement with the mapping path) and downstream operations failed loudly in the Cholesky factorisation step. After this PR the failure surfaces at the construction of the curvature matrix itself with a message pointing at issue Interferometer + Delaunay sparse-operator curvature math is wrong (silent ~34% error) #314.Migration
For Delaunay interferometer fits that previously called
dataset.apply_sparse_operator(...), drop the call and use the plainTransformerDFT(orTransformerNUFFT) path directly:Rectangular interferometer fits are unaffected — they continue to work with
apply_sparse_operator(the optimisation is validated for Rectangular meshes).Related
🤖 Generated with Claude Code