Skip to content

Commit f27226c

Browse files
Jammy2211claude
authored andcommitted
feat: add title_prefix support to subplot_imaging_dataset / _list
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) <noreply@anthropic.com>
1 parent e1ec21e commit f27226c

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

autoarray/dataset/plot/imaging_plots.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def subplot_imaging_dataset(
1414
grid=None,
1515
positions=None,
1616
lines=None,
17+
title_prefix: str = None,
1718
):
1819
"""
1920
3×3 subplot of core ``Imaging`` dataset components.
@@ -50,13 +51,15 @@ def subplot_imaging_dataset(
5051

5152
from autoarray.plot.array import plot_array
5253

54+
_pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t)
55+
5356
fig, axes = subplots(3, 3, figsize=conf_subplot_figsize(3, 3))
5457
axes = axes.flatten()
5558

5659
plot_array(
5760
dataset.data,
5861
ax=axes[0],
59-
title="Data",
62+
title=_pf("Data"),
6063
colormap=colormap,
6164
use_log10=use_log10,
6265
grid=grid,
@@ -66,7 +69,7 @@ def subplot_imaging_dataset(
6669
plot_array(
6770
dataset.data,
6871
ax=axes[1],
69-
title="Data (log10)",
72+
title=_pf("Data (log10)"),
7073
colormap=colormap,
7174
use_log10=True,
7275
grid=grid,
@@ -76,7 +79,7 @@ def subplot_imaging_dataset(
7679
plot_array(
7780
dataset.noise_map,
7881
ax=axes[2],
79-
title="Noise-Map",
82+
title=_pf("Noise-Map"),
8083
colormap=colormap,
8184
use_log10=use_log10,
8285
grid=grid,
@@ -88,15 +91,15 @@ def subplot_imaging_dataset(
8891
plot_array(
8992
dataset.psf.kernel,
9093
ax=axes[3],
91-
title="Point Spread Function",
94+
title=_pf("Point Spread Function"),
9295
colormap=colormap,
9396
use_log10=use_log10,
9497
cb_unit="",
9598
)
9699
plot_array(
97100
dataset.psf.kernel,
98101
ax=axes[4],
99-
title="PSF (log10)",
102+
title=_pf("PSF (log10)"),
100103
colormap=colormap,
101104
use_log10=True,
102105
cb_unit="",
@@ -105,7 +108,7 @@ def subplot_imaging_dataset(
105108
plot_array(
106109
dataset.signal_to_noise_map,
107110
ax=axes[5],
108-
title="Signal-To-Noise Map",
111+
title=_pf("Signal-To-Noise Map"),
109112
colormap=colormap,
110113
use_log10=use_log10,
111114
cb_unit="",
@@ -148,6 +151,7 @@ def subplot_imaging_dataset_list(
148151
output_path=None,
149152
output_filename: str = "dataset_combined",
150153
output_format=None,
154+
title_prefix: str = None,
151155
):
152156
"""
153157
n×3 subplot showing core components for each dataset in a list.
@@ -164,20 +168,24 @@ def subplot_imaging_dataset_list(
164168
Base filename without extension.
165169
output_format
166170
File format string or list, e.g. ``"png"`` or ``["png"]``.
171+
title_prefix
172+
Optional string prepended (with an automatic space) to every panel title.
167173
"""
168174
if isinstance(output_format, (list, tuple)):
169175
output_format = output_format[0]
170176

171177
from autoarray.plot.array import plot_array
172178

179+
_pf = (lambda t: f"{title_prefix.rstrip()} {t}") if title_prefix else (lambda t: t)
180+
173181
n = len(dataset_list)
174182
fig, axes = subplots(n, 3, figsize=conf_subplot_figsize(n, 3))
175183
if n == 1:
176184
axes = [axes]
177185
for i, dataset in enumerate(dataset_list):
178-
plot_array(dataset.data, ax=axes[i][0], title="Data")
179-
plot_array(dataset.noise_map, ax=axes[i][1], title="Noise Map")
180-
plot_array(dataset.signal_to_noise_map, ax=axes[i][2], title="Signal-To-Noise Map")
186+
plot_array(dataset.data, ax=axes[i][0], title=_pf("Data"))
187+
plot_array(dataset.noise_map, ax=axes[i][1], title=_pf("Noise Map"))
188+
plot_array(dataset.signal_to_noise_map, ax=axes[i][2], title=_pf("Signal-To-Noise Map"))
181189
tight_layout()
182190
subplot_save(fig, output_path, output_filename, output_format)
183191

0 commit comments

Comments
 (0)