pynbody.analysis.hmf.PowerSpectrum#

class pynbody.analysis.hmf.PowerSpectrum(context, filename=None, k=None, Pk=None, log_interpolation=True)[source]#

Bases: object

A power spectrum object, which can be called to return the power spectrum at a given wavenumber.

Methods

__call__(k)

Evaluate the power spectrum at the snapshot redshift

get_sigma8()

Calculate the current sigma8 value at z=0

set_sigma8(sigma8)

Update the normalisation for a given sigma8 value at z=0

__init__(context, filename=None, k=None, Pk=None, log_interpolation=True)[source]#

Set up a power spectrum object.

Either a tabulated power spectrum or the filename of a tabulated power spectrum can be passed. If neither is provided, a default power spectrum is used which assumes Planck 2018 values.

Parameters:
  • context (SimSnap) – The simulation snapshot from which to pull the cosmological context. This is used for the linear growth factor and sigma8 normalization.

  • filename (str, optional) – The name of a file containing the power spectrum.

  • k (array, optional) – The wavenumbers of the power spectrum in comoving h/Mpc

  • Pk (array, optional) – The power spectrum in Mpc^3 h^-3

  • log_interpolation (bool, optional) – If True, interpolate in log space. This is generally more accurate for power spectra.

get_sigma8()[source]#

Calculate the current sigma8 value at z=0

set_sigma8(sigma8)[source]#

Update the normalisation for a given sigma8 value at z=0