Skip to content

Commit 1519fb6

Browse files
committed
Add plot_visibilities_1d to autoarray plot utils
Moves the helper from autogalaxy into autoarray/plot/utils.py and re-exports it from autoarray/plot/__init__.py so it is accessible as aa.plot.plot_visibilities_1d. https://claude.ai/code/session_01B9sVEV54XWCa2LJw1C8gvv
1 parent 443fb54 commit 1519fb6

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

autoarray/plot/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def _set_backend():
3737
symmetric_vmin_vmax,
3838
symmetric_cmap_from,
3939
set_with_color_values,
40+
plot_visibilities_1d,
4041
)
4142

4243
from autoarray.structures.plot.structure_plots import (

autoarray/plot/utils.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,33 @@ def save_figure(
384384
plt.close(fig)
385385

386386

387+
def plot_visibilities_1d(vis, ax: plt.Axes, title: str = "") -> None:
388+
"""Plot the real and imaginary components of a visibilities array as 1D line plots.
389+
390+
Draws two overlapping lines — one for the real part and one for the
391+
imaginary part — with a legend. Used by interferometer subplot functions
392+
to visualise raw or residual visibilities.
393+
394+
Parameters
395+
----------
396+
vis
397+
A ``Visibilities`` autoarray object (accessed via ``.slim``) or any
398+
array-like that can be cast to a complex numpy array.
399+
ax
400+
Matplotlib ``Axes`` to draw onto.
401+
title
402+
Axes title string.
403+
"""
404+
try:
405+
y = np.array(vis.slim if hasattr(vis, "slim") else vis)
406+
except Exception:
407+
y = np.asarray(vis)
408+
ax.plot(y.real, label="Real", alpha=0.7)
409+
ax.plot(y.imag, label="Imaginary", alpha=0.7)
410+
ax.set_title(title)
411+
ax.legend(fontsize=8)
412+
413+
387414
def apply_extent(
388415
ax: plt.Axes,
389416
extent: Tuple[float, float, float, float],

0 commit comments

Comments
 (0)