feat(weak): aplt plotters for WeakDataset shear catalogues (#496)#523
Merged
Conversation
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>
This was referenced May 18, 2026
Collaborator
Author
|
Workspace follow-up PR: PyAutoLabs/autolens_workspace#186 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new
autolens/weak/plot/package providing module-level matplotlib helpers for visualising aWeakDataset— the data class added in step 1 of the weak-lensing series (PR #473). All five helpers are re-exported into theapltnamespace 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.pywill 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
apltnamespace 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 ImportErrorgrep "^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|γ|. Usespivot="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|γ|viaautoarray.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(theapltnamespace).Migration
None required — additive change.
Implementation notes
.ellipticities(|γ|) and.phis(degrees, converted to radians insideplot_shear_yx_2dvianp.deg2rad). The[:,0]=γ₂, [:,1]=γ₁storage convention pinned by PyAutoGalaxy PR Jax to Main! #366 stays encapsulated.from autolens.weak.plot.weak_dataset_plots import ...) matching the pattern intest_autolens/point/plot/.🤖 Generated with Claude Code