3. The UVTable class

class uvplot.UVTable(uvtable=None, filename=None, format='ascii', columns=None, wle=1.0, **kwargs)

Bases: object

Create a UVTable object by importing the visibilities from ASCII file or from a uvtable. Provide either a uvtable or a filename, but not both of them.

Parameters
  • uvtable (array-like, float) – A list of 1d arrays (or a 2d array) with columns specified as in the columns parameter.

  • filename (str) – Name of the ASCII file containing the uv table.

  • format (str) – If a filename is provided, the format of the uvtable: ‘ascii’ or ‘binary’ for .npz files.

  • columns (list) – Columns mapping. Choose one among COLUMNS_V0, COLUMNS_V1, and COLUMNS_V2 (see Notes).

  • wle (float, optional) – Observing wavelength. Default is 1, i.e. the (u,v) coordinates are assumed to be expressed in units of wavelength. units: same as the u, v coordinates in the uv table.

Notes

Inside the UVTable object the (u, v) coordinates are stored in units of wle.

Columns formats:

COLUMNS_V0 = [‘u’, ‘v’, ‘Re’, ‘Im’, ‘weights’]

COLUMNS_V1 = [‘u’, ‘v’, ‘Re’, ‘Im’, ‘weights’, ‘freqs’, ‘spws’]

COLUMNS_V2 = [‘u’, ‘v’, ‘V’, ‘weights’, ‘freqs’, ‘spws’]

property u

u coordinate units: observing wavelength

property v

v coordinate units: observing wavelength

property u_m

u coordinate units: m

property v_m

v coordinate units: m

property re

Real part of the Visibilities units: Jy

property im

Imaginary part of the Visibilities units: Jy

property weights

Weights of the Visibilities units: 1/Jy^2

property freqs

Frequency of the Visibilities units: Hz

property freqs_avg

Average frequency of the Visibilities units: Hz

property freqs_wrt_avg

Frequency of the Visibilities normalised to the average frequency. units: pure no.

property spws

Spectral window ID of the visibilities

property V

Complex Visibilities units: Jy

property uvdist

Uv-distance units: observing wavelength

import_uvtable(uvtable, columns)
read_ascii_uvtable(filename, columns=None, **kwargs)

Read an ASCII uvtable

read_binary_uvtable(filename, columns=None, **kwargs)

Read binary uvtable

save_ascii_uvtable(filename, **kwargs)

Save ascii uvtable

save_binary_uvtable(filename, **kwargs)

Save binary uvtable

save(filename, export_fmt, **kwargs)

Save uvtable

uvbin(uvbin_size, **kwargs)

Compute the intervals (bins) of the uv-distances given the size of the bin (bin_size_wle).

Parameters

bin_size_wle (float) – Bin size in units of the wavelength.

Note

To compute the weights, we do not need to divide by the weight_corr factor since it cancels out when we compute

bin_quantity(x, use_std=False)

Compute bins of the quantity x based on the intervals of the uv-distances of the current Uvtable. To compute the uv-distances use Uvtable.compute_uvdist() and to compute the intervals use Uvtable.compute_uv_intervals().

Parameters
  • x (array-like) – Quantity to be binned.

  • use_std (bool, optional) – If provided, the error on each bin is computed as the standard deviation divided by sqrt(npoints_per_bin).

Returns

bin_x, bin_x_err – Respectively the bins and the bins error of the quantity x.

Return type

array-like

apply_phase(dRA=0, dDec=0)

Apply a phase change in the uv space, corresponding to a translation by angular offsets (dRA, dDec) in the plane of the sky.

Parameters
  • dRA (float, optional) – Offset along the Right Ascension direction. dRA>0 translates image towards East. units: rad

  • dDec (float, optional) – Offset along the Declination direction. dDec>0 translates image towards North. units: rad

static rotate(x, y, theta)

Rotate (x,y) coordinates counter-clockwise by an angle theta.

Parameters
  • x (array-like, float) – X coordinates.

  • y (array-like, float) – Y coordinates.

  • theta (float) – Angle of rotation. units: rad

Returns

x_r, y_r – X and Y coordinates rotated by an angle theta.

Return type

array-like

deproject(inc, PA=0, inplace=True)

Deproject (u,v) coordinates. First, a rotation of a position angle PA is applied, and then a deprojection by inclination inc.

Parameters
  • inc (float) – Inclination. units: rad

  • PA (float, optional) – Position Angle (rad). units: rad

  • inplace (bool, optional) – By default, the (u,v) coordinates stored in the UVTable object are overwritten. If False, deproject returns a copy of the UVTable object with deprojected (u,v) coordinates.

Returns

Return type

If inplace is True, a copy of the UVTable object, with deprojected (u,v) coordinates.

uvcut(maxuv, verbose=False)

Apply uv cut to a table. Consider only baselines shorter than maxuv.

Parameters
  • maxuv (float) – Maximum baseline to be considered. units: observing wavelength.

  • verbose (bool, optional) – If true, print an informative message.

  • Returns

  • u (ndarrays) – Visibilities.

  • v (ndarrays) – Visibilities.

  • w (ndarrays) – Visibilities.

  • re (ndarrays) – Visibilities.

  • im (ndarrays) – Visibilities.

  • w – Visibilities.

plot(fig_filename=None, color='k', linestyle='.', label='', fontsize=18, linewidth=2.5, alpha=1.0, yerr=True, caption=None, axes=None, uvbin_size=0, vis_filename=None, verbose=True)

Produce a uv plot.

Parameters
  • fig_filename (str, optional) – File name of the output plot.

  • color (str, optional) – Line color.

  • linestyle (str, optional) – Line style.

  • label (str, optional) – Legend label.

  • fontsize (int, optional) – Font size to be used in the text of the plot.

  • linewidth (float, optional) – Line width of the errobar.

  • alpha (float, optional) – Transparency of the errorbar.

  • yerr (bool, optional) – If True, the y errors are shown. Default is True.

  • caption (dict, optional) – Caption for the whole plot. Must be a dictionary with following keys: ‘x’ and ‘y’ (the coordinates of the caption in units of the plotted quantities), ‘fontsize’ (the fontsize to be used), ‘text’ (the caption text).

  • axes (matplotlib.Axes, optional) – If provided, the plots are done in axes, otherwise a new figure is created.

  • uvbin_size (float, optional) – Size of the uv-distance bin. units: observing wavelength.

  • vis_filename (str, optional) – File name where to store the binned visibiltiies, e.g. “vis_binned.txt”.

  • verbose (bool, optional) – If True, print informative messages.

Returns

axes – The Real and Imaginary axes on which the uv plot is done.

Return type

matplotlib.Axes