Repository navigation
Description
Overview
First slice (8a) of phase 8 of the cluster strong-lensing arc: a standalone image-plane magnification map. Today the magnification appears only as a linear-scale panel in the fit subplots, where the critical lines swamp the colour range. This adds a log|μ| map with constant-μ contours and critical curves, in the style of LEGGOS II Fig. 4, for any mass object from a single galaxy to a cluster.
Plan
- Add
plot_magnification_2dto PyAutoGalaxy: log10|μ| map, colour range capped near the critical lines, labelled constant-μ contours (default 2, 5, 10, 20, 50, 100), optional critical-curve overlay. - Works for any mass object (Galaxies, Tracer), so galaxy, group and cluster scales all use it.
- Export it through PyAutoLens
aplt, with a Tracer test covering multiple planes. - Use it in the workspace (
guides/lens_calc.py,imaging/source_science.py), regenerate the navigator catalogue, and smoke-test. - No PyAutoArray change: the explicit-level contours are drawn on the axes
plot_arrayalready accepts (PyAutoArray is claimed by another task).
Tier: judge — merge mode: human /prm (ship PyAutoGalaxy → PyAutoLens → autolens_workspace).
Detailed implementation plan
Affected Repositories
- PyAutoGalaxy (primary)
- PyAutoLens
- autolens_workspace
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoGalaxy | main | clean |
| ./PyAutoLens | main | clean |
| ./autolens_workspace | main | clean |
Suggested branch: feature/magnification-maps-image-plane
Implementation Steps
- PyAutoGalaxy,
autogalaxy/galaxy/plot/galaxies_plots.py(or a sibling module):plot_magnification_2d(mass_obj, grid, contour_levels=(2, 5, 10, 20, 50, 100), include_critical_curves=True, vmax=None, title=..., output_path=..., output_format=..., ax=None).- μ from
LensCalc.from_mass_obj(mass_obj).magnification_2d_from(grid=grid). - Plot log10|μ| via
plot_array(ax=...)with the colour range capped (default from percentiles, so the divergences near the critical lines don't set it). - Draw
ax.contourat log10 of the chosen μ levels on the native grid, with labels. - Overlay critical curves from
_critical_curves_from(mass_obj, grid)through the existinglines=route.
- μ from
- Export from
autogalaxy/plot/__init__.py. - Tests in
test_autogalaxy/galaxy/plot/: renders to file, with and without contours and critical curves, single isothermal galaxy. - PyAutoLens: export from
autolens/plot/__init__.py; test with a two-plane Tracer. - autolens_workspace: replace the manual
aplt.plot_array(magnification)inscripts/guides/lens_calc.py; add the map toscripts/imaging/source_science.py; runregenerate_navigator.py autolens; smoke both scripts.
Key Files
autogalaxy/galaxy/plot/galaxies_plots.py— new functionautogalaxy/util/plot_utils.py—plot_array,_critical_curves_fromautogalaxy/operate/lens_calc.py—magnification_2d_fromautolens/plot/__init__.py— aplt exportautolens_workspace/scripts/guides/lens_calc.py,scripts/imaging/source_science.py
Original Prompt
Click to expand starting prompt
Magnification maps 8a: image-plane log|mu| map with constant-mu contours and critical curves
Type: feature
Target: PyAutoGalaxy
Repos:
- PyAutoGalaxy
- PyAutoLens
- autolens_workspace
Themes: - visualization
- cluster
Epic: cluster-strong-lensing
Phase: 8a
Parent: draft/feature/autolens/magnification_maps_visualization.md
Difficulty: medium
Autonomy: supervised
Priority: high
Status: formalised
Consequence: judge
Review-minutes: 25
Unattended: no
Filed: 2026-11-02
Original request (human, 2026-11-02)
yes go ahead with 8a
(Slice of phase 8 magnification_maps_visualization.md, sliced 8a→8d after a 2026-11-02 re-audit.)
Re-audit (2026-11-02)
- The image-plane magnification is only the 9th panel of
subplot_fitinfit_imaging_plots.py(~l.730/789) and
fit_interferometer_plots.py(~l.612/685), on a LINEAR colour scale; no standalone plot function; no aplt export. plot_array(contours=int)(autoarray/plot/array.py,_apply_contoursin autoarray/plot/utils.py:849) takes a level
COUNT only — no explicit mu levels.- Critical curves:
_critical_curves_from(mass_obj, grid)in autogalaxy/util/plot_utils.py:492. guides/lens_calc.py(~l.318) plots magnification manually withaplt.plot_array.
Work
- (Dropped 2026-11-02: PyAutoArray is claimed by rectangular-gradient-rtu-sparse; no PyAutoArray change —
plot_arraytakesax, so the explicit-level contours are drawn on that axes inside the PyAutoGalaxy function.) - PyAutoGalaxy:
plot_magnification_2d(mass_obj, grid, ...)— log10|mu| image-plane map, colour range capped near the
critical lines, constant-mu contours (default 2, 5, 10, 20, 50, 100), optional critical-curve overlay; works for any
mass object (Galaxies, Tracer); exported fromautogalaxy.plot. Unit tests. - PyAutoLens: export via
aplt; Tracer test (incl. multi-plane). - autolens_workspace: use it in
guides/lens_calc.pyandimaging/source_science.py; regenerate the navigator
catalogue (regenerate_navigator.py autolens); smoke.
Witness: aplt.plot_magnification_2d(tracer, grid) renders log|mu| with labelled constant-mu contours and critical
curves for the imaging simple__no_lens_light lens and a multi_galaxy lens; library tests pass; workspace scripts
smoke clean.
Activity
Jammy2211 commentedon Nov 2, 2026
PRs open (judge tier, human /prm, merge in this order):
plot_magnification_2d(test_autogalaxy 1469 passed)apltexport (test_autolens 1018 passed, 1 xfailed)Heart STALE (
release validation incomplete: no rehearsal for current source) acknowledged by the human 2026-11-02.Jammy2211 commentedon Nov 2, 2026
Shipped
Merged in order:
467a5ed7) —plot_magnification_2d: log10 |mu| image-plane map, labelled constant-mu contours, critical curves, for any mass objectef7f5733) —aplt.plot_magnification_2d6567940d) — imagingsource_science.py__Magnification Map__+guides/lens_calc.pyLibrary PRs pending release. Next in phase 8: 8b, source-plane magnification per mesh pixel.
🤖 Generated with Claude Code