fix: imaging/pixelization log_evidence shape mismatch after MGE-60 lens#15
Merged
Merged
Conversation
Adding the 60-Gaussian MGE linear bulge to the lens model grew the inversion matrices from (1225, 1225) to (1285, 1285) — 60 linear-bulge columns prefixed onto the 1225 pixelization columns. The script still fed the raw mesh-only regularization matrix into `F + H`, triggering a shape broadcast error, and used a plain slogdet of the full block- diagonal H (singular zero block on the linear-bulge rows). Mirror the production formula in `autoarray/inversion/inversion/abstract.py:log_det_*`: pass the full block-diagonal `inversion.regularization_matrix`, then index both F+H and H down to `inversion.mapper_indices` before the Cholesky-based log_det. All three log_evidence values (eager / single-JIT / vmap) now match `FitImaging.figure_of_merit` at 24746.10567 (rtol=1e-4). README dashboards refreshed by `scripts/build_readme.py` to pick up the newly-passing imaging/pixelization, imaging/delaunay, and datacube/delaunay rows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
likelihood/imaging/pixelization.pyfailed onF + Hafter the MGE-60 linear bulge was added to the lens model: the regularization matrix stayed(1225, 1225)(mesh only) while curvature grew to(1285, 1285)(60 linear bulge cols + 1225 mesh cols). Even with the shape fix, a plainslogdet(H)over the full block-diag was singular because the linear-bulge block is zero.The fix mirrors the production formula in
autoarray/inversion/inversion/abstract.py:log_det_curvature_reg_matrix_term: pass the inversion's full block-diagonal regularization matrix, then reduce bothF+HandHtoinversion.mapper_indicesrows/cols before the Cholesky-based log_det.Eager, single-JIT, and vmap log_evidence now all match
FitImaging.figure_of_merit = 24746.10567tortol=1e-4.Scripts Changed
likelihood/imaging/pixelization.py— passed the full(1285, 1285)inversion.regularization_matrixtocompute_reconstruction; switchedcompute_log_evidencefromslogdet(H_full)to the mapper-indices-reduced Cholesky log_det used byautoarray. Now matches the developer-workspace pattern that already shipped forimaging/delaunay.py.README.md,likelihood/imaging/README.md,likelihood/interferometer/README.md,likelihood/point_source/README.md,likelihood/datacube/README.md— regenerated byscripts/build_readme.pyto pick up the newly-passingimaging/pixelization(4.35 s/call),imaging/delaunay(5.28 s/call), anddatacube/delaunayrows.Verification
Every script under
likelihood/was re-run end-to-end on this branch. All 9 produce their versioned*_summary_*.{json,png}artifacts and allEXPECTED_LOG_*regression assertions pass:imaging/mge.pyimaging/pixelization.pyimaging/delaunay.pyinterferometer/mge.pyinterferometer/pixelization.pyinterferometer/delaunay.pypoint_source/image_plane.pypoint_source/source_plane.pydatacube/delaunay.pyCUBE_FULL_JIT=1)python scripts/build_readme.py --checkis clean after this commit.Test Plan
python likelihood/imaging/pixelization.py— eager / JIT / vmap log_evidence all matchFitImaging.figure_of_meritat rtol=1e-4python scripts/build_readme.py --checkexits 0🤖 Generated with Claude Code