Skip to content

test(viz): __Visualization Sanity__ rollout across modeling_visualization_jit*.py#113

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/viz-sanity-rollout-jit-scripts
May 21, 2026
Merged

test(viz): __Visualization Sanity__ rollout across modeling_visualization_jit*.py#113
Jammy2211 merged 1 commit into
mainfrom
feature/viz-sanity-rollout-jit-scripts

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

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-cached fit_for_visualization path.

Phase A is superseded; Phase B + C already shipped. After this lands, Phase D.2 follows for visualization_jax*.py scripts 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 via zero_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-specific fit.model_data (complex visibilities) finite + non-zero assertion on the script's cached fit_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 PASS print, 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's cached_time < 0.5 * compile_time assertion is a pre-existing fragility on pixelization scripts when cache speedup < 2x on CPU + small datasets. Build server run_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.
  • Workspace smoke tests via /smoke_test autolens_workspace_test (the smoke list doesn't include modeling_visualization_jit*.py; it tests other scripts to confirm no broader regression).
  • CI run_all_scripts.sh after merge will exercise all four updated scripts end-to-end on the build server.

Out of Scope (Phase D.2)

  • visualization_jax*.py scripts (different code path — JAX-only validation, no Nautilus search).
  • Missing-dataset coverage: ellipse / weak lensing / quantity modeling_visualization_jit.py don't exist yet.

Closes #112 (alongside the autogalaxy_workspace_test companion).

🤖 Generated with Claude Code

…_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>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 21, 2026
@Jammy2211 Jammy2211 merged commit a2f01fe into main May 21, 2026
0 of 4 checks passed
@Jammy2211 Jammy2211 deleted the feature/viz-sanity-rollout-jit-scripts branch May 21, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(viz): __Visualization Sanity__ rollout across modeling_visualization_jit*.py

1 participant