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
13 changes: 8 additions & 5 deletions autoarray/config/visualize/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@ colorbar:
pad: 0.01 # Padding between colorbar and axes.
labelrotation: 90 # Rotation of colorbar tick labels in degrees.
labelsize: 22 # Font size of colorbar tick labels for single-panel figures.
labelsize_subplot: 22 # Font size of colorbar tick labels for subplot panels.
labelsize_subplot: 33 # Font size of colorbar tick labels for subplot panels.
mat_plot:
figure:
figsize: (7, 7) # Default figure size. Override via aplt.Figure(figsize=(...)).
subplot_shape_to_figsize_factor: (6, 6) # Per-panel size factor for subplots. figsize = (cols*fx, rows*fy).
title:
fontsize: 24 # Default title font size for single-panel figures.
title_subplot:
fontsize: 20 # Default title font size for subplot panels.
yticks:
fontsize: 22 # Default y-tick font size. Override via aplt.YTicks(fontsize=...).
yticks_subplot:
fontsize: 18 # Default y-tick font size for subplot panels.
fontsize: 22 # Default y-tick font size for subplot panels.
xticks:
fontsize: 22 # Default x-tick font size. Override via aplt.XTicks(fontsize=...).
xticks_subplot:
fontsize: 18 # Default x-tick font size for subplot panels.
title:
fontsize: 24 # Default title font size. Override via aplt.Title(fontsize=...).
fontsize: 22 # Default x-tick font size for subplot panels.
ylabel:
fontsize: 16 # Default y-label font size. Override via aplt.YLabel(fontsize=...).
xlabel:
Expand Down
10 changes: 5 additions & 5 deletions autoarray/dataset/plot/imaging_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import matplotlib.pyplot as plt

from autoarray.plot.utils import subplot_save
from autoarray.plot.utils import subplot_save, conf_subplot_figsize


def subplot_imaging_dataset(
dataset,
output_path: Optional[str] = None,
output_filename: str = "subplot_dataset",
output_filename: str = "dataset",
output_format: str = "png",
colormap=None,
use_log10: bool = False,
Expand Down Expand Up @@ -51,7 +51,7 @@ def subplot_imaging_dataset(

from autoarray.plot.array import plot_array

fig, axes = plt.subplots(3, 3, figsize=(21, 21))
fig, axes = plt.subplots(3, 3, figsize=conf_subplot_figsize(3, 3))
axes = axes.flatten()

plot_array(
Expand Down Expand Up @@ -147,7 +147,7 @@ def subplot_imaging_dataset(
def subplot_imaging_dataset_list(
dataset_list,
output_path=None,
output_filename: str = "subplot_dataset_combined",
output_filename: str = "dataset_combined",
output_format="png",
):
"""
Expand All @@ -172,7 +172,7 @@ def subplot_imaging_dataset_list(
from autoarray.plot.array import plot_array

n = len(dataset_list)
fig, axes = plt.subplots(n, 3, figsize=(21, 7 * n))
fig, axes = plt.subplots(n, 3, figsize=conf_subplot_figsize(n, 3))
if n == 1:
axes = [axes]
for i, dataset in enumerate(dataset_list):
Expand Down
10 changes: 5 additions & 5 deletions autoarray/dataset/plot/interferometer_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from autoarray.plot.array import plot_array
from autoarray.plot.grid import plot_grid
from autoarray.plot.yx import plot_yx
from autoarray.plot.utils import subplot_save, hide_unused_axes
from autoarray.plot.utils import subplot_save, hide_unused_axes, conf_subplot_figsize
from autoarray.structures.grids.irregular_2d import Grid2DIrregular


def subplot_interferometer_dataset(
dataset,
output_path: Optional[str] = None,
output_filename: str = "subplot_dataset",
output_filename: str = "dataset",
output_format: str = "png",
colormap=None,
use_log10: bool = False,
Expand All @@ -39,7 +39,7 @@ def subplot_interferometer_dataset(
use_log10
Apply log10 normalisation to image panels.
"""
fig, axes = plt.subplots(2, 3, figsize=(21, 14))
fig, axes = plt.subplots(2, 3, figsize=conf_subplot_figsize(2, 3))
axes = axes.flatten()

plot_grid(dataset.data.in_grid, ax=axes[0], title="Visibilities")
Expand Down Expand Up @@ -92,7 +92,7 @@ def subplot_interferometer_dataset(
def subplot_interferometer_dirty_images(
dataset,
output_path: Optional[str] = None,
output_filename: str = "subplot_dirty_images",
output_filename: str = "dirty_images",
output_format: str = "png",
colormap=None,
use_log10: bool = False,
Expand All @@ -115,7 +115,7 @@ def subplot_interferometer_dirty_images(
use_log10
Apply log10 normalisation.
"""
fig, axes = plt.subplots(1, 3, figsize=(21, 7))
fig, axes = plt.subplots(1, 3, figsize=conf_subplot_figsize(1, 3))

plot_array(
dataset.dirty_image,
Expand Down
8 changes: 5 additions & 3 deletions autoarray/fit/plot/fit_imaging_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import matplotlib.pyplot as plt

from autoarray.plot.array import plot_array
from autoarray.plot.utils import subplot_save, symmetric_vmin_vmax, hide_unused_axes
from autoarray.plot.utils import subplot_save, symmetric_vmin_vmax, hide_unused_axes, conf_subplot_figsize


def subplot_fit_imaging(
fit,
output_path: Optional[str] = None,
output_filename: str = "subplot_fit",
output_filename: str = "fit",
output_format: str = "png",
colormap=None,
use_log10: bool = False,
Expand Down Expand Up @@ -43,7 +43,7 @@ def subplot_fit_imaging(
grid, positions, lines
Optional overlays forwarded to every panel.
"""
fig, axes = plt.subplots(2, 3, figsize=(21, 14))
fig, axes = plt.subplots(2, 3, figsize=conf_subplot_figsize(2, 3))
axes = axes.flatten()

plot_array(
Expand Down Expand Up @@ -103,6 +103,7 @@ def subplot_fit_imaging(
use_log10=False,
vmin=vmin_n,
vmax=vmax_n,
cb_unit=r"$\sigma$",
grid=grid,
positions=positions,
lines=lines,
Expand All @@ -113,6 +114,7 @@ def subplot_fit_imaging(
title="Chi-Squared Map",
colormap=colormap,
use_log10=use_log10,
cb_unit=r"$\chi^2$",
grid=grid,
positions=positions,
lines=lines,
Expand Down
12 changes: 7 additions & 5 deletions autoarray/fit/plot/fit_interferometer_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

from autoarray.plot.array import plot_array
from autoarray.plot.yx import plot_yx
from autoarray.plot.utils import subplot_save, symmetric_vmin_vmax, hide_unused_axes
from autoarray.plot.utils import subplot_save, symmetric_vmin_vmax, hide_unused_axes, conf_subplot_figsize


def subplot_fit_interferometer(
fit,
output_path: Optional[str] = None,
output_filename: str = "subplot_fit",
output_filename: str = "fit",
output_format: str = "png",
colormap=None,
use_log10: bool = False,
Expand Down Expand Up @@ -40,7 +40,7 @@ def subplot_fit_interferometer(
Not used here (UV-plane residuals are scatter plots); kept for API
consistency.
"""
fig, axes = plt.subplots(2, 3, figsize=(21, 14))
fig, axes = plt.subplots(2, 3, figsize=conf_subplot_figsize(2, 3))
axes = axes.flatten()

uv = fit.dataset.uv_distances / 10**3.0
Expand Down Expand Up @@ -106,7 +106,7 @@ def subplot_fit_interferometer(
def subplot_fit_interferometer_dirty_images(
fit,
output_path: Optional[str] = None,
output_filename: str = "subplot_fit_dirty_images",
output_filename: str = "fit_dirty_images",
output_format: str = "png",
colormap=None,
use_log10: bool = False,
Expand Down Expand Up @@ -135,7 +135,7 @@ def subplot_fit_interferometer_dirty_images(
residuals_symmetric_cmap
Centre residual colour scale symmetrically around zero.
"""
fig, axes = plt.subplots(2, 3, figsize=(21, 14))
fig, axes = plt.subplots(2, 3, figsize=conf_subplot_figsize(2, 3))
axes = axes.flatten()

plot_array(
Expand Down Expand Up @@ -183,13 +183,15 @@ def subplot_fit_interferometer_dirty_images(
use_log10=False,
vmin=vmin_n,
vmax=vmax_n,
cb_unit=r"$\sigma$",
)
plot_array(
fit.dirty_chi_squared_map,
ax=axes[5],
title="Dirty Chi-Squared Map",
colormap=colormap,
use_log10=use_log10,
cb_unit=r"$\chi^2$",
)

hide_unused_axes(axes)
Expand Down
10 changes: 5 additions & 5 deletions autoarray/inversion/plot/inversion_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from autoarray.inversion.mappers.abstract import Mapper
from autoarray.plot.array import plot_array
from autoarray.plot.utils import numpy_grid, numpy_lines, numpy_positions, subplot_save, hide_unused_axes
from autoarray.plot.utils import numpy_grid, numpy_lines, numpy_positions, subplot_save, hide_unused_axes, conf_subplot_figsize
from autoarray.inversion.plot.mapper_plots import plot_mapper
from autoarray.structures.arrays.uniform_2d import Array2D

Expand All @@ -20,7 +20,7 @@ def subplot_of_mapper(
inversion,
mapper_index: int = 0,
output_path: Optional[str] = None,
output_filename: str = "subplot_inversion",
output_filename: str = "inversion",
output_format: str = "png",
colormap=None,
use_log10: bool = False,
Expand Down Expand Up @@ -53,7 +53,7 @@ def subplot_of_mapper(
"""
mapper = inversion.cls_list_from(cls=Mapper)[mapper_index]

fig, axes = plt.subplots(3, 4, figsize=(28, 21))
fig, axes = plt.subplots(3, 4, figsize=conf_subplot_figsize(3, 4))
axes = axes.flatten()

# panel 0: data subtracted
Expand Down Expand Up @@ -226,7 +226,7 @@ def subplot_mappings(
inversion,
pixelization_index: int = 0,
output_path: Optional[str] = None,
output_filename: str = "subplot_mappings",
output_filename: str = "mappings",
output_format: str = "png",
colormap=None,
use_log10: bool = False,
Expand Down Expand Up @@ -273,7 +273,7 @@ def subplot_mappings(
)
mapper.slim_indexes_for_pix_indexes(pix_indexes=pix_indexes)

fig, axes = plt.subplots(2, 2, figsize=(14, 14))
fig, axes = plt.subplots(2, 2, figsize=conf_subplot_figsize(2, 2))
axes = axes.flatten()

# panel 0: data subtracted
Expand Down
6 changes: 3 additions & 3 deletions autoarray/inversion/plot/mapper_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from autoarray.plot.array import plot_array
from autoarray.plot.inversion import plot_inversion_reconstruction
from autoarray.plot.utils import numpy_grid, numpy_lines, subplot_save
from autoarray.plot.utils import numpy_grid, numpy_lines, subplot_save, conf_subplot_figsize

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -77,7 +77,7 @@ def subplot_image_and_mapper(
mapper,
image,
output_path: Optional[str] = None,
output_filename: str = "subplot_image_and_mapper",
output_filename: str = "image_and_mapper",
output_format: str = "png",
colormap=None,
use_log10: bool = False,
Expand Down Expand Up @@ -108,7 +108,7 @@ def subplot_image_and_mapper(
lines
Lines to overlay on both panels.
"""
fig, axes = plt.subplots(1, 2, figsize=(14, 7))
fig, axes = plt.subplots(1, 2, figsize=conf_subplot_figsize(1, 2))

plot_array(
image,
Expand Down
1 change: 1 addition & 0 deletions autoarray/plot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def _set_backend():
apply_extent,
apply_labels,
conf_figsize,
conf_subplot_figsize,
conf_mat_plot_fontsize,
save_figure,
subplot_save,
Expand Down
4 changes: 1 addition & 3 deletions autoarray/plot/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def plot_array(
output_path: Optional[str] = None,
output_filename: str = "array",
output_format: str = "png",
structure=None,
) -> None:
"""
Plot a 2D array (image) using ``plt.imshow``.
Expand Down Expand Up @@ -120,9 +119,8 @@ def plot_array(
"""
# --- autoarray extraction --------------------------------------------------
array = zoom_array(array)
structure = array
try:
if structure is None:
structure = array
if extent is None:
extent = array.geometry.extent
if mask is None:
Expand Down
Loading
Loading