Skip to content

feat: image-plane magnification map with constant-mu contours (arc 8a) #689

Closed

Description

@Jammy2211

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_2d to 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_array already 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

  1. 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.contour at log10 of the chosen μ levels on the native grid, with labels.
    • Overlay critical curves from _critical_curves_from(mass_obj, grid) through the existing lines= route.
  2. Export from autogalaxy/plot/__init__.py.
  3. Tests in test_autogalaxy/galaxy/plot/: renders to file, with and without contours and critical curves, single isothermal galaxy.
  4. PyAutoLens: export from autolens/plot/__init__.py; test with a two-plane Tracer.
  5. autolens_workspace: replace the manual aplt.plot_array(magnification) in scripts/guides/lens_calc.py; add the map to scripts/imaging/source_science.py; run regenerate_navigator.py autolens; smoke both scripts.

Key Files

  • autogalaxy/galaxy/plot/galaxies_plots.py — new function
  • autogalaxy/util/plot_utils.py — plot_array, _critical_curves_from
  • autogalaxy/operate/lens_calc.py — magnification_2d_from
  • autolens/plot/__init__.py — aplt export
  • autolens_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_fit in fit_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_contours in 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 with aplt.plot_array.

Work

  1. (Dropped 2026-11-02: PyAutoArray is claimed by rectangular-gradient-rtu-sparse; no PyAutoArray change —
    plot_array takes ax, so the explicit-level contours are drawn on that axes inside the PyAutoGalaxy function.)
  2. 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 from autogalaxy.plot. Unit tests.
  3. PyAutoLens: export via aplt; Tracer test (incl. multi-plane).
  4. autolens_workspace: use it in guides/lens_calc.py and imaging/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

  1. Jammy2211 commented on Nov 2, 2026

    @Jammy2211
    CollaboratorAuthor

    PRs open (judge tier, human /prm, merge in this order):

    1. feat: plot_magnification_2d — image-plane magnification map with constant-mu contours #690 — plot_magnification_2d (test_autogalaxy 1469 passed)
    2. feat: aplt.plot_magnification_2d for tracers PyAutoLens#815 — aplt export (test_autolens 1018 passed, 1 xfailed)
    3. docs: image-plane magnification map (arc phase 8a) autolens_workspace#614 — imaging source_science + lens_calc guide (smoke clean)

    Heart STALE (release validation incomplete: no rehearsal for current source) acknowledged by the human 2026-11-02.

  2. Jammy2211 commented on Nov 2, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped

    Merged in order:

    1. feat: plot_magnification_2d — image-plane magnification map with constant-mu contours #690 (467a5ed7) — plot_magnification_2d: log10 |mu| image-plane map, labelled constant-mu contours, critical curves, for any mass object
    2. feat: aplt.plot_magnification_2d for tracers PyAutoLens#815 (ef7f5733) — aplt.plot_magnification_2d
    3. docs: image-plane magnification map (arc phase 8a) autolens_workspace#614 (6567940d) — imaging source_science.py __Magnification Map__ + guides/lens_calc.py

    Library PRs pending release. Next in phase 8: 8b, source-plane magnification per mesh pixel.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions