Skip to content

feat: add zoom_extent_scale to Mapper.extent_from for Mid Zoom panel - #324

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/subplot-fit-mid-zoom
May 18, 2026
Merged

feat: add zoom_extent_scale to Mapper.extent_from for Mid Zoom panel#324
Jammy2211 merged 1 commit into
mainfrom
feature/subplot-fit-mid-zoom

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Adds a zoom_extent_scale parameter to Mapper.extent_from and threads it through plot_inversion_reconstruction and plot_mapper. This lets callers (notably PyAutoLens's new "Source Plane (Mid Zoom)" subplot panel) request a source-plane view that's a multiple of the brightest-region extent, kept square and clamped so it never exceeds the source-plane mesh extent or sits arbitrarily close to it.

API Changes

  • Mapper.extent_from(...) gains an optional zoom_extent_scale: float = 1.0 argument. Default behaviour is unchanged.
  • plot_inversion_reconstruction(...) and plot_mapper(...) gain the same passthrough kwarg.
  • When zoom_extent_scale > 1.0, the returned extent is the brightest-region extent expanded by that factor about its centre, capped uniformly so (a) no edge exceeds the source-plane mesh extent (b) the half-width never exceeds 0.7 × the mesh half-width, keeping the panel a strict subset of the No Zoom view.

See full details below.

Test Plan

  • python -m pytest test_autoarray/inversion/plot test_autoarray/inversion -x passes
  • New test__plot_mapper__zoom_extent_scale__widens_extent_around_centre exercises the new kwarg
Full API Changes (for automation & release notes)

Added

  • Mapper.extent_from(values=None, zoom_to_brightest=True, zoom_percent=None, zoom_extent_scale=1.0) — new optional kwarg. Scales the brightness-derived extent by this factor about its centre, clamped to the mesh extent.
  • plot_inversion_reconstruction(..., zoom_extent_scale=1.0, ...) — new optional kwarg, forwarded to mapper.extent_from.
  • plot_mapper(..., zoom_extent_scale=1.0, ...) — new optional kwarg, forwarded to plot_inversion_reconstruction.

Changed Behaviour

  • None when zoom_extent_scale=1.0 (the default).
  • When zoom_extent_scale != 1.0, the returned extent is the brightest-region extent scaled by that factor about its centre, then capped to a half-width that is the smallest of: target half-width, distance from brightest centre to the nearest mesh edge, and 0.7 × the mesh half-width.

🤖 Generated with Claude Code

Thread a new `zoom_extent_scale: float = 1.0` kwarg through
Mapper.extent_from, plot_inversion_reconstruction, and plot_mapper.
When >1.0, scales the brightness-derived extent by this factor about
its centre and clamps the result so it never exceeds the source-plane
mesh extent or sits arbitrarily close (capped at 0.7 × mesh half).

Used by PyAutoLens's new Source Plane (Mid Zoom) subplot panel.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 18, 2026
@Jammy2211
Jammy2211 merged commit 5222205 into main May 18, 2026
6 checks passed
@Jammy2211
Jammy2211 deleted the feature/subplot-fit-mid-zoom branch August 25, 2026 18:16
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant