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
-
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.
-
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.
-
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.
-
PyAutoLens Plotter methods — pass title_prefix=self.title_prefix wherever subplot functions are called.
-
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.py — PlotterImaging.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?
Overview
Analysisclasses accepttitle_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 allAnalysisandPlotterclasses, but after a plot refactor the actual prefix logic was dropped — titles are now hardcoded strings in the*_plots.pyfunctions, andtitle_prefixis never applied.This issue reinstates the feature end-to-end.
Plan
title_prefix: str = Noneto allsubplot_*functions in PyAutoGalaxy and PyAutoLens*_plots.pyfilesplot_array()self.title_prefixfrom everyPlottermethod down to those function callsDetailed implementation plan
Affected Repositories
Work Classification
Library
Branch Survey
Suggested branch:
feature/title-prefix-subplotsImplementation Steps
PyAutoGalaxy
*_plots.py— addtitle_prefix: str = Noneto eachsubplot_*function. Apply with_pf = lambda t: f"{title_prefix}{t}" if title_prefix else tand 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.PyAutoGalaxy
Plottermethods — update every call to a subplot function to passtitle_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.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.PyAutoLens Plotter methods — pass
title_prefix=self.title_prefixwherever subplot functions are called.Tests — add/extend unit tests that set
title_prefix="TEST "and assert the prefix appears in thetitle=kwarg forwarded toplot_array(or by inspecting the axes title after a dry run).Key Files
autogalaxy/imaging/plot/fit_imaging_plots.py— primary example;subplot_fittitles "Data", "Signal-To-Noise Map", "Model Image", "Residual Map", "Normalized Residual Map", "Chi-Squared Map"autogalaxy/analysis/plotter.py— basePlotterclass that storesself.title_prefixautogalaxy/imaging/model/plotter.py—PlotterImaging.fit_imaging()callsfit_imaging_plots.subplot_fitOriginal 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?