Power Spectrum Calculation¶
Module to generate the matter power spectrum either from CLASS or using the emulator
-
class
spectrumcalc.
matterspectrum
(emulator=True)[source]¶ Bases:
cosmology.spectrumclass.powerclass
Routine to sample the cosmological and nuisance parameters. We have variaous options here. We can either use the emulator to calculate the 3D matter power spectrum or we can use CLASS itself.
-
gp_gradient
(testpoint: numpy.ndarray, order: int = 1) → numpy.ndarray[source]¶ Calculate the gradient of the power spectrum
- Param
testpoint (np.ndarray) : a testpoint
- Param
order (int) : 1 or 2 (1 refers to first derivative and 2 refers to second)
- Returns
the derivatives of the power spectrum (of size (nk x nz) x ndim), for example 800 x 7
-
int_grad_pk_nl
(params: dict, order: int = 1, int_type: str = 'cubic', eps: list = [0.001], **kwargs) → dict[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
- Param
int_type (str) : type of interpolation (linear, cubic, quintic). Default is cubic
- Returns
grad (dict) : a dictionary containing the gradient of each parameter
-
int_pk_nl
(params: dict, a_bary: float = 0, int_type: str = 'cubic', **kwargs) → numpy.ndarray[source]¶ Calculate the (interpolated) 3D matter power spectrum at a test point
- Param
parameters (dict) : a dictionary of the test point in parameter space
- Param
a_bary (float) : the baryon feedback parameter (DEFAULT = 0)
- Param
int_type (str) : type of interpolation (linear, cubic, quintic). Default is cubic
- Returns
spectrum (np.ndarray) : the interpolated 3D matter power spectrum
-
load_gps
(directory: str = 'semigps') → list[source]¶ Load all the trained Gaussian Processes.
- Param
directory (str) - the directory where the GPs are stored (depends on our choice:
zero mean GP
semi-GP (DEFAULT: semigps)
- Returns
gps (list) - a list containing all the GPs
-