You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The autolens_workspace_test interferometer dataset has a NumPy visualization.py but no visualization_jax.py or modeling_visualization_jit.py — those exist only for imaging. PyAutoLens's AnalysisInterferometer already dispatches via analysis.fit_for_visualization (visualizer.py:96, 209) and has full pytree registration, so the wiring is in place; this task adds the two missing test scripts. Phase 1A of PyAutoPrompt/issued/jax_visualization.md (the JAX visualization roadmap).
Plan
Add scripts/interferometer/visualization_jax.py — mirrors scripts/imaging/visualization_jax.py but uses AnalysisInterferometer and the interferometer simulator. Must include enable_pytrees() + register_model(model) from the start (lesson from PR fix: register_model in visualization_jax.py to actually exercise JIT path #85).
Add scripts/interferometer/modeling_visualization_jit.py — mirrors the imaging analogue's two-part shape (caching probe + live Nautilus run with iterations_per_quick_update, asserting the JIT cache fires and subplot_fit.png lands).
Reuse the existing simulator under scripts/jax_likelihood_functions/interferometer/.
Update config/build/env_vars.yaml to add imaging/visualization_jax-style overrides for the interferometer scripts (unset PYAUTO_DISABLE_JAX etc.).
Verify both scripts run locally with JAX enabled — they should print PILOT SUCCEEDED and produce the expected PNGs.
Detailed implementation plan
Affected Repositories
autolens_workspace_test (primary, only repo)
Work Classification
Workspace
Branch Survey
Repository
Current Branch
Dirty?
./autolens_workspace_test
main
README.md (unrelated automated version bump — not in scope for this task)
Suggested branch:feature/autolens-interferometer-jax-viz Worktree root:~/Code/PyAutoLabs-wt/autolens-interferometer-jax-viz/ (created later by /start_workspace)
Use al.AnalysisInterferometer instead of al.AnalysisImaging.
Use the interferometer dataset path: dataset/interferometer/jax_test.
Auto-simulate via subprocess.run([sys.executable, "scripts/jax_likelihood_functions/interferometer/simulator.py"], check=True) if missing.
Build the model with the parametric MGE pattern from scripts/jax_likelihood_functions/interferometer/mge.py (lens + source MGE).
Critical (lesson from PR fix: register_model in visualization_jax.py to actually exercise JIT path #85): import from autofit.jax.pytrees import enable_pytrees, register_model and call enable_pytrees() at module level + register_model(model) after building the model. Without these, jax.jit(fit_from) cannot trace the ModelInstance.
Critical: No try/except wrapper — call VisualizerInterferometer.visualize directly so any failure surfaces loudly. Assert subplot_fit.png (or fit.png, depending on which the interferometer plotter produces — verify via the imaging analogue's pattern).
Reuse config_source/visualize/plots.yaml from the existing interferometer/visualization.py so the visualization output is bounded.
Part 1: caching probe — call analysis.fit_for_visualization(instance) twice and assert the second call is significantly faster than the first (_jitted_fit_from is cached on the analysis instance).
Part 2: live Nautilus run with iterations_per_quick_update=500, n_like_max=1500, n_live=50, asserts fit.png files land under the output search root.
Same enable_pytrees() + register_model(model) setup as Part 1.
Use MGE linear light profiles (matches the imaging analogue's Part 2) so linear_light_profile_intensity_dict is exercised on the interferometer side.
config/build/env_vars.yaml — add overrides analogous to the autolens imaging entries:
Both must print PILOT SUCCEEDED (or the jit-cache pass message) and produce the expected PNGs.
Known risk
autolens_workspace_test interferometer scripts have historically been red on CI because of a gitignored sma.fits fixture (complete.md L1080). The simulator at scripts/jax_likelihood_functions/interferometer/simulator.py may depend on this fixture. If running the simulator from the worktree fails on a missing fixture, the autogalaxy port (complete.md L970) wrote a self-contained simulator using np.random.default_rng(seed=1) for 200 synthetic baselines — that's the fallback to mirror.
Overview
The autolens_workspace_test interferometer dataset has a NumPy
visualization.pybut novisualization_jax.pyormodeling_visualization_jit.py— those exist only forimaging. PyAutoLens'sAnalysisInterferometeralready dispatches viaanalysis.fit_for_visualization(visualizer.py:96, 209) and has full pytree registration, so the wiring is in place; this task adds the two missing test scripts. Phase 1A ofPyAutoPrompt/issued/jax_visualization.md(the JAX visualization roadmap).Plan
scripts/interferometer/visualization_jax.py— mirrorsscripts/imaging/visualization_jax.pybut usesAnalysisInterferometerand the interferometer simulator. Must includeenable_pytrees()+register_model(model)from the start (lesson from PR fix: register_model in visualization_jax.py to actually exercise JIT path #85).scripts/interferometer/modeling_visualization_jit.py— mirrors the imaging analogue's two-part shape (caching probe + live Nautilus run withiterations_per_quick_update, asserting the JIT cache fires andsubplot_fit.pnglands).scripts/jax_likelihood_functions/interferometer/.config/build/env_vars.yamlto addimaging/visualization_jax-style overrides for the interferometer scripts (unsetPYAUTO_DISABLE_JAXetc.).PILOT SUCCEEDEDand produce the expected PNGs.Detailed implementation plan
Affected Repositories
Work Classification
Workspace
Branch Survey
Suggested branch:
feature/autolens-interferometer-jax-vizWorktree root:
~/Code/PyAutoLabs-wt/autolens-interferometer-jax-viz/(created later by/start_workspace)Implementation Steps
scripts/interferometer/visualization_jax.py— mirror the structure ofscripts/imaging/visualization_jax.py(post-PR-fix: register_model in visualization_jax.py to actually exercise JIT path #85), with these differences:al.AnalysisInterferometerinstead ofal.AnalysisImaging.dataset/interferometer/jax_test.subprocess.run([sys.executable, "scripts/jax_likelihood_functions/interferometer/simulator.py"], check=True)if missing.scripts/jax_likelihood_functions/interferometer/mge.py(lens + source MGE).from autofit.jax.pytrees import enable_pytrees, register_modeland callenable_pytrees()at module level +register_model(model)after building the model. Without these,jax.jit(fit_from)cannot trace theModelInstance.try/exceptwrapper — callVisualizerInterferometer.visualizedirectly so any failure surfaces loudly. Assertsubplot_fit.png(orfit.png, depending on which the interferometer plotter produces — verify via the imaging analogue's pattern).config_source/visualize/plots.yamlfrom the existinginterferometer/visualization.pyso the visualization output is bounded.scripts/interferometer/modeling_visualization_jit.py— mirrorscripts/imaging/modeling_visualization_jit.py:analysis.fit_for_visualization(instance)twice and assert the second call is significantly faster than the first (_jitted_fit_fromis cached on the analysis instance).iterations_per_quick_update=500,n_like_max=1500,n_live=50, assertsfit.pngfiles land under the output search root.enable_pytrees()+register_model(model)setup as Part 1.linear_light_profile_intensity_dictis exercised on the interferometer side.config/build/env_vars.yaml— add overrides analogous to the autolens imaging entries:pattern: "interferometer/visualization_jax"→ unsetPYAUTO_DISABLE_JAX, PYAUTO_SMALL_DATASETS, PYAUTO_FAST_PLOTS(mirrors the newimaging/visualization_jaxentry from PR fix: register_model in visualization_jax.py to actually exercise JIT path #85).pattern: "interferometer/modeling_visualization_jit"→ unsetPYAUTO_DISABLE_JAX, PYAUTO_SMALL_DATASETS, PYAUTO_TEST_MODE, PYAUTO_FAST_PLOTS(mirrors the existingimaging/modeling_visualization_jitentry).Verification — run both with JAX enabled inside the worktree:
Both must print
PILOT SUCCEEDED(or the jit-cache pass message) and produce the expected PNGs.Known risk
autolens_workspace_test interferometer scripts have historically been red on CI because of a gitignored
sma.fitsfixture (complete.mdL1080). The simulator atscripts/jax_likelihood_functions/interferometer/simulator.pymay depend on this fixture. If running the simulator from the worktree fails on a missing fixture, the autogalaxy port (complete.mdL970) wrote a self-contained simulator usingnp.random.default_rng(seed=1)for 200 synthetic baselines — that's the fallback to mirror.Key Files
scripts/interferometer/visualization_jax.py(NEW)scripts/interferometer/modeling_visualization_jit.py(NEW)config/build/env_vars.yaml(EDIT — add 2 override entries)Reference patterns
scripts/imaging/visualization_jax.py— post-PR-fix: register_model in visualization_jax.py to actually exercise JIT path #85 pattern withenable_pytrees+register_modelscripts/imaging/modeling_visualization_jit.py— caching-probe + live-Nautilus patternscripts/jax_likelihood_functions/interferometer/mge.py— interferometer MGE model setupautolens/interferometer/model/visualizer.py:96, 209— already dispatches viafit_for_visualizationcomplete.mdL970 — autogalaxy port self-contained simulator pattern (fallback ifsma.fitsis missing)Original Prompt
Click to expand starting prompt
(elided — full text in PyAutoPrompt/issued/jax_viz_interferometer_coverage.md)