Repository navigation
Description
Overview
The subplot_fit 3×4 layout currently devotes two panels to "Data" — full
scale and source scale — but the source-scale Data panel is near-useless, and
"Source Plane (Zoomed)" frequently over-zooms, making the fit hard to judge.
This task reshuffles the panels so Model Image sits beside Data, promotes the
zoomed source plane to the top right (rename: "Max Zoom"), and adds a new
"Source Plane (Mid Zoom)" panel — same centre as Max Zoom, but with x and y
extents 2.5× larger for context.
Plan
- Remove the "Data (Source Scale)" panel from
subplot_fit. - Move "Model Image" to the now-vacant slot beside "Data".
- Promote "Source Plane (Zoomed)" to the top-right slot and rename it
"Source Plane (Max Zoom)". - Add a new "Source Plane (Mid Zoom)" panel below Max Zoom — same centre, x
and y extents 2.5× larger. - Plumb a
zoom_extent_scalekwarg through the parametric and inversion
source-plane code paths (PyAutoLens + PyAutoArray) so the wider view can be
requested without duplicating logic. - Mirror the panel reshuffle in
subplot_fit_log10for consistency.
Detailed implementation plan
Affected Repositories
- PyAutoLens (primary) — panel reshuffle, new Mid Zoom panel,
zoom_extent_scalein_plot_source_planeandplane_image_from - PyAutoArray —
zoom_extent_scaleplumbed throughplot_mapper,plot_inversion_reconstruction, andmapper.extent_from
Work Classification
Library
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoLens | main | clean |
| ./PyAutoArray | main | clean |
Suggested branch: feature/subplot-fit-mid-zoom
Worktree root: ~/Code/PyAutoLabs-wt/subplot-fit-mid-zoom/ (created later by /start_library)
New subplot_fit 3×4 layout
| idx | row,col | Title | Notes |
|---|---|---|---|
| 0 | 0,0 | Data | unchanged |
| 1 | 0,1 | Model Image | moved from idx 3 |
| 2 | 0,2 | Signal-To-Noise Map | unchanged |
| 3 | 0,3 | Source Plane (Max Zoom) | moved from idx 7, renamed |
| 4 | 1,0 | Lens Light Model Image | unchanged |
| 5 | 1,1 | Lens Light Subtracted | unchanged |
| 6 | 1,2 | Source Model Image | unchanged |
| 7 | 1,3 | Source Plane (Mid Zoom) | NEW — 2.5× wider extent, same centre as Max Zoom |
| 8 | 2,0 | Normalized Residual Map | unchanged |
| 9 | 2,1 | Normalized Residual Map 1σ | unchanged |
| 10 | 2,2 | Chi-Squared Map | unchanged |
| 11 | 2,3 | Source Plane (No Zoom) | unchanged |
Implementation Steps
- PyAutoArray: add
zoom_extent_scale: float = 1.0tomapper.extent_from(scale the brightness-derived extent symmetrically about its centre when > 1.0). Thread it throughplot_inversion_reconstructionandplot_mapper. Default value preserves current behaviour. Add a unit test for the new parameter. - PyAutoLens
tracer_plots.plane_image_from: acceptzoom_extent_scale: float = 1.0. After the brightest extent is computed, expand(x_min, x_max, y_min, y_max)symmetrically around its centre by the scale factor before passing toextent_symmetric_from. Default value preserves current behaviour. - PyAutoLens
fit_imaging_plots._plot_source_plane: acceptzoom_extent_scale: float = 1.0and forward it toplane_image_fromandplot_mapper. - PyAutoLens
fit_imaging_plots.subplot_fit: reorder panels per the new 12-panel layout. Drop theData (Source Scale)call. Add a Mid Zoom call:_plot_source_plane(..., zoom_to_brightest=True, zoom_extent_scale=2.5, title="Source Plane (Mid Zoom)"). - PyAutoLens
fit_imaging_plots.subplot_fit_log10: mirror the same panel reshuffle. - Tests:
test_autolens/imaging/plot/test_fit_imaging_plots.py: update panel-count / title assertions; smoke-test the Mid Zoom panel for parametric and inversion source fits.test_autoarray/inversion/plot/...: exercisezoom_extent_scale=2.5on the inversion path.
Key Files
PyAutoLens/autolens/imaging/plot/fit_imaging_plots.py—subplot_fit,subplot_fit_log10,_plot_source_planePyAutoLens/autolens/lens/plot/tracer_plots.py—plane_image_fromPyAutoArray/autoarray/inversion/plot/mapper_plots.py—plot_mapperPyAutoArray/autoarray/plot/inversion.py—plot_inversion_reconstructionPyAutoArray/autoarray/inversion/mappers/...—extent_from
Original Prompt
Click to expand starting prompt
Currently, subplot_fit is 4 x 3 panels, with two source reconstructions in the middle-right and bottom-right row.
However, it is common for the Zoom panel to over zoom, making it hard to judge the fit.
Equally, the Data (Source Scale) panel is verging on useless.
Therefore, can we:
- Move Model Image to where Data (Source Scale) is and remove Data (Scouece Scale).
- Move Source Plane (Zoomed) up one to the top right and rename its title (Max Zoom).
- Make a new panel, Source Plane (Mid Zoom), which uses the same centre as Max Zoom but expands the y axia and x axis to be 2.5x larger than Max Zoom.
Activity
Jammy2211 commentedon May 18, 2026
Smoke Test Results — 2026-05-18
All 44 smoke tests passed across 5 workspaces (euclid skipped — no runner).
(euclid_strong_lens_modeling_pipeline skipped — no run_smoke.py runner)
Tested against
feature/subplot-fit-mid-zoombranches in worktreesubplot-fit-mid-zoom(PyAutoArray #324, PyAutoLens #518).Jammy2211 commentedon May 18, 2026
Shipped — 2026-05-18
PRs
Summary
Reshuffled the 12-panel
subplot_fit(andsubplot_fit_log10) layout: dropped "Data (Source Scale)", moved "Model Image" beside "Data", renamed "Source Plane (Zoomed)" → "Source Plane (Max Zoom)" and promoted it to the top right, and added a new "Source Plane (Mid Zoom)" panel. Mid Zoom uses 2× the Max Zoom extent, kept square, shrunk uniformly so all edges stay inside the No Zoom extent and the half-width never exceeds 0.7 × the No Zoom half-width — guaranteeing it always sits strictly between Max Zoom and No Zoom regardless of bright-pixel offset. Threaded azoom_extent_scalekwarg throughMapper.extent_from,plot_inversion_reconstruction,plot_mapper,_plot_source_plane, andplane_image_fromso the wider view can be requested by other callers.Session Notes
0.7 × bound_halfcap that ensures Mid Zoom is always visibly tighter than No Zoom.Zoom2D.extent_from: it returns values in a pixel-shifted coordinate system (centred at pixel index, not at the mask's arcsec origin).Grid2D.from_extenthappens to "fix" this by extracting the span only and re-centring at origin. For the Mid Zoom clamp, the bound now goes through the same round-trip (Grid2D.from_extent(...).geometry.extent) so it matches what the No Zoom panel actually displays.run_smoke.pyrunner).