Skip to content

feat(weak): aplt plotters for WeakDataset shear catalogues (#496) - #523

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/weak-visualization
May 18, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/weak-visualization

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Add a new autolens/weak/plot/ package providing module-level matplotlib helpers for visualising a WeakDataset — the data class added in step 1 of the weak-lensing series (PR #473). All five helpers are re-exported into the aplt namespace so workspace scripts can call e.g. aplt.subplot_weak_dataset(dataset=...).

Closes step 2 of the weak-lensing roadmap (issue #496). The workspace TODO placeholders in autolens_workspace/scripts/weak/simulator.py will be filled in by a follow-up workspace PR once this lands.

API Changes

Pure additions — no removals, no signature changes. Five new public functions on the aplt namespace for weak-lensing shear-catalogue visualisation. See full details below.

Test Plan

  • pytest test_autolens/weak/ -v → 16 passed (5 new plotter + 11 existing dataset/simulator)
  • python -c "import autolens.plot as aplt; aplt.subplot_weak_dataset" → resolves without ImportError
  • grep "^import jax\|^from jax" autolens/weak/plot/*.py → empty (numpy-only plotters)
Full API Changes (for automation & release notes)

Added

New module autolens.weak.plot.weak_dataset_plots:

  • plot_shear_yx_2d(shear_yx, ax=None, title="Shear Field", output_path=None, output_filename="shear_yx", output_format=None) — single-panel headless-quiver of a shear field at galaxy positions, colour-coded by |γ|. Uses pivot="middle", headwidth=0, headlength=0, headaxislength=0 (spin-2 convention).
  • plot_ellipticities(shear_yx, ax=None, title=r"Shear Magnitude $|\gamma|$", output_path=None, output_filename="shear_ellipticities", output_format=None) — scalar-coloured scatter of |γ| via autoarray.plot.grid.plot_grid.
  • plot_phis(shear_yx, ax=None, title=r"Shear Position Angle $\phi$", output_path=None, output_filename="shear_phis", output_format=None) — scalar-coloured scatter of position angle with cyclic colormap.
  • plot_noise_map(dataset, ax=None, title="Noise Map", output_path=None, output_filename="noise_map", output_format=None) — scalar-coloured scatter of per-galaxy shear noise.
  • subplot_weak_dataset(dataset, output_path=None, output_filename="subplot_weak_dataset", output_format=None, title_prefix=None) — 2×2 mosaic combining the four single-panel helpers.

All five re-exported into autolens.plot (the aplt namespace).

Migration

None required — additive change.

Implementation notes

  • Plotters access the shear field exclusively through .ellipticities (|γ|) and .phis (degrees, converted to radians inside plot_shear_yx_2d via np.deg2rad). The [:,0]=γ₂, [:,1]=γ₁ storage convention pinned by PyAutoGalaxy PR Jax to Main!  #366 stays encapsulated.
  • Pure numpy — no JAX imports.
  • Tests use direct module imports (from autolens.weak.plot.weak_dataset_plots import ...) matching the pattern in test_autolens/point/plot/.

🤖 Generated with Claude Code

Add a `weak/plot/` package with five module-level helpers for visualising a
WeakDataset, re-exported into the `aplt` namespace:

- plot_shear_yx_2d — headless-quiver of the shear field (spin-2 convention)
- plot_ellipticities, plot_phis — scalar-coloured scatter via plot_grid
- plot_noise_map — per-galaxy noise scatter
- subplot_weak_dataset — 2x2 mosaic combining the four panels

Plotters access the shear field through .ellipticities / .phis only, so the
[gamma_2, gamma_1] storage convention pinned by PyAutoGalaxy #366 stays
encapsulated. Five matching tests under test_autolens/weak/plot/ exercise
each helper via the existing plot_patch fixture.

Step 2 of the weak-lensing series (issue #496). Workspace TODO replacement
in autolens_workspace/scripts/weak/simulator.py follows in the workspace PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Workspace follow-up PR: PyAutoLabs/autolens_workspace#186

@Jammy2211
Jammy2211 merged commit 10bfea5 into main May 18, 2026
6 checks passed
@Jammy2211
Jammy2211 deleted the feature/weak-visualization branch May 18, 2026 19:54
@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