py21cmsense.sensitivity.PowerSpectrum

class py21cmsense.sensitivity.PowerSpectrum(*, observation: ~py21cmsense.observation.Observation, no_ns_baselines=False, horizon_buffer: ~astropy.units.quantity.Quantity = <Quantity 0.1 littleh / Mpc>, foreground_model: str = 'moderate', theory_model: ~py21cmsense.theory.TheoryModel = NOTHING, systematics_mask: ~typing.Callable | None = None)[source]

A Power Spectrum sensitivity calculator.

Note that the sensitivity calculation contains two major parts: thermal variance and sample variance (aka cosmic variance). The latter requires a model of the power spetrum itself, which you should provide via k_21 and delta_21. Remember that the power spectrum is redshift dependent, and so should be supplied differently at each frequency being calculated.

Parameters:
  • horizon_buffer (float or Quantity) – A buffer to add to the horizon line in order to excise foreground-contaminated modes.

  • foreground_model (str, {moderate, optimistic}) – Which approach to take for foreground excision. Moderate uses a defined horizon buffer, while optimistic excludes all k modes inside the primary field of view.

  • k_21 (array or Quantity, optional) – An array of wavenumbers used to define a cosmological power spectrum, in order to get sample variance. If not a Quantity, will assume k has units of 1/Mpc, though it will convert these units to h/Mpc throughout the class. Default is to use built-in data file from 21cmFAST.

  • delta_21 (array or Quantity, optional) – An array of Delta^2 power spectrum values used for sample variance. If not a Quantity, will assume units of mK^2.

  • systematics_mask (callable) – A function that takes a single kperp and an array of kpar, and returns a boolean array specifying which of the k’s are useable after accounting for systematics. that is, it returns False for k’s affected by systematics.

Methods

__init__(*, observation[, no_ns_baselines, ...])

Method generated by attrs for class PowerSpectrum.

at_frequency(frequency)

Return a new object at a new frequency.

calculate_sensitivity_1d_binned(k, **kwargs)

Calculate the 1D sensitivity at arbitrary k-bins.

calculate_sensitivity_2d_grid(kperp_edges, ...)

Calculate the 2D cylindrical sensitivity on a grid of kperp/kpar.

clone(**kwargs)

Clone the object with new parameters.

from_yaml(yaml_file)

Construct a PowerSpectrum sensitivity from yaml.

horizon_limit(umag)

Calculate a horizon limit, with included buffer, if appropriate.

plot_sense_1d([sample, thermal])

Create a plot of the sensitivity in 1D k-bins.

plot_sense_2d(sense2d)

Create a colormap plot of the sensitivity un UV bins.

power_normalisation(k)

Normalisation constant for power spectrum.

sample_noise(k_par, k_perp)

Sample variance contribution at a particular k mode.

thermal_noise(k_par, k_perp, trms)

Thermal noise contribution at particular k mode.

write(filename[, thermal, sample, prefix, direc])

Save sensitivity results to HDF5 file.

Attributes

X2Y

Cosmological scaling factor X^2*Y (eg.

calculate_sensitivity_1d

calculate_sensitivity_2d

calculate_significance

cosmo

The cosmology to use in the sensitivity calculations.

delta_squared

The fiducial 21cm power spectrum evaluated at k1d.

frequency

The frequency of the observation.

k1d

1D array of wavenumbers for which sensitivities will be generated.

uv_coverage

The UV-coverage of the array, with unused/redundant baselines set to zero.

horizon_buffer

foreground_model

theory_model

systematics_mask

observation

no_ns_baselines