Skip to content

test(viz): __Visualization Sanity__ pilot block on imaging viz_jit (fast_viz A')#111

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/fast-viz-zero-contour-perf
May 21, 2026
Merged

test(viz): __Visualization Sanity__ pilot block on imaging viz_jit (fast_viz A')#111
Jammy2211 merged 1 commit into
mainfrom
feature/fast-viz-zero-contour-perf

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Adds the first __Visualization Sanity__ regression-net block on autolens_workspace_test/scripts/imaging/modeling_visualization_jit.py. The block exercises the JAX-jittable zero_contour critical-curve path on a deterministic SIE tracer (einstein_radius=1.2, ell_comps=(0.1, 0.0)) at script start, asserting:

  • Correctness: non-empty tangential critical curve, finite positive Einstein radius.
  • Perf: warm-call latency on the same LensCalc instance is under 100 ms.

Together these catch the three failure modes behind the 2026-04-19 and 2026-05-16 visualization-default reverts: (i) silent-zero source plane from a JAX-trace exception swallowed by the broad except, (ii) Einstein-radius latent collapse, (iii) closure cache-busting in _critical_curve_list_via_zero_contour that made warm calls cost ~10 s instead of ~67 ms. Local validation under PYAUTO_TEST_MODE=2: PASS Visualization Sanity (correctness): 1 tangential CC, einstein_radius=1.1938 and PASS Visualization Sanity (perf): warm call 79.0 ms.

The block runs unconditionally before the Nautilus search, so it fires on every run_all_scripts.sh invocation on the build server.

Scripts Changed

  • scripts/imaging/modeling_visualization_jit.py — appends a __Visualization Sanity__ prose block + correctness + perf asserts after the existing Part 1 MGE caching probe. Uses a separately-constructed SIE tracer so the assertions are deterministic regardless of the script's MGE prior medians.

Upstream PRs

Test Plan

  • Local smoke run of the script under PYAUTO_TEST_MODE=2 against the worktree libraries — Sanity block passes (einstein_radius=1.1938, warm call 79.0 ms).
  • Workspace_test smoke list — 11 / 12 active scripts PASS. The one failure (jax_likelihood_functions/point_source/point.py, JAX vmap returns -1e99 sentinel instead of -83.38) reproduces identically on canonical main without these changes; it is a pre-existing point-source-JAX regression and is out of scope for this PR.
  • After PyAutoGalaxy #434 + PyAutoLens #527 merge and a release ships, confirm this script's Sanity block continues to pass against the released library on the next run_all_scripts.sh build.

Closes PyAutoLabs/PyAutoGalaxy#433 (alongside the library companion PRs).

🤖 Generated with Claude Code

…ualization_jit

Three assertions on a deterministic SIE tracer (einstein_radius=1.2,
ell_comps=(0.1, 0.0)) — independent of the script's MGE prior medians:

- Correctness: tangential_critical_curve_list_via_zero_contour_from()
  returns a non-empty list. Catches the silent-zero source-plane
  failure mode that triggered the 2026-05-16 Euclid revert
  (PyAutoFit #1280).
- Correctness: einstein_radius_via_zero_contour_from() returns a
  finite positive value. Catches latent-variable collapse.
- Perf: warm-call latency on the SAME LensCalc instance is under
  100 ms. Regression net for the closure cache-busting bug fixed in
  PyAutoGalaxy #434 (warm calls were ~10 s before caching, ~67 ms
  after).

The block runs at script start before the Nautilus search so it
fires on every run_all_scripts.sh invocation. Closes
PyAutoLabs/PyAutoGalaxy#433 alongside the library PRs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

perf: cache zero_contour solver + viz sanity net (fast_viz A')

1 participant