CLASS Power Spectrum

Calculate the matter power spectrum using CLASS

class spectrumclass.powerclass[source]

Bases: object

Uses CLASS to compute the matter power spectrum

class_compute(parameters: dict)[source]

Calculate the relevant quantities using CLASS

Param

parameters (dict) : dictionary of input parameters to CLASS

Returns

class_module : the whole CLASS module (which contains distances, age, temperature and others)

configurations() → None[source]

Calculate and store the basic configurations which will be used by CLASS. This requires setting up a dictionary for the quantities we want CLASS to take as default and also the quantity we want CLASS to output.

derivatives(params: dict, order: int = 1, eps: list = [0.001], **kwargs) → numpy.ndarray[source]

Calculates the gradient of the power spectrum at a point in parameter space

Param

params (dict) : a point within the prior box

Param

eps (float) : epsilon - using central finite difference method to calculate gradient

Returns

grad (list) : an array containing the gradient of each parameter (of size (nk x nz) x ndim), for example 800 x 7

pk_nonlinear(parameters: dict, **kwargs) → numpy.ndarray[source]

Calculate the 3D matter power spectrum based on the emulator setting file

Param

parameters (dict) - inputs to calculate the matter power spectrum

Returns

pk_matter (np.ndarray) - the 3D matter power spectrum

pk_nonlinear_components(parameters: dict, zref: float = 0.0, **kwargs) → dict[source]

The non-linear 3D matter power spectrum can be decomposed into:

P_nonlinear (k,z) = A(z) [1 + q(k,z)] P_linear (k,z0)

Calculates the following quantities:

  • non linear 3D matter power spectrum, P_nonlinear(k,z)

  • linear matter power spectrum (at the reference redshift - see setting file)

  • the growth factor, A(z)

  • the quantity q(k,z)

Param

parameters (dict) - inputs to calculate the matter power spectrum

Param

zref (float) - the reference redshift at which the linear matter power spectrum is calculated (DEFAULT: 0.0)

Returns

quantities (dictionary) - dictionary consisting of the nonlinear power spectrum, linear power spectrum, growth factor and the non-linear function q(k,z)

pk_nonlinear_timed(parameters: dict) → dict[source]

Calculate the non linear matter power spectrum but within an allocated period of time

Param

parameters (dict) - a dictionary for inputs to CLASS

Returns

quant (dict) - a dictionary of the calculated quantities