pynbody.analysis.hmf.PowerSpectrumCAMB#

class pynbody.analysis.hmf.PowerSpectrumCAMB(context, use_context=True, camb_params={}, log_interpolation=True)[source]#

Bases: PowerSpectrum

A power spectrum object that calculates the power spectrum on the fly using CAMB.

This is slower than using a precomputed power spectrum, but is more flexible.

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, use_context=True, camb_params={}, log_interpolation=True)[source]#

Runs CAMB to calculate a power spectrum for the provided context.

Parameters:
  • context (SimSnap) – The simulation snapshot from which to pull the cosmological context.

  • use_context (bool, optional) – If True, use the context to set the cosmological parameters in CAMB. If False, use only the parameters in camb_params.

  • camb_params (dict, optional) – A dictionary of parameters to pass to CAMB’s set_cosmology method. Note that the scalar spectral index ns is not included in set_cosmology; if provided here, it is extracted and passed to InitPower.set_params.

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

get_sigma8()#

Calculate the current sigma8 value at z=0

set_sigma8(sigma8)#

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