Skip to content

feat: autolens interferometer JAX visualization scripts - #87

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/autolens-interferometer-jax-viz
May 8, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/autolens-interferometer-jax-viz

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Adds the missing interferometer/visualization_jax.py and interferometer/modeling_visualization_jit.py scripts in autolens_workspace_test, mirroring the imaging analogues. Phase 1A of PyAutoPrompt/issued/jax_visualization.md (the JAX visualization roadmap). Together with the upstream PyAutoLens fix (#500), this closes the autolens imaging + interferometer coverage for the JIT-cached visualization path.

Closes #86.

Scripts Changed

  • scripts/interferometer/visualization_jax.py (NEW) — exercises VisualizerInterferometer.visualize on the JIT-cached fit_for_visualization path. Uses enable_pytrees() + register_model(model) from the start, no try/except wrapper around the visualize call.
  • scripts/interferometer/modeling_visualization_jit.py (NEW) — two-part: Part 1 caching probe (calls analysis.fit_for_visualization twice and asserts the second call is significantly faster than the first); Part 2 live Nautilus run with linear MGE profiles (asserts _jitted_fit_from is cached on the analysis instance and fit.png lands on disk during quick updates). Cleans output/<path_prefix>/<name>/ before launching Nautilus so the search always runs fresh — without this, reruns silently resume from cached samples.csv and the JIT cache is never populated, breaking the assertion.
  • config/build/env_vars.yaml — split the existing interferometer/visualization override into NumPy-only (interferometer/visualization.py) and JAX-only (interferometer/visualization_jax) entries, mirroring the autolens imaging split shipped in fix: register_model in visualization_jax.py to actually exercise JIT path #85. Add an interferometer/modeling_visualization_jit override mirroring the imaging analogue.

Upstream PR

PyAutoLabs/PyAutoLens#500 — AnalysisInterferometer.__init__ kwargs passthrough. Required for these scripts to construct AnalysisInterferometer(use_jax_for_visualization=True, ...) without TypeError. Library-first merge gate enforces this PR merges only after #500.

Test Plan

  • python scripts/interferometer/visualization_jax.py (with JAX enabled) — PILOT SUCCEEDED — JAX-backed interferometer visualization produced fit.png/tracer.png.
  • python scripts/interferometer/modeling_visualization_jit.py (with JAX enabled) — JIT cache fires during Nautilus, fit.png produced, no KeyError from linear_light_profile_intensity_dict.

🤖 Generated with Claude Code

Jammy2211 added 2 commits May 8, 2026 21:44
Closes #86.

- scripts/interferometer/visualization_jax.py (NEW) — exercises
  VisualizerInterferometer.visualize on the JIT-cached
  fit_for_visualization path.
- scripts/interferometer/modeling_visualization_jit.py (NEW) — caching
  probe + live Nautilus run with linear MGE profiles, asserts the
  jit-cache fires during quick updates and fit.png lands on disk.
- config/build/env_vars.yaml — split the interferometer/visualization
  override into NumPy-only and JAX-only entries; add
  interferometer/modeling_visualization_jit override.

Mirrors the imaging analogues. Phase 1A of
PyAutoPrompt/issued/jax_visualization.md.

Depends on PyAutoLabs/PyAutoLens#500.
Without this cleanup the script would pass on first run but fail on
re-run because Nautilus resumes from cached samples.csv, skips live
sampling entirely, and the quick-update visualizer never fires — so
analysis_mge2._jitted_fit_from is never set and the assertion at the
bottom of Part 2 raises AttributeError.

Fix: rmtree output/<output_root>/<name>/ in addition to the existing
scripts/.../images/ rmtree, forcing every run to actually exercise
the live sampling path.
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 8, 2026
@Jammy2211
Jammy2211 merged commit 2d4ccf3 into main May 8, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/autolens-interferometer-jax-viz branch May 8, 2026 21:04
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: autolens interferometer JAX visualization coverage

1 participant