Utility Functions

Utility methods.

pyradiosky.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)

pyradiosky.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)

pyradiosky.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.

pyradiosky.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.

pyradiosky.utils.flat_spectrum_skymodel(*, variance, nside, ref_chan=0, ref_zbin=0, redshifts=None, freqs=None, frame='icrs')[source]

Generate a full-frequency SkyModel of a flat-spectrum (noiselike) EoR signal.

The amplitude of this signal is variance * vol(ref_chan), where vol() gives the voxel volume and ref_chan is a chosen reference point. The generated SkyModel has healpix component type.

Parameters:
  • variance (float) – Variance of the signal, in Kelvin^2, at the reference channel.

  • nside (int) – HEALPix NSIDE parameter. Must be a power of 2.

  • ref_chan (int) – Frequency channel to set as reference, if using freqs.

  • ref_zbin (int) – Redshift bin number to use as reference, if using redshifts.

  • redshifts (numpy.ndarray) – Redshifts at which to generate maps. Ignored if freqs is provided.

  • freqs (numpy.ndarray) – Frequencies in Hz, not required if redshifts is passed. Overrides redshifts if passed.

Returns:

pyradiosky.SkyModel – A SkyModel instance corresponding a white noise-like EoR signal.

Notes

Either redshifts or freqs must be provided. The history string of the returned SkyModel gives the expected amplitude.