pyccl.core module

The core functionality of ccl, including the core data types. This includes the cosmology and parameters objects used to instantiate a model from which one can compute a set of theoretical predictions.

class pyccl.core.Cosmology(Omega_c=None, Omega_b=None, h=None, n_s=None, sigma8=None, A_s=None, Omega_k=0.0, Omega_g=None, Neff=3.046, m_nu=0.0, m_nu_type=None, w0=-1.0, wa=0.0, T_CMB=None, bcm_log10Mc=14.079181246047625, bcm_etab=0.5, bcm_ks=55.0, mu_0=0.0, sigma_0=0.0, z_mg=None, df_mg=None, transfer_function='boltzmann_camb', matter_power_spectrum='halofit', baryons_power_spectrum='nobaryons', mass_function='tinker10', halo_concentration='duffy2008', emulator_neutrinos='strict')[source]

Bases: object

A cosmology including parameters and associated data.

Note

Although some arguments default to None, they will raise a ValueError inside this function if not specified, so they are not optional.

Note

The parameter Omega_g can be used to set the radiation density (not including relativistic neutrinos) to zero. Doing this will give you a model that is physically inconsistent since the temperature of the CMB will still be non-zero. Note however that this approximation is common for late-time LSS computations.

Note

BCM stands for the “baryonic correction model” of Schneider & Teyssier (2015; https://arxiv.org/abs/1510.06034). See the DESC Note for details.

Note

After instantiation, you can set parameters related to the internal splines and numerical integration accuracy by setting the values of the attributes of Cosmology.cosmo.spline_params and Cosmology.cosmo.gsl_params. For example, you can set the generic relative accuracy for integration by executing c = Cosmology(...); c.cosmo.gsl_params.INTEGRATION_EPSREL = 1e-5. See the module level documetaion of pyccl.core for details.

Parameters:
  • Omega_c (float) – Cold dark matter density fraction.
  • Omega_b (float) – Baryonic matter density fraction.
  • h (float) – Hubble constant divided by 100 km/s/Mpc; unitless.
  • A_s (float) – Power spectrum normalization. Exactly one of A_s and sigma_8 is required.
  • sigma8 (float) – Variance of matter density perturbations at an 8 Mpc/h scale. Exactly one of A_s and sigma_8 is required.
  • n_s (float) – Primordial scalar perturbation spectral index.
  • Omega_k (float, optional) – Curvature density fraction. Defaults to 0.
  • Omega_g (float, optional) – Density in relativistic species except massless neutrinos. The default of None corresponds to setting this from the CMB temperature. Note that if a non-None value is given, this may result in a physically inconsistent model because the CMB temperature will still be non-zero in the parameters.
  • Neff (float, optional) – Effective number of massless neutrinos present. Defaults to 3.046.
  • m_nu (float, optional) – Total mass in eV of the massive neutrinos present. Defaults to 0.
  • m_nu_type (str, optional) – The type of massive neutrinos. Should be one of ‘inverted’, ‘normal’, ‘equal’ or ‘list’. The default of None is the same as ‘normal’.
  • w0 (float, optional) – First order term of dark energy equation of state. Defaults to -1.
  • wa (float, optional) – Second order term of dark energy equation of state. Defaults to 0.
  • T_CMB (float) – The CMB temperature today. The default of None uses the global CCL value in pyccl.physical_constants.T_CMB.
  • bcm_log10Mc (float, optional) – One of the parameters of the BCM model. Defaults to np.log10(1.2e14).
  • bcm_etab (float, optional) – One of the parameters of the BCM model. Defaults to 0.5.
  • bcm_ks (float, optional) – One of the parameters of the BCM model. Defaults to 55.0.
  • mu_0 (float, optional) – One of the parameters of the mu-Sigma modified gravity model. Defaults to 0.0
  • sigma_0 (float, optional) – One of the parameters of the mu-Sigma modified gravity model. Defaults to 0.0
  • df_mg (array_like, optional) – Perturbations to the GR growth rate as a function of redshift \(\Delta f\). Used to implement simple modified growth scenarios.
  • z_mg (array_like, optional) – Array of redshifts corresponding to df_mg.
  • transfer_function (str, optional) – The transfer function to use. Defaults to ‘boltzmann_camb’.
  • matter_power_spectrum (str, optional) – The matter power spectrum to use. Defaults to ‘halofit’.
  • baryons_power_spectrum (str, optional) – The correction from baryonic effects to be implemented. Defaults to ‘nobaryons’.
  • mass_function (str, optional) – The mass function to use. Defaults to ‘tinker10’ (2010).
  • halo_concentration (str, optional) – The halo concentration relation to use. Defaults to Duffy et al. (2008) ‘duffy2008’.
  • emulator_neutrinosstr, optional): If using the emulator for the power spectrum, specified treatment of unequal neutrinos. Options are ‘strict’, which will raise an error and quit if the user fails to pass either a set of three equal masses or a sum with m_nu_type = ‘equal’, and ‘equalize’, which will redistribute masses to be equal right before calling the emualtor but results in internal inconsistencies. Defaults to ‘strict’.
compute_distances()[source]

Compute the distance splines.

compute_growth()[source]

Compute the growth function.

compute_linear_power()[source]

Compute the linear power spectrum.

compute_nonlin_power()[source]

Compute the non-linear power spectrum.

compute_sigma()[source]

Compute the sigma(M) and mass function splines.

has_distances

Checks if the distances have been precomputed.

has_growth

Checks if the growth function has been precomputed.

has_linear_power

Checks if the linear power spectra have been precomputed.

has_nonlin_power

Checks if the non-linear power spectra have been precomputed.

has_sigma

Checks if sigma(M) and mass function splines are precomputed.

classmethod read_yaml(filename)[source]

Read the parameters from a YAML file.

Parameters:filename (str) –
status()[source]

Get error status of the ccl_cosmology object.

Note

The error statuses are currently under development and may not be fully descriptive.

Returns:str containing the status message.
write_yaml(filename)[source]

Write a YAML representation of the parameters to file.

Parameters:filename (str) –