Skip to content

Commit e007e8c

Browse files
Jammy2211Jammy2211
authored andcommitted
fixes to plotting
1 parent a68ef3e commit e007e8c

File tree

4 files changed

+16
-50
lines changed

4 files changed

+16
-50
lines changed

autoarray/dataset/plot/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from autoarray.dataset.plot.imaging_plots import (
22
subplot_imaging_dataset,
3-
subplot_imaging,
43
subplot_imaging_dataset_list,
54
)
65
from autoarray.dataset.plot.interferometer_plots import (

autoarray/dataset/plot/imaging_plots.py

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ def subplot_imaging_dataset(
4646
grid, positions, lines
4747
Optional overlays forwarded to every panel.
4848
"""
49+
if isinstance(output_format, (list, tuple)):
50+
output_format = output_format[0]
51+
4952
from autoarray.plot.array import plot_array
5053

5154
fig, axes = plt.subplots(3, 3, figsize=(21, 21))
@@ -133,51 +136,6 @@ def subplot_imaging_dataset(
133136
subplot_save(fig, output_path, output_filename, output_format)
134137

135138

136-
def subplot_imaging(
137-
dataset,
138-
output_path=None,
139-
output_filename: str = "subplot_dataset",
140-
output_format="png",
141-
):
142-
"""
143-
1×n subplot of core ``Imaging`` dataset components.
144-
145-
Panels: Data | Noise Map | Signal-To-Noise Map | PSF (if present)
146-
147-
Parameters
148-
----------
149-
dataset
150-
An ``Imaging`` dataset instance.
151-
output_path
152-
Directory to save the figure. ``None`` calls ``plt.show()``.
153-
output_filename
154-
Base filename without extension.
155-
output_format
156-
File format string or list, e.g. ``"png"`` or ``["png"]``.
157-
"""
158-
if isinstance(output_format, (list, tuple)):
159-
output_format = output_format[0]
160-
161-
panels = [
162-
(dataset.data, "Data"),
163-
(dataset.noise_map, "Noise Map"),
164-
(dataset.signal_to_noise_map, "Signal-To-Noise Map"),
165-
]
166-
try:
167-
panels.append((dataset.psf.kernel, "PSF"))
168-
except Exception:
169-
pass
170-
171-
from autoarray.plot.array import plot_array
172-
173-
n = len(panels)
174-
fig, axes = plt.subplots(1, n, figsize=(7 * n, 7))
175-
axes_flat = list(axes.flatten()) if n > 1 else [axes]
176-
for i, (array, title) in enumerate(panels):
177-
plot_array(array, ax=axes_flat[i], title=title)
178-
plt.tight_layout()
179-
subplot_save(fig, output_path, output_filename, output_format)
180-
181139

182140
def subplot_imaging_dataset_list(
183141
dataset_list,

autoarray/plot/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def plot_array(
4545
contours: Optional[int] = None,
4646
# --- cosmetics --------------------------------------------------------------
4747
title: str = "",
48-
xlabel: str = 'x (")',
49-
ylabel: str = 'y (")',
48+
xlabel: str = "",
49+
ylabel: str = "",
5050
colormap: str = "jet",
5151
vmin: Optional[float] = None,
5252
vmax: Optional[float] = None,

autoarray/plot/utils.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,11 @@ def plot_visibilities_1d(vis, ax: plt.Axes, title: str = "") -> None:
494494
ax.legend(fontsize=8)
495495

496496

497+
def _arcsec_labels(ticks) -> List[str]:
498+
"""Format tick values as arcsecond strings, e.g. ``-1``, ``0``, ``1"``."""
499+
return [f'{v:g}"' for v in ticks]
500+
501+
497502
def apply_extent(
498503
ax: plt.Axes,
499504
extent: Tuple[float, float, float, float],
@@ -515,5 +520,9 @@ def apply_extent(
515520
xmin, xmax, ymin, ymax = extent
516521
ax.set_xlim(xmin, xmax)
517522
ax.set_ylim(ymin, ymax)
518-
ax.set_xticks(np.linspace(xmin, xmax, n_ticks))
519-
ax.set_yticks(np.linspace(ymin, ymax, n_ticks))
523+
xticks = np.linspace(xmin, xmax, n_ticks)
524+
yticks = np.linspace(ymin, ymax, n_ticks)
525+
ax.set_xticks(xticks)
526+
ax.set_yticks(yticks)
527+
ax.set_xticklabels(_arcsec_labels(xticks))
528+
ax.set_yticklabels(_arcsec_labels(yticks))

0 commit comments

Comments
 (0)