Simple plotting functions

The hera_pspec.plot module contains functions for making simple plots of delay power spectra.

The following example plots the power spectra from a UVPSpec object, averaged over baseline-pairs and times.

# Load or generate a UVPSpec object containing delay power spectra
uvp = ...

# Set which baseline-pairs should be included in the plot
blpairs = list(uvp.blpair_array) # This includes all blpairs!

# Plot the delay spectrum, averaged over all blpairs and times
# (for the spectral window with index=0, and polarization 'xx')
ax = hp.plot.delay_spectrum(uvp, [blpairs,], spw=0, pol='xx',
                            average_blpairs=True, average_times=True,
                            delay=False)

# Setting delay=False plots the power spectrum in cosmological units

For a more extensive worked example, see this example Jupyter notebook.

The only plotting function currently available in the hera_pspec.plot module is delay_spectrum().

hera_pspec.plot.delay_spectrum(uvp, blpairs, spw, pol, average_blpairs=False, average_times=False, fold=False, plot_noise=False, delay=True, deltasq=False, legend=False, ax=None)[source]

Plot a 1D delay spectrum (or spectra) for a group of baselines.

Parameters:
  • uvp (UVPspec) – UVPSpec object, containing delay spectra for a set of baseline-pairs, times, polarizations, and spectral windows.
  • blpairs (list of tuples or lists of tuples) – List of baseline-pair tuples, or groups of baseline-pair tuples.
  • spw, pol (int or str) – Which spectral window and polarization to plot.
  • average_blpairs (bool, optional) – If True, average over the baseline pairs within each group.
  • average_times (bool, optional) – If True, average spectra over the time axis. Default: False.
  • fold (bool, optional) – Whether to fold the power spectrum in \(|k_\parallel|\). Default: False.
  • plot_noise (bool, optional) – Whether to plot noise power spectrum curves or not. Default: False.
  • delay (bool, optional) – Whether to plot the power spectrum in delay units (ns) or cosmological units (h/Mpc). Default: True.
  • deltasq (bool, optional) – If True, plot dimensionless power spectra, Delta^2. This is ignored if delay=True. Default: False.
  • legend (bool, optional) – Whether to switch on the plot legend. Default: False.
  • ax (matplotlib.axes, optional) – Use this to pass in an existing Axes object, which the power spectra will be added to. (Warning: Labels and legends will not be altered in this case, even if the existing plot has completely different axis labels etc.) If None, a new Axes object will be created. Default: None.
Returns:

ax – Matplotlib Axes instance.

Return type:

matplotlib.axes