Skip to content

feat: reinstate title_prefix on all matplotlib subplot panel titles #332

@Jammy2211

Description

@Jammy2211

Overview

Analysis classes accept title_prefix: str = None, which is intended to prefix every matplotlib subplot panel title (e.g. "VIS " gives "VIS Data", "VIS Signal-To-Noise Map", etc. for Euclid VIS imaging). The parameter is accepted and stored in all Analysis and Plotter classes, but after a plot refactor the actual prefix logic was dropped — titles are now hardcoded strings in the *_plots.py functions, and title_prefix is never applied.

This issue reinstates the feature end-to-end.

Plan

  • Add title_prefix: str = None to all subplot_* functions in PyAutoGalaxy and PyAutoLens *_plots.py files
  • Inside each function apply the prefix to each panel title string before it reaches plot_array()
  • Thread self.title_prefix from every Plotter method down to those function calls
  • Cover all dataset types: imaging, interferometer, quantity, ellipse, galaxies, adapt (AG); imaging, interferometer, tracer, point, sensitivity, subhalo (AL)
Detailed implementation plan

Affected Repositories

  • PyAutoGalaxy (primary)
  • PyAutoLens

Work Classification

Library

Branch Survey

Repository Current Branch Dirty?
PyAutoGalaxy main clean
PyAutoLens main clean

Suggested branch: feature/title-prefix-subplots

Implementation Steps

  1. PyAutoGalaxy *_plots.py — add title_prefix: str = None to each subplot_* function. Apply with _pf = lambda t: f"{title_prefix}{t}" if title_prefix else t and wrap every literal title string: _pf("Data"), _pf("Convergence"), etc. Files: imaging/plot/fit_imaging_plots.py, interferometer/plot/fit_interferometer_plots.py, quantity/plot/fit_quantity_plots.py, galaxy/plot/galaxies_plots.py, galaxy/plot/galaxy_plots.py, galaxy/plot/adapt_plots.py, ellipse/plot/fit_ellipse_plots.py.

  2. PyAutoGalaxy Plotter methods — update every call to a subplot function to pass title_prefix=self.title_prefix. Files: analysis/plotter.py (galaxies, adapt_images), imaging/model/plotter.py (fit_imaging, fit_imaging_combined), interferometer/model/plotter.py, quantity/model/plotter.py, ellipse/model/plotter.py.

  3. PyAutoLens *_plots.py — same pattern. Files: imaging/plot/fit_imaging_plots.py, interferometer/plot/fit_interferometer_plots.py, lens/plot/tracer_plots.py, lens/plot/sensitivity_plots.py, lens/plot/subhalo_plots.py, point/plot/fit_point_plots.py, point/plot/point_dataset_plots.py.

  4. PyAutoLens Plotter methods — pass title_prefix=self.title_prefix wherever subplot functions are called.

  5. Tests — add/extend unit tests that set title_prefix="TEST " and assert the prefix appears in the title= kwarg forwarded to plot_array (or by inspecting the axes title after a dry run).

Key Files

  • autogalaxy/imaging/plot/fit_imaging_plots.py — primary example; subplot_fit titles "Data", "Signal-To-Noise Map", "Model Image", "Residual Map", "Normalized Residual Map", "Chi-Squared Map"
  • autogalaxy/analysis/plotter.py — base Plotter class that stores self.title_prefix
  • autogalaxy/imaging/model/plotter.pyPlotterImaging.fit_imaging() calls fit_imaging_plots.subplot_fit

Original Prompt

Click to expand starting prompt

Analysis classes can receive this: title_prefix: str = None, on the old code this meant the title of all figures of all images on matplotlib subplots had this suffix, for example "VIS " for euclid VIS imaging. The suffix plotting has been lost in the plot refactor, can you reinstate it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions