API documentation

UVTable object

class uvtable.UVTable(u_coord, v_coord, vis, weight, freq, phase_center=None, source_velocity=0.0)[source]

A class to store complex visibilities.

u_coord

Coordinate of the baseline vector along the u axis, in meters

Type

ndarray

v_coord

Coordinate of the baseline vector along the v axis, in meters

Type

ndarray

re_vis

Real part of the complex visibility, in Janskys.

Type

ndarray

im_vis

Imaginary part of the complex visibility, in Janskys.

Type

ndarray

weight

Weight of the complex visibility.

Type

ndarray

n_visibilities

Number of visibilities.

Type

int

n_channels

Number of channels.

Type

int

freq

Frequencies of each channel, in Hz.

Type

ndarray

phase_center

Phase center.

Type

astropy.coordinates.SkyCoord

source_velocity

Source velocity, in km/s.

Type

flaot

__init__(u_coord, v_coord, vis, weight, freq, phase_center=None, source_velocity=0.0)[source]

Create a UVTable instance from arrays.

Parameters
  • u_coord (array_like) – Coordinates of the baseline vector along the u axis, in meters. A 1-D array-like object must be provided.

  • v_coord (array_like) – Coordinates of the baseline vector along the v axis, in meters. A 1-D array-like object with the same dimension as u_coord must be provided.

  • vis (array_like) – Complex visibilities, in Janskys. A 1-D or 2-D array-like object must be provided. If 1-D, the size of array must the be the same as u_coord. If 2-D, the shape of the array must be (n_visibilities, n_channels), where n_visibilities is the size of u_coord, and n_channels is the number of channels.

  • weight (array_like) – Weight of the complex visibilities. An array-like object with the same dimensions as vis must be provided.

  • freq (array_like) – Rest frequencies of each channel of the visibility table in Hertz. An array-like object with n_channels elements must be provided.

  • phase_center (astropy.coordinates.SkyCoord) – Sky coordinates of the phase center.

  • source_velocity (float) – The source velocity in km/s.

remove_flagged()[source]

Remove flagged visibilities, in place.

uv_radius()[source]

Return the UV radius.

Returns

radius – UV radius, in meters

Return type

ndarray

amp_phase()[source]

Return the visibility amplitude and phase.

Returns

  • amplitude (ndarray) – Visibility amplitude, in Janskys

  • phase (ndarray) – Visibility phase, in radians

phase_shift(x_0, y_0)[source]

Shift the phase of a table, in place.

Parameters
  • x_0 (float) – Shift in RA, in arcsecs

  • y_0 (float) – Shift in Dec, in arcsecs

deproject(pa, incl)[source]

Deproject the UV coordinates, in place.

Parameters
  • pa (float) – position angle (degrees)

  • incl (float) – inclination (degrees)

extract(chan, ignore_flagged=False)[source]

Extract a channel from a UVTable.

Parameters
  • chan (int) – Index of the channel to extract

  • ignore_flagged (bool, optional) – Ignore flagged visibilities (the default is False)

Returns

UVTable containing only a single channel

Return type

UVTable

Raises

ValueError – If the index of the channel is invalid.

uv_cont(scale_uv=False)[source]

Return a pseudo-continuum table.

Parameters

scale_uv (bool, optional) – Scale the baselines with the

Returns

UVTable containing only a single channel

Return type

UVTable

radial_average(duvr)[source]

Average the visibilities as a function of the uv radius.

Parameters

duvr (float) – Radius bin in meters

Returns

UVTable containing the averaged visibilities

Return type

UVTable

Functions

uvtable.read(filename, remove_flagged=False)[source]

Read a table in UVFITS format.

Parameters
  • filename (str) – Name of the UVFITS file.

  • remove_flagged (bool, optional) – If True, remove flagged data.

Returns

uvt – The UV table

Return type

UVTable

Notes

This function has been tested with UVFITS produced by Gildas. It is not guaranteed to work with UVFITS from other software.

uvtable.gaussian_fit(uvt)[source]

Fit the visibilities with a Gaussian source.

Parameters

uvt (UVTable) – UV table to fit

Returns

Best fit parameters

Return type

dict

Raises

RuntimeError – If the fit did not converge.

uvtable.model.point_source(u_coord, v_coord, x_0, y_0, flux)[source]

Return the complex visibilities for a point source.

Parameters
  • u_coord (ndarray) – Coordinate of the baseline vector along the u axis, in arcsec^-1

  • v_coord (ndarray) – Coordinate of the baseline vector along the v axis, in arcsec^-1

  • x_0 (float) – Coordinate offset in RA with respect to the phase center, in arcsec

  • y_0 (float) – Coordinate offset in Dec with respect to the phase center, in arcsec

  • flux (float) – Source flux, in Janskys

Notes

The complex visibilities of a point source are given by:

\[V(u, v) = F \, e^{-2 i \pi \left( u \, x_0 + v \, y_0 \right)}\]

where \(F\) is the source flux, and \(x_0\) and \(y_0\) are source coordinates with respect to the phase center.

uvtable.model.gaussian_source(u_coord, v_coord, x_0, y_0, flux, fwhm)[source]

Return the complex visibilities for a circular Gaussian source.

Parameters
  • u_coord (ndarray) – Coordinate of the baseline vector along the u axis, in arcsec^-1

  • v_coord (ndarray) – Coordinate of the baseline vector along the v axis, in arcsec^-1

  • x_0 (float) – Coordinate offset in RA with respect to the phase center, in arcsec

  • y_0 (float) – Coordinate offset in Dec with respect to the phase center, in arcsec

  • flux (float) – Source flux, in Janskys

  • fwhm (float) – Full width at half maximum size of the emission, in arcsec

Notes

The complex visibilities of a circular Gaussian source are given by:

\[V(u, v) = F \, e^{-2 i \pi \left( u \, x_0 + v \, y_0 \right)} \, e^{ \frac{-\pi^2}{4 \, ln 2} ( b \, q )^2 }\]

where \(F\) is the source flux, \(x_0\) and \(y_0\) are the coordinates of the source centroid with respect to the phase center, \(b\) is the full width at half maximum size of the emission, and \(q\) is the \(uv\) radius, given by:

\[q = \sqrt{u^2 + v^2}\]
uvtable.model.elliptical_gaussian_source(u_coord, v_coord, x_0, y_0, flux, fwhm_major, fwhm_minor, pa)[source]

Return the complex visibilities for an elliptical Gaussian source.

Parameters
  • u_coord (ndarray) – Coordinate of the baseline vector along the u axis, in arcsec^-1

  • v_coord (ndarray) – Coordinate of the baseline vector along the v axis, in arcsec^-1

  • x_0 (float) – Coordinate offset in RA with respect to the phase center, in arcsec

  • y_0 (float) – Coordinate offset in Dec with respect to the phase center, in arcsec

  • flux (float) – Source flux, in Janskys

  • fwhm_major (float) – Full width at half maximum size of the emission along the major axis, in arcsec

  • fwhm_minor (float) – Full width at half maximum size of the emission along the minor axis, in arcsec

  • pa (float) – Position angle of the major axis of the emission, from North to East, in degrees

Notes

The complex visibilities of an elliptical Gaussian source are given by:

\[V(u, v) = F \, e^{-2 i \pi \left( u \, x_0 + v \, y_0 \right)} e^{ \frac{-\pi^2}{4 \, ln \, 2} \left( \left( b_1 \, u_1 \right)^2 + \left( b_2 \, u_2 \right)^2 \right) }\]

where \(F\) is the source flux, \(x_0\) and \(y_0\) are the coordinates of the source centroid with respect to the phase center, \(b_1\) and \(b_2\) are the full width at half maximum sizes of the emission along the major and minor axes, respectively, and \(u_1\) and \(u_2\) are given by:

\[\begin{split}u_1 = u \, \mathrm{sin} \, \theta + v \, \mathrm{cos} \, \theta \\ u_2 = u \, \mathrm{cos} \, \theta - v \, \mathrm{cos} \, \theta\end{split}\]

where \(\theta\) is the position angle of the major axis of the emission.

uvtable.model.powerlaw_source(u_coord, v_coord, x_0, y_0, I_0, beta)[source]

Return the complex visibilities for a power-law source.

Parameters
  • u_coord (ndarray) – Coordinate of the baseline vector along the u axis, in arcsec^-1

  • v_coord (ndarray) – Coordinate of the baseline vector along the v axis, in arcsec^-1

  • x_0 (float) – Coordinate offset in RA with respect to the phase center, in arcsec

  • y_0 (float) – Coordinate offset in Dec with respect to the phase center, in arcsec

  • beta (float) – Index of the power-law

  • I_0 (float) – Scaling factor

Raises

ValueError – If beta isn’t comprised between -2 and .5.

Notes

For a power-law intensity source:

\[I(x, y) = I_0 \, r^{\beta}\]

where \(I_0\) is a scaling factor, \(\beta\) is the power-law index, and:

\[r = \sqrt{(x - x_0)^2 - (y - y_0)^2}\]

the visibilities are given by:

\[V(u, v) = 2 \pi \, I_0 \, \frac{2^{\beta + 1} \, \Gamma \left( \frac{\beta}{2}+1 \right)} {\Gamma \left( - \frac{\beta}{2} \right)} \, e^{-2 i \pi \left( u \, x_0 + v \, y_0 \right)} \, (2\pi \, q)^{-\beta - 2}\]

where \(q\) is the \(uv\) radius, given by:

\[q = \sqrt{u^2 + v^2}\]

This expression is valid for \(-2 < \beta < -\frac{1}{2}\).