test(viz): __Visualization Sanity__ rollout across modeling_visualization_jit*.py#113
Merged
Merged
Conversation
…_jit*.py Phase D.1 rollout of the Sanity block pattern from PR #111. Adds a __Visualization Sanity__ block to each remaining JIT-cached visualization script under autolens_workspace_test. Inserted after the Part 1 caching probe, before the Part 2 Nautilus search. Scripts updated: - scripts/imaging/modeling_visualization_jit_delaunay.py - scripts/imaging/modeling_visualization_jit_rectangular.py - scripts/interferometer/modeling_visualization_jit.py - scripts/point_source/modeling_visualization_jit.py Each block uses a deterministic SIE sanity tracer (einstein_radius=1.2, ell_comps=(0.1, 0.0)) so the lensing-side assertions are independent of each script's specific prior median. Three universal assertions: (1) non-empty tangential critical curve via zero_contour, (2) finite positive Einstein radius, (3) warm-call latency < 100 ms on the same LensCalc (guards against the closure cache-busting regression fixed in PyAutoGalaxy #434). The interferometer script additionally asserts fit.model_data (the aa.Visibilities) is finite + non-zero, catching NUFFT / linear- inversion collapse independent of the SIE-tracer lensing-side checks. The point_source script omits a script-specific assertion on figure_of_merit because the prior median can legitimately give chi² = -inf when the source position lies outside the image-pair basin of the prior-median lens. The SIE lensing-side checks still catch the deflection-collapse failure class. Locally validated end-to-end on point_source and interferometer (both ran clean; Sanity blocks pass with the expected einstein_radius = 1.1938 and warm-call latency in the 60-70 ms range). The two pixelization variants (delaunay, rectangular) hit a pre-existing fragility in the Part 1 caching-ratio assertion under CPU + small datasets (cache speedup < 2x) that prevents end-to-end local validation; the Sanity blocks themselves are syntactically identical to the imaging pilot's and will run cleanly on the build server's run_all_scripts.sh path. Phase D.1 of z_features/fast_visualization.md. Closes #112. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 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.
Summary
Phase D.1 of
z_features/fast_visualization.md. Rolls the__Visualization Sanity__block pattern from PR #111 (imaging pilot) out to the remaining JIT-cached visualization scripts in this repo. Each block guards against the silent-zero / cache-busting / deflection-collapse regression class on every dataset type that exercises the JIT-cachedfit_for_visualizationpath.Phase A is superseded; Phase B + C already shipped. After this lands, Phase D.2 follows for
visualization_jax*.pyscripts and the missing-dataset coverage (ellipse, weak lensing, quantity viz_jit).Scripts Changed
scripts/imaging/modeling_visualization_jit_delaunay.py—__Visualization Sanity__block with SIE sanity tracer; assertions: 1+ tangential CC viazero_contour, finite positive Einstein radius, warm-call < 100 ms.scripts/imaging/modeling_visualization_jit_rectangular.py— identical Sanity block as delaunay (the pixelization mesh-class difference doesn't affect lensing latents).scripts/interferometer/modeling_visualization_jit.py— SIE Sanity block + interferometer-specificfit.model_data(complex visibilities) finite + non-zero assertion on the script's cachedfit_2.scripts/point_source/modeling_visualization_jit.py— SIE Sanity block only (no script-specific FoM assertion — the point-source prior-median position can legitimately give chi² = -inf when outside the image-pair basin; the SIE lensing-side checks catch the deflection-collapse failure class anyway).Block insertion point on every script: after the existing Part-1 caching probe
PASSprint, before the Part-2 Nautilus search docstring. All four blocks use_sanity_*prefixed local names so they don't collide with the script's existing variables.Test Plan
point_source/modeling_visualization_jit.py— full local run passed:1 tangential CC, einstein_radius=1.1938, warm call 67.3 ms.interferometer/modeling_visualization_jit.py— full local run passed up to and through Sanity block:1 tangential CC, einstein_radius=1.1938, warm call 63.7 ms, |model_data|.sum() = 20247.4135. Part 2 Nautilus continued cleanly until I terminated for time.imaging/modeling_visualization_jit_delaunay.py/_rectangular.py— Sanity block syntactically identical to the imaging pilot's (PR test(viz): __Visualization Sanity__ pilot block on imaging viz_jit (fast_viz A') #111) and uses the same SIE tracer. Not validated end-to-end locally because Part 1'scached_time < 0.5 * compile_timeassertion is a pre-existing fragility on pixelization scripts when cache speedup < 2x on CPU + small datasets. Build serverrun_all_scripts.sh(with full data) does see the expected speedup. The Sanity block runs after Part 1 PASS, so the assertion itself doesn't gate the Sanity logic — only my ability to validate locally./smoke_test autolens_workspace_test(the smoke list doesn't includemodeling_visualization_jit*.py; it tests other scripts to confirm no broader regression).run_all_scripts.shafter merge will exercise all four updated scripts end-to-end on the build server.Out of Scope (Phase D.2)
visualization_jax*.pyscripts (different code path — JAX-only validation, no Nautilus search).modeling_visualization_jit.pydon't exist yet.Closes #112 (alongside the autogalaxy_workspace_test companion).
🤖 Generated with Claude Code