Repository navigation
Description
Overview
Phase 3a subtask of the cluster-strong-lensing epic (PyAutoMind ledger draft/feature/autolens/source_cluster_arc.md). autolens/cluster/plot/cluster_plots.py draws per-source-plane critical curves and caustics through the multi-plane LensCalc. It always calls the marching-squares methods directly, ignoring general.critical_curves_method in the visualize config. Every other plot honours that setting through PyAutoGalaxy's autogalaxy.util.plot_utils._critical_curves_method(). This issue makes plot_critical_curves and plot_caustics honour it too, so cluster plots agree with the rest of the library.
Plan
-
In
plot_critical_curvesandplot_caustics, choose each source plane's curve routine from_critical_curves_method():marching_squaresis the default and keeps today's behaviour;zero_contourusesLensCalc's existing*_via_zero_contour_frommethods;- the selector's config and missing-dependency fallback apply unchanged.
-
Preserve
LensCalc.from_tracer(use_multi_plane=True, plane_j=j), per-plane colours, labels, the radial option and the source-plane mapping. -
Tests on a two-source-plane cluster fixture:
- assert which routine each engine calls, for tangential and radial curves and caustics;
- assert the per-plane geometry is distinct;
- check that a configured
zero_contourfalls back whenjax_zero_contouris unavailable.
These tests check the plotting routing only. They do not claim JIT or gradient safety.
-
PyAutoLens only.
Tier: judge — merge mode: human /prm
Detailed implementation plan
Affected Repositories
- PyAutoLens (only)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
PyAutoLens (origin/main b29ffcc) |
main | clean |
No active.md claim on PyAutoLens.
Suggested branch: feature/cluster-curves-engine-dispatch
Implementation Steps
autolens/cluster/plot/cluster_plots.py:- Add a small helper that maps (method, kind ∈ {tangential, radial} × {critical curve, caustic}) to the
LensCalcroutine. Formarching_squaresthat istangential_critical_curve_list_fromand the existing routines; forzero_contourit istangential_critical_curve_list_via_zero_contour_fromand its siblings (autogalaxy/operate/lens_calc.py~1500–1700). - Read the method once per plot call via
autogalaxy.util.plot_utils._critical_curves_method(). - Mirror how
autogalaxy/util/plot_utils.py(~470–540) andautolens/lens/plot/critical_curves.pycall the zero-contour variants (their arguments: grid, initial points, etc.). - Keep
_lens_calc_for_planeas is.
- Add a small helper that maps (method, kind ∈ {tangential, radial} × {critical curve, caustic}) to the
- Docstrings: describe the engine choice. Keep the marching-squares grid note.
- Tests in
test_autolens/cluster/plot/(or beside the existing cluster plot tests), on a two-source-plane cluster fixture:- monkeypatch the selector to each engine and spy on the
LensCalcmethods called, for tangential and radial curves and caustics, per plane; - assert the plane-1 and plane-2 geometries differ;
- set the config to
zero_contourwhilejax_zero_contourimport fails, and assert the marching-squares fallback (the selector warns).
- monkeypatch the selector to each engine and spy on the
- Run the focused PyAutoLens tests and the full suite. Workspace cluster visualisation smoke, if available.
Key Files
autolens/cluster/plot/cluster_plots.py(_lens_calc_for_plane~167,plot_critical_curves~346,plot_caustics~440)- PyAutoGalaxy
autogalaxy/util/plot_utils.py:405(_critical_curves_method) and ~470–540 (how other plots dispatch) - PyAutoGalaxy
autogalaxy/operate/lens_calc.py~1431–1720 (*_via_zero_contour_from) autolens/lens/plot/critical_curves.py
Out of scope
Context-aware JIT dispatch, docstring fixes elsewhere, cluster-scale accuracy and performance, and the jax_zero_contour triage: these are the remaining phase-3 scope.
Original Prompt
Click to expand starting prompt
PyAutoMind draft/feature/autolens/cluster_curves_engine_dispatch.md (Epic: cluster-strong-lensing, Phase: 3a, Consequence: judge).
Make
autolens/cluster/plot/cluster_plots.pyselect the existing configured critical-curve engine for each source plane inplot_critical_curvesandplot_caustics. PreserveLensCalc.from_tracer(use_multi_plane=True, plane_j=j)and per-plane colours, labels, radial option and source-plane mapping. The default remainsmarching_squares; explicitzero_contouruses the existing LensCalc zero-contour methods. Use PyAutoGalaxy's existing private method selector so config and missing-dependency fallback agree with other plots. Keep changes in PyAutoLens only.Verify both configured engines on a two-source-plane cluster fixture, including tangential and radial curves and caustics. Tests must assert method routing and distinct per-plane geometry, not merely saved image paths. Check the configured-zero-contour behavior when the dependency is unavailable. Run focused PyAutoLens tests and appropriate workspace cluster visualization smoke. Do not claim JIT or gradient safety from a plotting test.
Activity
Jammy2211 commentedon Oct 28, 2026
Shipped
#808 merged 2026-10-28 as merge commit 1faa99a, labelled
pending-release. Head a0666e7 was green on every leg (unittest 3.12, 3.13, nojax; docs-build).Cluster
plot_critical_curves/plot_causticsnow honourgeneral.critical_curves_methodthrough PyAutoGalaxy's shared selector:marching_squaresis the default and is unchanged;zero_contourusesLensCalc*_via_zero_contour_from.Left for the remaining phase-3 scope:
zero_contourseeds only from LensCalc's ±3" scan, so cluster-scale curves outside that box are not drawn.Generated by Claude Code