PSpecBeam: Primary beam models

PSpecBeam objects carry information about the primary beam, such as how the beam solid angle varies with frequency. This information is needed to rescale power spectra into cosmological units, through the computation of a ‘beam scalar’.

The main purpose of PSpecBeam objects is to provide the PSpecData class with a way of normalizing the power spectra that it produces, using the compute_pspec_scalar() method. To attach a PSpecBeam object to a PSpecData object, pass one in when you instantiate the class, e.g.

# Create PSpecBeamUV from a beamfits file
beam = hp.PSpecBeamUV('HERA_Beams.beamfits')

# Attach beam to PSpecData object
psd = hp.PSpecData(dsets=[], wgts=[], beam=beam)

Another purpose of PSpecBeam objects is to convert flux densities to temperature units using the Jy_to_mK() method, e.g.

# Apply unit conversion factor to UVData
uvd = UVData()
uvd.read_miriad(datafile) # Load data (assumed to be in Jy units)
uvd.data_array *= beam.Jy_to_mK(np.unique(uvd.freq_array))[None, None, :, None]
# (The brackets [] are needed to match the shape of uvd.data_array)

Note that PSpecBeam objects have a cosmology attached to them. If you don’t specify a cosmology (with the cosmo keyword argument), they will be instantiated with the default cosmology from hera_pspec.conversions.

There are several different types of PSpecBeam object:

PSpecBeamBase: Base class for PSpecBeam

This is the base class for all other PSpecBeam objects. It provides the generic compute_pspec_scalar() and Jy_to_mK() methods, but subclasses must provide their own power_beam_int and power_beam_sq_int methods.

PSpecBeamUV: Beams from a UVBeam object

This class allows you to use any beam that is supported by the UVBeam class in the pyuvdata package. These usually contain Healpix-pixelated beams as a function of frequency and polarization.

To create a beam that uses this format, simply create a new PSpecBeamUV instance with the name of a beamfits file that is supported by UVBeam, e.g.

beam = hp.PSpecBeamUV('HERA_Beams.beamfits')

PSpecBeamGauss: Simple Gaussian beam model

A Gaussian beam type is provided for simple testing purposes. You can specify a beam FWHM that is constant in frequency, for the I (pseudo-Stokes I) polarization channel only.

For example, to specify a Gaussian beam with a constant FWHM of 0.1 radians, defined over a frequency interval of [100, 200] MHz:

# Each beam is defined over a frequency interval:
beam_freqs = np.linspace(100e6, 200e6, 200) # in Hz

# Create a new Gaussian beam object with full-width at half-max. of 0.1 radians
beam_gauss = hp.PSpecBeamGauss(fwhm=0.1, beam_freqs=beam_freqs)