From f27226cfc5003f68c9fc9cd0f1e3f4d9dab47da3 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 19:28:39 +0100 Subject: [PATCH 1/4] feat: add title_prefix support to subplot_imaging_dataset / _list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds `title_prefix: str = None` to both `subplot_imaging_dataset` and `subplot_imaging_dataset_list`. The prefix is applied (with an automatic trailing space) to all data-content panel titles — Data, Data (log10), Noise-Map, Point Spread Function, PSF (log10), Signal-To-Noise Map — but intentionally NOT to the Over Sample Size panels, which describe grid configuration rather than observed data. Co-Authored-By: Claude Opus 4.6 (1M context) --- autoarray/dataset/plot/imaging_plots.py | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/autoarray/dataset/plot/imaging_plots.py b/autoarray/dataset/plot/imaging_plots.py index 53f6499c..6c2d3da2 100644 --- a/autoarray/dataset/plot/imaging_plots.py +++ b/autoarray/dataset/plot/imaging_plots.py @@ -14,6 +14,7 @@ def subplot_imaging_dataset( grid=None, positions=None, lines=None, + title_prefix: str = None, ): """ 3×3 subplot of core ``Imaging`` dataset components. @@ -50,13 +51,15 @@ def subplot_imaging_dataset( from autoarray.plot.array import plot_array + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) + fig, axes = subplots(3, 3, figsize=conf_subplot_figsize(3, 3)) axes = axes.flatten() plot_array( dataset.data, ax=axes[0], - title="Data", + title=_pf("Data"), colormap=colormap, use_log10=use_log10, grid=grid, @@ -66,7 +69,7 @@ def subplot_imaging_dataset( plot_array( dataset.data, ax=axes[1], - title="Data (log10)", + title=_pf("Data (log10)"), colormap=colormap, use_log10=True, grid=grid, @@ -76,7 +79,7 @@ def subplot_imaging_dataset( plot_array( dataset.noise_map, ax=axes[2], - title="Noise-Map", + title=_pf("Noise-Map"), colormap=colormap, use_log10=use_log10, grid=grid, @@ -88,7 +91,7 @@ def subplot_imaging_dataset( plot_array( dataset.psf.kernel, ax=axes[3], - title="Point Spread Function", + title=_pf("Point Spread Function"), colormap=colormap, use_log10=use_log10, cb_unit="", @@ -96,7 +99,7 @@ def subplot_imaging_dataset( plot_array( dataset.psf.kernel, ax=axes[4], - title="PSF (log10)", + title=_pf("PSF (log10)"), colormap=colormap, use_log10=True, cb_unit="", @@ -105,7 +108,7 @@ def subplot_imaging_dataset( plot_array( dataset.signal_to_noise_map, ax=axes[5], - title="Signal-To-Noise Map", + title=_pf("Signal-To-Noise Map"), colormap=colormap, use_log10=use_log10, cb_unit="", @@ -148,6 +151,7 @@ def subplot_imaging_dataset_list( output_path=None, output_filename: str = "dataset_combined", output_format=None, + title_prefix: str = None, ): """ n×3 subplot showing core components for each dataset in a list. @@ -164,20 +168,24 @@ def subplot_imaging_dataset_list( Base filename without extension. output_format File format string or list, e.g. ``"png"`` or ``["png"]``. + title_prefix + Optional string prepended (with an automatic space) to every panel title. """ if isinstance(output_format, (list, tuple)): output_format = output_format[0] from autoarray.plot.array import plot_array + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) + n = len(dataset_list) fig, axes = subplots(n, 3, figsize=conf_subplot_figsize(n, 3)) if n == 1: axes = [axes] for i, dataset in enumerate(dataset_list): - plot_array(dataset.data, ax=axes[i][0], title="Data") - plot_array(dataset.noise_map, ax=axes[i][1], title="Noise Map") - plot_array(dataset.signal_to_noise_map, ax=axes[i][2], title="Signal-To-Noise Map") + plot_array(dataset.data, ax=axes[i][0], title=_pf("Data")) + plot_array(dataset.noise_map, ax=axes[i][1], title=_pf("Noise Map")) + plot_array(dataset.signal_to_noise_map, ax=axes[i][2], title=_pf("Signal-To-Noise Map")) tight_layout() subplot_save(fig, output_path, output_filename, output_format) From c1d8f537198691e7714bc524b4ed6c0d92c8f086 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 19:34:49 +0100 Subject: [PATCH 2/4] feat: add title_prefix to subplot_of_mapper; rename Unzoomed panels All panel titles in subplot_of_mapper now receive the title_prefix (with auto-space). Also renames: "Noise-Map (Unzoomed)" -> "Noise-Map (No Zoom)" "Regularization Weights (Unzoomed)" -> "Regularization (No Zoom)" Co-Authored-By: Claude Opus 4.6 (1M context) --- autoarray/inversion/plot/inversion_plots.py | 25 ++++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/autoarray/inversion/plot/inversion_plots.py b/autoarray/inversion/plot/inversion_plots.py index 0187caa4..b97bc48e 100644 --- a/autoarray/inversion/plot/inversion_plots.py +++ b/autoarray/inversion/plot/inversion_plots.py @@ -27,6 +27,7 @@ def subplot_of_mapper( lines=None, grid=None, positions=None, + title_prefix: str = None, ): """ 3×4 subplot showing all pixelization diagnostics for one mapper. @@ -52,6 +53,8 @@ def subplot_of_mapper( """ mapper = inversion.cls_list_from(cls=Mapper)[mapper_index] + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) + fig, axes = subplots(3, 4, figsize=conf_subplot_figsize(3, 4)) axes = axes.flatten() @@ -60,7 +63,7 @@ def subplot_of_mapper( plot_array( inversion.data_subtracted_dict[mapper], ax=axes[0], - title="Data Subtracted", + title=_pf("Data Subtracted"), colormap=colormap, use_log10=use_log10, grid=grid, @@ -83,7 +86,7 @@ def _recon_array(): plot_array( _recon_array(), ax=axes[1], - title="Reconstructed Image", + title=_pf("Reconstructed Image"), colormap=colormap, use_log10=use_log10, grid=grid, @@ -93,7 +96,7 @@ def _recon_array(): plot_array( _recon_array(), ax=axes[2], - title="Reconstructed Image (log10)", + title=_pf("Reconstructed Image (log10)"), colormap=colormap, use_log10=True, grid=grid, @@ -103,7 +106,7 @@ def _recon_array(): plot_array( _recon_array(), ax=axes[3], - title="Mesh Pixel Grid Overlaid", + title=_pf("Mesh Pixel Grid Overlaid"), colormap=colormap, use_log10=use_log10, grid=numpy_grid(mapper.image_plane_mesh_grid), @@ -123,7 +126,7 @@ def _recon_array(): mapper, solution_vector=pixel_values, ax=axes[4], - title="Source Plane (Zoom)", + title=_pf("Source Plane (Zoom)"), colormap=colormap, use_log10=use_log10, vmax=recon_vmax, @@ -135,7 +138,7 @@ def _recon_array(): mapper, solution_vector=pixel_values, ax=axes[5], - title="Source Plane (No Zoom)", + title=_pf("Source Plane (No Zoom)"), colormap=colormap, use_log10=use_log10, vmax=recon_vmax, @@ -151,7 +154,7 @@ def _recon_array(): mapper, solution_vector=nm, ax=axes[6], - title="Noise-Map (Unzoomed)", + title=_pf("Noise-Map (No Zoom)"), colormap=colormap, use_log10=use_log10, zoom_to_brightest=False, @@ -168,7 +171,7 @@ def _recon_array(): mapper, solution_vector=rw, ax=axes[7], - title="Regularization Weights (Unzoomed)", + title=_pf("Regularization (No Zoom)"), colormap=colormap, use_log10=use_log10, zoom_to_brightest=False, @@ -186,7 +189,7 @@ def _recon_array(): plot_array( sub_size, ax=axes[8], - title="Sub Pixels Per Image Pixels", + title=_pf("Sub Pixels Per Image Pixels"), colormap=colormap, use_log10=use_log10, ) @@ -198,7 +201,7 @@ def _recon_array(): plot_array( mapper.mesh_pixels_per_image_pixels, ax=axes[9], - title="Mesh Pixels Per Image Pixels", + title=_pf("Mesh Pixels Per Image Pixels"), colormap=colormap, use_log10=use_log10, ) @@ -212,7 +215,7 @@ def _recon_array(): mapper, solution_vector=pw, ax=axes[10], - title="Image Pixels Per Source Pixel", + title=_pf("Image Pixels Per Source Pixel"), colormap=colormap, use_log10=use_log10, zoom_to_brightest=True, From 346ede4e02bc905a4aafec4eee07471299d3f39c Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 19:35:58 +0100 Subject: [PATCH 3/4] fix: pass is_subplot to apply_labels in plot_inversion_reconstruction Without this, subplot panels always used the standalone title font size (24) instead of the subplot size (20), making rectangular pixelization titles visually inconsistent with all other subplot panels. Co-Authored-By: Claude Opus 4.6 (1M context) --- autoarray/plot/inversion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoarray/plot/inversion.py b/autoarray/plot/inversion.py index cd85dcec..d23f5e09 100644 --- a/autoarray/plot/inversion.py +++ b/autoarray/plot/inversion.py @@ -136,7 +136,7 @@ def plot_inversion_reconstruction( apply_extent(ax, extent) - apply_labels(ax, title=title, xlabel="" if is_subplot else xlabel, ylabel="" if is_subplot else ylabel) + apply_labels(ax, title=title, xlabel="" if is_subplot else xlabel, ylabel="" if is_subplot else ylabel, is_subplot=is_subplot) if owns_figure: save_figure( From db798ae51e982172d63657a619ffbed6ced21cb7 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Tue, 7 Apr 2026 19:39:56 +0100 Subject: [PATCH 4/4] feat: add title_prefix to subplot_interferometer_dataset Co-Authored-By: Claude Opus 4.6 (1M context) --- autoarray/dataset/plot/interferometer_plots.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/autoarray/dataset/plot/interferometer_plots.py b/autoarray/dataset/plot/interferometer_plots.py index 359d55b1..390f019d 100644 --- a/autoarray/dataset/plot/interferometer_plots.py +++ b/autoarray/dataset/plot/interferometer_plots.py @@ -16,6 +16,7 @@ def subplot_interferometer_dataset( output_format: str = None, colormap=None, use_log10: bool = False, + title_prefix: str = None, ): """ 2x3 subplot of interferometer dataset components. @@ -38,17 +39,19 @@ def subplot_interferometer_dataset( use_log10 Apply log10 normalisation to image panels. """ + _pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t) + fig, axes = subplots(2, 3, figsize=conf_subplot_figsize(2, 3)) axes = axes.flatten() - plot_grid(dataset.data.in_grid, ax=axes[0], title="Visibilities", xlabel="", ylabel="") + plot_grid(dataset.data.in_grid, ax=axes[0], title=_pf("Visibilities"), xlabel="", ylabel="") plot_grid( Grid2DIrregular.from_yx_1d( y=dataset.uv_wavelengths[:, 1] / 10**3.0, x=dataset.uv_wavelengths[:, 0] / 10**3.0, ), ax=axes[1], - title="UV-Wavelengths", + title=_pf("UV-Wavelengths"), xlabel="", ylabel="", ) @@ -56,7 +59,7 @@ def subplot_interferometer_dataset( dataset.amplitudes, dataset.uv_distances / 10**3.0, ax=axes[2], - title="Amplitudes vs UV-distances", + title=_pf("Amplitudes vs UV-distances"), xtick_suffix='"', ytick_suffix="Jy", plot_axis_type="scatter", @@ -65,7 +68,7 @@ def subplot_interferometer_dataset( dataset.phases, dataset.uv_distances / 10**3.0, ax=axes[3], - title="Phases vs UV-distances", + title=_pf("Phases vs UV-distances"), xtick_suffix='"', ytick_suffix="deg", plot_axis_type="scatter", @@ -73,14 +76,14 @@ def subplot_interferometer_dataset( plot_array( dataset.dirty_image, ax=axes[4], - title="Dirty Image", + title=_pf("Dirty Image"), colormap=colormap, use_log10=use_log10, ) plot_array( dataset.dirty_signal_to_noise_map, ax=axes[5], - title="Dirty Signal-To-Noise Map", + title=_pf("Dirty Signal-To-Noise Map"), colormap=colormap, use_log10=use_log10, )