CLAPP / class-data /classy-generated-docstrings.txt
Santiago Casas
add prompt and class data
bc65052
```python
"""
The following docstrings were extracted from classy-py.py
"""
def viewdictitems(d):
"""Return items from a dictionary for Python 2 and 3 compatibility.
Args:
d (dict): The dictionary to retrieve items from.
Returns:
A view of the dictionary's items.
"""
def _check_task_dependency(self, level):
"""Fill the level list with all the needed modules.
Warning:
The ordering of modules is obviously dependent on CLASS module order
in the main.c file. This has to be updated in case of a change to
this file.
Args:
level (list): List of strings, containing initially only the last module required.
For instance, to recover all the modules, the input should be
['lensing'].
"""
def _pars_check(self, key, value, contains=False, add=""):
"""Check parameters (implementation detail, no docstring provided)."""
def compute(self, level=["distortions"]):
"""Compute the CLASS cosmology.
Main function, execute all the _init methods for all desired modules.
This is called in MontePython, and this ensures that the Class instance
of this class contains all the relevant quantities. Then, one can deduce
Pk, Cl, etc...
Args:
level (list, optional): List of the last module desired. The internal function
_check_task_dependency will then add to this list all the
necessary modules to compute in order to initialize this last
one. The default last module is "lensing". Defaults to ["distortions"].
Warning:
level default value should be left as an array (it was creating
problem when casting as a set later on, in _check_task_dependency)
"""
def raw_cl(self, lmax=-1, nofail=False):
"""Return a dictionary of the primary C_l.
Args:
lmax (int, optional): Define the maximum l for which the C_l will be returned
(inclusively). This number will be checked against the maximum l
at which they were actually computed by CLASS, and an error will
be raised if the desired lmax is bigger than what CLASS can
give. Defaults to -1.
nofail (bool, optional): Check and enforce the computation of the harmonic module
beforehand, with the desired lmax. Defaults to False.
Returns:
dict: Dictionary that contains the power spectrum for 'tt', 'te', etc... The
index associated with each is defined wrt. Class convention, and are non
important from the python point of view. It also returns now the
ell array.
"""
def lensed_cl(self, lmax=-1,nofail=False):
"""Return a dictionary of the lensed C_l.
Return a dictionary of the lensed C_l, computed by CLASS, without the
density C_ls. They must be asked separately with the function aptly
named density_cl
Args:
lmax (int, optional): Define the maximum l for which the C_l will be returned (inclusively). Defaults to -1.
nofail (bool, optional): Check and enforce the computation of the lensing module beforehand. Defaults to False.
Returns:
dict: Dictionary that contains the power spectrum for 'tt', 'te', etc... The
index associated with each is defined wrt. Class convention, and are non
important from the python point of view.
"""
def density_cl(self, lmax=-1, nofail=False):
"""Return a dictionary of the primary C_l for the matter.
Args:
lmax (int, optional): Define the maximum l for which the C_l will be returned (inclusively). Defaults to -1.
nofail (bool, optional): Check and enforce the computation of the lensing module beforehand. Defaults to False.
Returns:
numpy array of numpy.ndarrays: Array that contains the list (in this order) of self correlation of
1st bin, then successive correlations (set by non_diagonal) to the
following bins, then self correlation of 2nd bin, etc. The array
starts at index_ct_dd.
"""
def sigma(self,R,z, h_units = False):
"""Give sigma (total matter) for a given R and z.
(R is the radius in units of Mpc, so if R=8/h this will be the usual sigma8(z).
This is unless h_units is set to true, in which case R is the radius in units of Mpc/h,
and R=8 corresponds to sigma8(z))
Note:
there is an additional check to verify whether output contains `mPk`,
and whether k_max > ...
because otherwise a segfault will occur
Args:
R:
z:
h_units:
"""
def sigma_cb(self,double R,double z, h_units = False):
"""Give sigma (cdm+b) for a given R and z.
(R is the radius in units of Mpc, so if R=8/h this will be the usual sigma8(z)
This is unless h_units is set to true, in which case R is the radius in units of Mpc/h,
and R=8 corresponds to sigma8(z))
Note:
there is an additional check to verify whether output contains `mPk`,
because otherwise a segfault will occur
Args:
R:
z:
h_units:
"""
def pk_tilt(self,double k,double z):
"""Give effective logarithmic slope of P_L(k,z) (total matter) for a given k and z.
(k is the wavenumber in units of 1/Mpc, z is the redshift, the output is dimensionless)
Note:
there is an additional check that output contains `mPk` and whether k is in the right range
Args:
k:
z:
"""
def age(self):
"""Return the age of the Universe (implementation detail, no docstring provided)."""
def h(self):
"""Return the Hubble parameter (implementation detail, no docstring provided)."""
def n_s(self):
"""Return the scalar spectral index (implementation detail, no docstring provided)."""
def tau_reio(self):
"""Return the reionization optical depth (implementation detail, no docstring provided)."""
def Omega_m(self):
"""Return the matter density parameter (implementation detail, no docstring provided)."""
def Omega_r(self):
"""Return the radiation density parameter (implementation detail, no docstring provided)."""
def theta_s_100(self):
"""Return the sound horizon angle (implementation detail, no docstring provided)."""
def theta_star_100(self):
"""Return the sound horizon angle at decoupling (implementation detail, no docstring provided)."""
def Omega_Lambda(self):
"""Return the cosmological constant density parameter (implementation detail, no docstring provided)."""
def Omega_g(self):
"""Return the photon density parameter (implementation detail, no docstring provided)."""
def r(self):
"""Return the tensor-to-scalar ratio (implementation detail, no docstring provided)."""
def A_s(self):
"""Return the primordial power spectrum amplitude (implementation detail, no docstring provided)."""
def ln_A_s_1e10(self):
"""Return the natural logarithm of 10^10 times the primordial power spectrum amplitude (implementation detail, no docstring provided)."""
def lnAs_1e10(self):
"""Return the natural logarithm of 10^10 times the primordial power spectrum amplitude (implementation detail, no docstring provided)."""
def Neff(self):
"""Return the effective number of neutrino species (implementation detail, no docstring provided)."""
def get_transfer(self, z=0., output_format='class'):
"""Return the density and/or velocity transfer functions.
Return the density and/or velocity transfer functions for all initial
conditions, at a given value of z.
By default, all transfer functions will be normalised to 'curvature R=1'
at initial time (and not 'curvature R = -1/k^2' like in CAMB).
You may switch to output_format='camb' for the CAMB definition and normalisation
of transfer functions.
When setting CLASS input parameters, include at least one of 'dTk' (for density transfer functions)
or 'vTk' (for velocity transfer functions).
For more details, see section II of the CLASS notebook.
Args:
z (float, optional): Redshift. Defaults to 0..
output_format (str, optional): Format transfer functions according to CLASS (default) or CAMB. Defaults to 'class'.
Returns:
dict: Dictionary containing an entry for each transfer function. For a
given transfer function, say, delta_tot, transfers['d_tot'] will be
an array containing delta_tot(k) at the k values defined in the
'k_output_values' list. When there are non-adiabatic conditions,
the transfer dictionary will have keys like transfers['d_tot[name]'], where
name is the name of the isocurvature mode.
"""
def get_current_derived_parameters(self, names):
"""Return a dictionary containing an entry for all the names defined in the input list.
Args:
names (list): Derived parameters that can be asked from Monte Python, or
elsewhere.
Returns:
dict: A dictionary of derived parameters.
Raises:
TypeError: If `names` is not a list.
"""
def get_perturbations(self, return_copy=True):
"""Return scalar, vector and/or tensor perturbations as arrays for requested k-values.
Note:
you need to specify both 'k_output_values', and have some
perturbations computed, for instance by setting 'output' to 'tCl'.
Do not enable 'return_copy=False' unless you know exactly what you are doing.
This will mean that you get access to the direct C pointers inside CLASS.
That also means that if class is deallocated,
your perturbations array will become invalid. Beware!
Args:
return_copy (bool, optional): Whether to return a copy of the data. Defaults to True.
Returns:
dict of array of dicts: perturbations['scalar'] is an array of length 'k_output_values' of
dictionary containing scalar perturbations.
Similar for perturbations['vector'] and perturbations['tensor'].
"""
def scale_dependent_growth_factor_f(self, k, z, Nz=50, h_units = False, evolution=False):
"""Return the scale-dependent growth factor, f(k,z) = d ln delta(k,z) / d ln a, at a given k and z, for total matter fluctuations.
Args:
k (float or array): wavenumber in units of 1/Mpc
z (float or array): redshift
Nz (int, optional): number of points for computing sigma(R,z) splines, default to 50. Defaults to 50.
h_units (bool, optional): If true, returns k in h/Mpc. Defaults to False.
evolution (bool, optional): . Defaults to False.
"""
def pk(self, k, z, lAccuracy=10):
"""Return the total matter power spectrum for a given k and z.
Return the total matter power spectrum for a given k and z (will be
non linear if requested to Class, linear otherwise)
Args:
k (float): wavenumber in units of 1/Mpc
z (float): redshift
lAccuracy (int, optional): Level of accuracy of the integration. Defaults to 10.
"""
def pk_cb(self,double k,double z):
"""Give the cdm+b pk (in Mpc**3) for a given k (in 1/Mpc) and z (will be non linear if requested to Class, linear otherwise).
Note:
there is an additional check that output contains `mPk`,
because otherwise a segfault will occur
Args:
k:
z:
"""
def pk_lin(self, k, z, lAccuracy=10):
"""Return the LINEAR total matter power spectrum for a given k and z.
Args:
k (float): wavenumber in units of 1/Mpc
z (float): redshift
lAccuracy (int, optional): Level of accuracy of the integration. Defaults to 10.
"""
def pk_cb_lin(self,double k,double z):
"""Give the LINEAR cdm+b pk (in Mpc**3) for a given k (in 1/Mpc) and z.
Note:
there is an additional check that output contains `mPk`,
because otherwise a segfault will occur
Args:
k:
z:
"""
def log_pk(self, k, z, lAccuracy=10):
"""Return the log of the total matter power spectrum for a given k and z.
Args:
k (float): wavenumber in units of 1/Mpc
z (float): redshift
lAccuracy (int, optional): Level of accuracy of the integration. Defaults to 10.
"""
def transfer(self, k, z, idx_T=1, lAccuracy=10):
"""Return a transfer function for a given k and z.
Args:
k (float): wavenumber in units of 1/Mpc
z (float): redshift
idx_T (int, optional): index of transfer function to return, with 0=delta_g, 1=delta_b,
2=delta_cdm, 3=delta_ncdm[0], etc.... Defaults to 1.
lAccuracy (int, optional): Level of accuracy of the integration. Defaults to 10.
"""
def rho_crit(self, z, lAccuracy=10):
"""Return the critical density at redshift z.
Args:
z (float): redshift
lAccuracy (int, optional): Level of accuracy of the integration. Defaults to 10.
"""
def scale_independent_f_sigma8(self, z, Nz=50):
"""Return an interpolator for f \\sigma_8 (scale-INdependent), as a function of z.
This will compute f(z) = d ln delta / d ln a,
approximating this quantity with the scale-INdependent growth rate.
For the scale-dependent one, use the proper function.
Args:
z (array): Redshift
"""
def scale_independent_growth_factor(self, z, Nz=50):
"""Return the linear growth factor by taking the ratio of Delta(z)/Delta(z=0).
Args:
z (array): Redshift
"""
def has_idr(self):
"""Check for interacting dark radiation (implementation detail, no docstring provided)."""
def has_dr(self):
"""Check for dark radiation (implementation detail, no docstring provided)."""
def spectral_distortion_amplitudes(self):
"""Distortion amplitudes (implementation detail, no docstring provided)."""
def get_transfer_functions_at_z(self, z, k_values, output_format='class'):
"""Return the density and velocity transfer functions.
Return the density and velocity transfer functions for all initial
conditions, at a given value of z.
For more details, see section II of the CLASS notebook.
By default, all transfer functions will be normalised to 'curvature R=1' at initial time
(and not 'curvature R = -1/k^2' like in CAMB).
You may switch to output_format='camb' for the CAMB definition and normalisation of transfer functions.
When setting CLASS input parameters, include at least one of 'dTk' (for density transfer functions)
or 'vTk' (for velocity transfer functions).
Args:
z (float): Redshift
k_values:
output_format (str, optional): Format transfer functions according to CLASS (default) or CAMB. Defaults to 'class'.
"""
def primordial_spec(self, k, return_power=True, lAccuracy=10):
"""Return the primordial power spectrum.
This function switches between the scalar and tensor primordial power
spectrum, and accepts as an argument a scale k.
Args:
k (float): wavenumber in units of 1/Mpc
return_power (bool, optional): default value is true, which returns the power spectrum, otherwise the value of the scale is returned. Defaults to True.
lAccuracy (int, optional): Level of accuracy of the integration. Defaults to 10.
"""
def primordial_scalar_pk(self, k, lAccuracy=10):
"""Return the primordial SCALAR power spectrum for a given k.
Args:
k (float): wavenumber in units of 1/Mpc
lAccuracy (int, optional): Level of accuracy of the integration. Defaults to 10.
"""
def primordial_tensor_pk(self, k, lAccuracy=10):
"""Return the primordial TENSOR power spectrum for a given k.
Args:
k (float): wavenumber in units of 1/Mpc
lAccuracy (int, optional): Level of accuracy of the integration. Defaults to 10.
"""
def angular_diamater_distance(self,z):
"""Return the angular diameter distance."""
def tangential_critical_density(self,z_l,z_s):
"""Returnthe critical density for tangential shear."""