Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions autoarray/dataset/plot/imaging_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -88,15 +91,15 @@ 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="",
)
plot_array(
dataset.psf.kernel,
ax=axes[4],
title="PSF (log10)",
title=_pf("PSF (log10)"),
colormap=colormap,
use_log10=True,
cb_unit="",
Expand All @@ -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="",
Expand Down Expand Up @@ -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.
Expand All @@ -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)

Expand Down
15 changes: 9 additions & 6 deletions autoarray/dataset/plot/interferometer_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -38,25 +39,27 @@ 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="",
)
plot_yx(
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",
Expand All @@ -65,22 +68,22 @@ 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",
)
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,
)
Expand Down
25 changes: 14 additions & 11 deletions autoarray/inversion/plot/inversion_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()

Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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),
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
)
Expand All @@ -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,
)
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion autoarray/plot/inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading