Repository navigation
feat: sparse mapped reconstructed image on the interferometer sparse inversion path - #641
Merged
Merged
Conversation
…inversion path InversionInterferometerSparse now overrides mapped_reconstructed_data_dict so each mapper's image is a scatter-add of vals * reconstruction[cols] over the slim sparse triplets (np.bincount / .at[rows].add), the mirror of the sparse data_vector. The dense image-pixels x mesh-pixels mapping matrix is no longer built for model visibilities and fit outputs. Linear function lists keep the dense mapping_matrix @ reconstruction route. Parity tests against the dense product on numpy (1e-10) and under jax.jit (1e-12): Rectangular, Delaunay, sub_size 2, two mappers, mapper + linear funcs. Closes #639 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 21, 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.
Closes #639. Community proposal: PyAutoLabs/.github#40 (@HRSAstro).
Summary
After 2026.10.18.1 made
InversionInterferometerSparse.data_vectorsparse, the inheritedmapped_reconstructed_data_dictstill built the dense (image pixels × mesh pixels) mapping matrixLfor fit outputs (model visibilities, galaxy image dicts,model_image_natural, array-free chi-squared). On a 384×384 unmasked grid with a 48² mesh that is 2.7 GB; at 192² it would be 43 GB.InversionInterferometerSparsenow overridesmapped_reconstructed_data_dict: each mapper's imageA sis a scatter-add ofvals * s[cols]over the slim sparse triplets from_sparse_triplets_slim_from(numpybincount, JAX.at[rows].add), the transpose of the sparsedata_vectorsegment-sum. Linear-function objects keep the dense product.InversionInterferometerSparseNumbainherits the override.mapped_reconstructed_operated_data_dictis unchanged and consumes the new dict.API Changes
None — internal changes only. Public results are numerically identical to the dense path (1e-10 numpy, 1e-12 under JAX jit); only the memory profile of fit outputs changes.
Test Plan
test_autoarray/inversion/inversion/interferometer/test_interferometer.py: new parity tests (numpy andjax.jit) asserting the sparse dict equalsmapping_matrix @ reconstructionfor Rectangular, Delaunay, sub_size 2, two mappers, and mapper + linear function list in both orders; plusmapped_reconstructed_operated_data_dictparity andArray2D/mask checks.pytest test_autoarray/inversion test_autoarray/dataset/interferometer -q→ 1052 passed, 4 xfailed;pytest test_autogalaxy/interferometer -qagainst this branch → 77 passed.Heart YELLOW acknowledged by the human on 2026-10-21 (manifest drift 1 mismatch; test run status unknown; no release rehearsal for current source) — none caused by this branch.
Side finding (not fixed here):
autoarray/inversion/inversion/imaging/sparse.py_mapped_reconstructed_data_dict_fromuses unmaskedMapper.sparse_triplets_curvature(noslot >= pix_sizes/cols < 0zeroing, unlike_sparse_triplets_slim_from), and the helper imports JAX unconditionally. Follow-up issue to be filed.Full API Changes (for automation & release notes)
Changed Behaviour
InversionInterferometerSparse.mapped_reconstructed_data_dict— mapper images now computed by sparse scatter-add instead of the dense mapping matrix; values unchanged within 1e-10.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code