Skip to content

docs: fill plot.py coverage gaps against the source plot modules - #404

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/plot-coverage-gaps
Jul 30, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/plot-coverage-gaps

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Workspace half of PyAutoLabs/PyAutoLens#667.

The plot-guides-restructure task created the per-dataset plot.py family but never audited whether each file demonstrates the functions its dataset/fit type actually has. scripts/imaging/plot.py called aplt.subplot_fit_imaging and nothing else — and its own __Visualizer__ section named subplot_of_planes in prose while never demonstrating it, hand-rolling a fit.model_images_of_planes_list loop in its place.

An audit of every public function in the source *_plots.py modules against every aplt.* call in the workspace found subplot_fit_imaging_log10, subplot_fit_imaging_of_planes and subplot_fit_imaging_tracer used nowhere in the repo at all. This adds those and the equivalent gaps in four other plot.py files.

plot.py coverage rises from 18 → 36 of the 63 symbols autolens.plot exports.

Upstream PR

PyAutoLabs/PyAutoLens#668 — must merge first. It exports subplot_interferometer_dataset, which scripts/interferometer/plot.py now calls. Without it that call raises AttributeError.

Scripts Changed

Script Added
scripts/imaging/plot.py subplot_fit_imaging_of_planes (incl. plane_index form), subplot_fit_imaging_log10, subplot_fit_imaging_tracer, fits_imaging
scripts/interferometer/plot.py subplot_interferometer_dataset, fit-level subplot_fit_dirty_images, subplot_fit_interferometer_real_space, subplot_fit_interferometer_tracer, fits_interferometer
scripts/weak/plot.py plot_convergence_map, plot_data_vs_model, plot_residuals, plot_chi_squared_map
scripts/cluster/plot.py plot_image_group_zooms, plot_critical_curves, plot_caustics
scripts/point_source/plot.py subplot_point_dataset

Each file's __Contents__ index was updated to match. Every file's __Visualizer__ section remains last. Notebooks regenerated from scripts (never edited directly).

Two notes on the changes:

  • interferometer/plot.py previously used "Dataset Subplot" as the heading for the dirty images. Now that a real dataset subplot exists, that section is renamed __Dirty Images Subplot__ and __Dataset Subplot__ covers the uv-plane quantities.
  • cluster/plot.py needs a Tracer for critical curves and caustics. Rather than duplicating start_here.py's model composition, it builds the truth model straight from the dataset's own mass.csv / point.csv via al.galaxy_af_models_from_csv_tables(). Those models have prior_count == 0 (every CSV value is a fixed default), so instance_from_prior_medians() returns the exact truth galaxies rather than a sample — 6 lines, no fitting.

Test Plan

  • All 5 scripts executed sequentially in test mode with visualization on (MPLBACKEND=Agg, PYAUTO_TEST_MODE=1), against the branch build of PyAutoLens via a shared task worktree. 5/5 ran to completion through their final Visualizer print. Sequential because parallel workspace runs fake failures through shared state.
  • Coverage matrix re-run against the edited files rather than trusting the edits: 22/22 planned gaps closed across both workspaces.
  • The excluded *_x1_plane pair verified as called nowhere.
  • Leak check: git status --porcelain showed only the intended files. The fits_* sections write to output/plot/…, confirmed gitignored via git check-ignore; the written FITS was opened and confirmed to hold the expected named HDUs (MASK, DATA, PSF, NOISE_MAP).
  • Notebook regeneration produced changes to exactly these 5 notebooks plus the two catalogue files — no unrelated drift swept in.
Deliberately excluded, with reasons
  • subplot_fit_imaging_x1_plane / subplot_fit_imaging_log10_x1_plane — not added as calls. subplot_fit dispatches to them itself (fit_imaging_plots.py:214, :346, :512) when len(fit.tracer.planes) == 1. On the two-plane example fits here they are unreachable by design, so a call would teach a wrong idiom. A prose line in __Fit Subplot__ documents the auto-switch instead.
  • Tracer / galaxy / profile subplots (subplot_tracer, subplot_galaxies, subplot_galaxy_light_profiles, subplot_galaxy_mass_profiles, subplot_galaxy_images, subplot_basis_image, subplot_adapt_images) — already covered in guides/ (guides/tracer.py, guides/galaxies.py, guides/plot/start_here.py). Not duplicated; plot.py owns dataset+fit plotting for its own data type.
  • Results / search plots (subplot_parameters, log_likelihood_vs_iteration, output_figure, corner_anesthetic) — guides/plot/searches.py and guides/results/ material.
  • subplot_fit_interferometer_combined — newly exported in #668 for API symmetry with imaging's subplot_fit_combined, but not demonstrated here. It takes a fit_list, so its natural home is a multi-dataset interferometer example, not this single-fit script; passing [fit, fit] would teach a wrong idiom. Follow-up.
  • Sensitivity subplots (subplot_sensitivity_tracer_images, subplot_sensitivity_figures_of_merit) — belong to the subhalo/sensitivity feature area.

Generated by the PyAutoLabs agent workflow.

The per-dataset plot.py family created by the plot-guides-restructure task was
never audited for per-file function coverage. imaging/plot.py called
subplot_fit_imaging and nothing else, and its own __Visualizer__ section named
subplot_of_planes in prose while never demonstrating it.

Adds the missing dataset- and fit-level demos, plus a FITS output section:

- imaging: subplot_fit_imaging_of_planes, subplot_fit_imaging_log10,
  subplot_fit_imaging_tracer, fits_imaging
- interferometer: subplot_interferometer_dataset (newly exported upstream),
  subplot_fit_dirty_images, subplot_fit_interferometer_real_space,
  subplot_fit_interferometer_tracer, fits_interferometer
- weak: plot_convergence_map, plot_data_vs_model, plot_residuals,
  plot_chi_squared_map
- cluster: plot_image_group_zooms, plot_critical_curves, plot_caustics
- point_source: subplot_point_dataset

subplot_fit_imaging_x1_plane and its log10 variant are deliberately NOT called:
subplot_fit dispatches to them itself for single-plane tracers, so on the
two-plane example fits they are unreachable. A prose line documents the
auto-switch instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 30, 2026
@Jammy2211
Jammy2211 merged commit 5b558f5 into main Jul 30, 2026
10 checks passed
@Jammy2211
Jammy2211 deleted the feature/plot-coverage-gaps branch July 30, 2026 15:22
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Oct 7, 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