Utility Functions

Utility methods.

utils.stokes_to_coherency(stokes_arr)[source]

Convert Stokes array to coherency matrix.

Parameters

stokes_arr (Quantity) – Array of stokes parameters in order [I, Q, U, V], shape(4,) or (4, Nfreqs, Ncomponents).

Returns

coherency matrix (array of float) – Array of coherencies, shape (2, 2) or (2, 2, Nfreqs, Ncomponents)

utils.coherency_to_stokes(coherency_matrix)[source]

Convert coherency matrix to vector of 4 Stokes parameter in order [I, Q, U, V].

Parameters

coherency matrix (Quantity) – Array of coherencies, shape (2, 2) or (2, 2, Ncomponents)

Returns

stokes_arr (array of float) – Array of stokes parameters, shape(4,) or (4, Ncomponents)

utils.jy_to_ksr(freqs)[source]

Calculate multiplicative factors to convert [Jy] to [K sr].

Parameters

freqs (astropy.Quantity or array_like of float (Deprecated)) – Frequencies, assumed to be in Hz if not a Quantity.

Returns

Quantity – Conversion factor(s) to go from [Jy] to [K sr]. Shape equal to shape of freqs.

utils.download_gleam(path='.', filename='gleam.vot', overwrite=False, row_limit=None, for_testing=False)[source]

Download the GLEAM vot table from Vizier.

Parameters
  • path (str) – Folder location to save catalog to.

  • filename (str) – Filename to save catalog to.

  • overwrite (bool) – Option to download the file even if it already exists.

  • row_limit (int, optional) – Max number of rows (sources) to download, default is None meaning download all rows.

  • for_testing (bool) – Download a file to use for unit tests. If True, some additional columns are included, the rows are limited to 50, the path and filename are set to put the file in the correct location and the overwrite keyword is set to True.