-
Notifications
You must be signed in to change notification settings - Fork 14
feat: reinstate title_prefix on all matplotlib subplot panel titles #332
Description
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 = Noneto allsubplot_*functions in PyAutoGalaxy and PyAutoLens*_plots.pyfiles - Inside each function apply the prefix to each panel title string before it reaches
plot_array() - Thread
self.title_prefixfrom everyPlottermethod 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— 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_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?