Cosmological model

For a usage example of this library, see Basic usage of cosmological functions

class colibri.cosmology.cosmo(Omega_m=0.32, Omega_b=0.05, h=0.67, As=2.12605e-09, sigma_8=None, ns=0.96, w0=-1.0, wa=0.0, Omega_K=0.0, tau=0.06, T_cmb=2.7255, M_nu=[], N_nu=3, N_eff=3.044, M_wdm=[], Omega_wdm=[])

The class cosmo takes as arguments a set of cosmological parameters and returns a cosmo instance, which contains several methods to compute useful cosmological quantities, such as distances, ages, scales, power spectra and evolution of cosmological parameters. This class supports \(\Lambda\mathrm{CDM}\) cosmologies as well as massive neutrinos, evolving dark energy models and non-flat geometries. It accepts the following arguments, with the default values specified:

Parameters:
  • Omega_m (float, default = 0.32) – Matter density parameter today (including massive neutrinos), \(\Omega_m\).

  • Omega_b (float, default = 0.05) – Baryon density parameter today, \(\Omega_b\).

  • h (float, default = 0.67) – Hubble constant in units of 100 km/s/Mpc.

  • As (float, default = 2.12065e-9) – Amplitude of primordial scaled perturbations. At least one between this and sigma_8 must be different from None. If As is not None, it will be the parameter used to compute the amplitude of the power spectrum.

  • sigma_8 (float, default = None) – Root mean square amplitude fluctuation on scales of 8 \(\mathrm{Mpc}/h\). At least one between this and As must be different from None. If sigma_8 is not None, and As is None, the former will be the parameter used to compute the amplitude of the power spectrum.

  • ns (float, default = 0.96) – Spectral index of scalar primordial perturbations.

  • w0 (float, default = -1) – Dark energy parameter of state today.

  • wa (float, default = 0) – Evolution of dark energy parameter of state.

  • Omega_K (float, default = 0) – Curvature density parameter today, \(\Omega_K\).

  • tau (float, default = 0.06) – Optical depth to reionization.

  • T_cmb (float, default = 2.7255) – CMB temperature today.

  • M_nu (float or list of floats, default = []) – Non-vanishine neutrino masses expressed in eV. Its size must be smaller or equal to N_nu.

  • N_nu (int, default = 3) – Number of active neutrino species.

  • N_eff (float, default = 3.044) – Effective number of relativistic species in the early Universe. This number should be greater than N_nu.

  • M_wdm (float or list of floats, default = []) – WDM masses in eV

  • Omega_wdm (float or list of floats, same length as M_wdm, default = []) – WDM density parameters

After initialization, the following quantities will be stored

Parameters:
  • H0 – Hubble constant in km/s/Mpc, i.e. \(100 h\).

  • Omega_lambda – Dark energy/cosmological constant density parameter, \(\Omega_\Lambda\).

  • Omega_cdm – Cold dark matter density parameter today, \(\Omega_{cdm}\).

  • Omega_cb – Cold dark matter+baryons density parameter today, \(\Omega_{cb}\).

  • Omega_cold – Total cold-warm matter density parameter today, \(\Omega_{cold}\).

  • Omega_gamma – Photon density parameter today, \(\Omega_\gamma\).

  • Omega_nu – Massive neutrino density parameters, \(\Omega_\nu\).

  • Omega_nu_tot – Total massive neutrino density parameters, \(\Omega_\nu\).

  • Omega_ur – Ultra-relativistic species density parameter today, \(\Omega_\mathrm{ur}\).

  • Omega_rad – Radiation species density parameter today, \(\Omega_\mathrm{rad}\).

  • Omega_wdm_tot – Total WDM density parameter today.

  • omega_m – Reduced matter density parameter today, \(\Omega_m h^2\).

  • omega_cdm – Reduced cold dark matter density parameter today, \(\Omega_{cdm} h^2\).

  • omega_cb – Reduced cold dark matter+baryons density parameter today, \(\Omega_{cb} h^2\).

  • omega_cold – Reduced total cold-warm matter density parameter today, \(\Omega_{cold}\).

  • omega_b – Reduced baryon density parameter today, \(\Omega_{b} h^2\).

  • omega_gamma – Reduced photon density parameter today, \(\Omega_\gamma h^2\).

  • omega_nu – Reduced neutrino density parameter today, \(\Omega_\nu h^2\).

  • omega_nu_tot – Reduced total neutrino density parameters, for each species today.

  • omega_ur – Reduced ultra-relativistic density parameter today, \(\Omega_\mathrm{ur} h^2\).

  • omega_rad – Reduced radiation density parameter today, \(\Omega_\mathrm{rad} h^2\).

  • omega_K – Reduced curvature parameter today, \(\Omega_K h^2\).

  • omega_wdm – Reduced warm dark matter density parameters, for each species, today.

  • omega_wdm_tot – Reduced total warm dark matter density parameters, for each species, today.

  • massive_nu – Number of massive neutrinos.

  • massless_nu – Number of massless neutrinos, \(N_{eff} - N_{massive \ \nu}\)

  • log10_As – If As is not None, base-10 logarithm of initial scalar amplitude.

  • f_nu – Neutrino fraction, in units of \(\Omega_m\).

  • f_b – Baryon fraction in units of \(\Omega_m\).

  • f_c – Cold dark matter fraction in units of \(\Omega_m\).

  • f_w – Warm dark matter fraction in units of \(\Omega_m\).

  • f_cb – Cold dark matter plus baryon fraction in units of \(\Omega_m\).

  • Gamma_nu – Neutrino-to-photon temperature ratio.

  • Gamma_nu_inst – Ultra-relativistic species temperature in units of photon temperature.

  • T_nu – Neutrino temperature today, in kelvin.

  • T_wdm – WDM temperature today, in kelvin.

  • M – Array of 512 masses, equally-spaced in logarithmic bins from \(10^2\) to \(10^{18} \ M_\odot/h\), used to sample (e.g.) mass functions and variances

  • delta_sc – Critical overdensity for spherical collapse (linear theory extrapolation), \(\delta_{sc} = \frac{3}{20} \left(12\pi\right)^{2/3} \approx 1.686\).

  • eta_sc – Time of shell-crossing (radians), \(\eta_{sc} \approx 3.488\).

  • delta_v – Critical underdensity for voids (linear theory extrapolation), \(\delta_v = - \frac{3}{20} \left[6 (\sinh \eta_{sc}-\eta_{sc})\right]^{2/3} \approx -2.717\).

Despali_mass_function(sigma, a=0.794, p=0.247, A=0.3333, delta_th=None)

Universal mass function by Despali as function of the RMS mass fluctuation in spheres \(\sigma(M)\).

Parameters:
  • sigma (array) – RMS mass fluctuation.

  • a (float, default = 0.707) – Sheth-Tormen mass function parameter.

  • p (float<0.5, default = 0.3) – Sheth-Tormen mass function parameter.

  • A (float, default = 0.3333.) – Amplitude of .

  • delta_th' (float, default = None) – Threshold for collapse.

Returns:

array

EisensteinHu_Pk(z=0.0, k=array([1.00000000e-04, 1.01391139e-04, 1.02801630e-04, ..., 9.72747224e+01, 9.86279486e+01, 1.00000000e+02], shape=(1001,)), sigma_8=0.83)

It returns the linear power spectrum in the Eisenstein & Hu approximation.

Warning

This function does not allow to use non-flat FRW universes! Omega_K will be therefore set to 0 and its value devolved to Omega_m.

Warning

This function does not reproduce massive neutrinos! Therefore Omega_nu will be set to 0 and its value transferred to Omega_m.

Warning

This function only uses \(w_{de} = -1\).

Warning

This code uses \(\sigma_8\) as a normalization. \(A_s\) will not have any impact.

Parameters:
  • z (array, default = 0) – Redshifts.

  • k (array, default = np.logspace(-4., 2., 1001)) – Scales in units of \(h/\mathrm{Mpc}\).

  • sigma_8 (float, default = 0.83) – RMS mass fluctuation in spheres of 8 \(\mathrm{Mpc}/h\) of radius.

Returns:

  • k (array) – Scales in \(h/\mathrm{Mpc}\). Basically the same ‘k’ of the input.

  • pk (2D array of shape (len(z), len(k))) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

EisensteinHu_nowiggle_Pk(z=0.0, k=array([1.00000000e-04, 1.01391139e-04, 1.02801630e-04, ..., 9.72747224e+01, 9.86279486e+01, 1.00000000e+02], shape=(1001,)), sigma_8=0.83)

It returns the no-wiggle linear power spectrum in the Eisenstein & Hu approximation.

Warning

This function does not allow to use non-flat FRW universes! Omega_K will be therefore set to 0 and its value devolved to Omega_m.

Warning

This function does not reproduce massive neutrinos! Therefore Omega_nu will be set to 0 and its value transferred to Omega_m.

Warning

This function only uses \(w_{de} = -1\).

Warning

This code uses \(\sigma_8\) as a normalization. \(A_s\) will not have any impact.

Parameters:
  • z (array, default = 0) – Redshifts.

  • k (array, default = np.logspace(-4., 2., 1001)) – Scales in units of \(h/\mathrm{Mpc}\).

  • sigma_8 (float, default = 0.83) – RMS mass fluctuation in spheres of 8 \(\mathrm{Mpc}/h\) of radius.

Returns:

  • k (array) – Scales in \(h/\mathrm{Mpc}\). Basically the same ‘k’ of the input.

  • pk (2D array of shape (len(z), len(k))) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

FermiDirac_integral(y)

It computes the integral

\[\mathcal F(y) = \int_0^\infty dx \ x^2 \ \frac{(x^2+y^2)^{1/2}}{e^x+1},\]

useful to compute the neutrino parameter of state \(w_\nu = \frac{1}{3}\left[1-\frac{\mathrm{d}\ln\mathcal F}{\mathrm{d} \ln y}\right]\)

Parameters:

y (float) – Quantity related to neutrino mass, namely \(\frac{M_\nu}{(1+z) k_B T_\nu}\).

Returns:

float

Gaussian_window(x)

Gaussian window function.

Parameters:

x (array) – Abscissa.

Returns:

array.

H(z)

Hubble function in km/s/Mpc.

Parameters:

z (array) – Redshifts.

Returns:

array with \(H(z)\) in units of km/s/Mpc.

H100(z)

Hubble function in km/s/(Mpc/h).

Parameters:

z (array) – Redshifts.

Returns:

array with \(H(z)\) in units of km/s/(Mpc/h).

H_massive(z)

Hubble function in km/s/Mpc. It assumes that the massive neutrinos and WDM remain pressureless at all redshifts. For the minimum neutrino masses allowed by particle physics, assuming normal hierarchy and the correct differences of square masses, the error committed is about 0.5% at \(z = 100\) and 5% at \(z = 1000\).

Parameters:

z (array) – Redshifts.

Returns:

array with \(H(z)\) in units of km/s/Mpc.

MICE_mass_function(sigma, z=0.0)

Universal mass function by Crocce et al. (2010) as function of the RMS mass fluctuation in spheres \(\sigma(M)\).

Parameters:
  • sigma (2D array) – RMS mass fluctuation.

  • z (array, default = 0) – Redshift.

Returns:

array

Omega_K_z(z)

Curvature density parameter at a given redshift.

Parameters:

z (array) – Redshifts.

Returns:

array with \(\Omega_{K}(z)\).

Omega_b_z(z)

Baryon density parameter at a given redshift

Parameters:

z (array) – Redshifts.

Returns:

array with \(\Omega_{b}(z)\).

Omega_cdm_z(z)

Cold dark matter density parameter at a given redshift

Parameters:

z (array) – Redshifts.

Returns:

array with \(\Omega_{cdm}(z)\).

Omega_gamma_z(z)

Photon density parameter at a given redshift.

Parameters:

z (array) – Redshifts.

Returns:

array with \(\Omega_{\gamma}(z)\).

Omega_lambda_z(z)

Dark energy density parameter at a given redshift.

Parameters:

z (array) – Redshifts.

Returns:

array with \(\Omega_{\Lambda}(z)\).

Omega_m_z(z)

Matter density parameter at a given redshift.

Parameters:

z (array) – Redshifts.

Returns:

array with \(\Omega_{m}(z)\).

Omega_nu_z(z)

Neutrino density parameters at a given redshift.

Parameters:

z (array) – Redshifts.

Returns:

array of shape (self.massive_nu, len(z)) containing \(\Omega_\nu(z)\).

Omega_rad_z(z)

Radiation (photons and ultra-relativistic species) density parameter at a given redshift.

Parameters:

z (array) – Redshifts.

Returns:

array with \(\Omega_{\gamma}(z)\).

Omega_ur_z(z)

Density parameter of ultra-relativistic species at a given redshift.

Parameters:

z (array) – Redshifts.

Returns:

array

Omega_wdm_z(z)

WDM density parameters at a given redshift.

Parameters:

z (array) – Redshifts.

Returns:

array of shape (self.N_wdm, len(z)) containing \(\Omega_\nu(z)\).

PressSchechter_bias(sigma)

Eulerian bias for the Press-Schechter mass function as function of the RMS mass fluctuation in spheres \(\sigma(M)\).

Parameters:
  • sigma (array) – RMS mass fluctuation.

  • delta_th (float, default = None) – Threshold for collapse.

Returns:

array

PressSchechter_mass_function(sigma, delta_th=None)

Universal mass function by Press-Schechter as function of the RMS mass fluctuation in spheres \(\sigma(M)\).

Parameters:
  • sigma (array) – RMS mass fluctuation.

  • delta_th (float, default = None) – Threshold for collapse.

Returns:

array

R_bg(z)

Weigthed ratio \(\frac{3 \rho_b}{4 \rho_\gamma}\) as a function of redshift

Parameters:

z (array) – Redshifts.

Returns:

array.

Sharp_k_window(x, step=0.01)

Sharp window function in Fourier space.

Parameters:
  • x (array) – Abscissa.

  • step (float, default = 1e-2) – Transition width from 0 to 1.

Returns:

array.

ShethTormen_bias(sigma, a=0.707, p=0.3, delta_th=None)

Eulerian bias for the Sheth-Tormen mass function as function of the RMS mass fluctuation in spheres \(\sigma(M)\).

Parameters:
  • sigma (array) – RMS mass fluctuation.

  • a – Sheth-Tormen mass function parameter.

  • p (float<0.5, default = 0.3) – Sheth-Tormen mass function parameter.

  • delta_th (float, default = None) – Threshold for collapse.

Returns:

array

ShethTormen_mass_function(sigma, a=0.707, p=0.3, q=1.0, delta_th=1.686470199841145)

Universal mass function by Sheth-Tormen as function of the RMS mass fluctuation in spheres \(\sigma(M)\). Also extended according to Bhattacharya et al., 2011.

Parameters:
  • sigma (array) – RMS mass fluctuation.

  • a (float, default = 0.707) – Sheth-Tormen mass function parameter.

  • p (float<0.5, default = 0.3) – Sheth-Tormen mass function parameter.

  • q (float, default = 1) – Bhattacharya mass function parameter.

  • delta_th' (float, default = None) – Threshold for collapse.

Returns:

array

Smooth_k_window(x, beta)

Smooth window function in Fourier space.

Parameters:
  • x (array) – Abscissa.

  • beta (float, default = 1e-2) – Transition width from 0 to 1.

Returns:

array.

Tinker_bias(sigma, z=0.0, Delta=200.0)

Eulerian bias for the Tinker mass function as function of the RMS mass fluctuation in spheres \(\sigma(M)\).

Parameters:
  • sigma (array) – RMS mass fluctuation.

  • z (array, default = 0) – Redshift.

  • Delta (200<=float<=3200, default = 200) – Overdensity of collapsed objects.

Returns:

array

Tinker_mass_function(sigma, z=0.0, Delta=200.0)

Universal mass function by Tinker as function of the RMS mass fluctuation in spheres \(\sigma(M)\).

Parameters:
  • sigma (array) – RMS mass fluctuation.

  • z (array, default = 0) – Redshift.

  • Delta (200<=float<=3200, default = 200) – Overdensity of collapsed objects.

Returns:

array

TopHat_window(x)

Top-hat window function in Fourier space.

Parameters:

x (array) – Abscissa.

Returns:

array.

WDM_suppression(k, z, M_wdm, nonlinear=False)

Suppression of the matter power spectrum due to (thermal) warm dark matter. In the linear case, the formula by https://arxiv.org/pdf/astro-ph/0501562.pdf is followed; otherwise the formula by https://arxiv.org/pdf/1107.4094.pdf is used. The linear formula is an approximation strictly valid only at \(k < 5-10 \ h/\mathrm{Mpc}\). The nonlinear formula has an accuracy of 2% level at \(z < 3\) and for masses larger than 0.5 keV.

Warning

This function returns the total suppression in power. To obtain the suppression in the transfer function, take the square root of the output.

Parameters:
  • k (array) – Scales in units of \(h/\mathrm{Mpc}\).

  • z (array) – Redshifts.

  • M_wdm (float) – Mass of the warm dark matter particle in keV.

  • nonlinear (boolean, default = False) – Whether to return non-linear transfer function.

Returns:

2D array of shape (len(z), len(k))

X_DE(z)

Dark energy density evolution as function of redshift.

Parameters:

z (array) – Redshifts.

Returns:

array with \(w_{de}(z)\).

age(z=0.0, massive_nu_approx=True)

Cosmic time from Big Bang in \(\mathrm{Myr}\).

Parameters:
  • z (float, default = 0.0) – Redshift.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

float

angular_diameter_distance(z, massive_nu_approx=True)

Angular diameter distance to a given redshift in \(\mathrm{Mpc}/h\).

Parameters:
  • z (array) – Redshifts.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

array.

angular_diameter_distance_interpolation(z)

Angular diameter distance to a given redshift in \(\mathrm{Mpc}/h\). It uses interpolation of H(z), making computation faster for non-trivial cosmologies.

Parameters:

z (array) – Redshifts.

Returns:

array.

c_s(z)

Speed of sound at a given redshift, in km/s. Approximation valid only before recombination, say \(z > 1200\).

Parameters:

z (array) – Redshifts.

Returns:

array.

camb_Pk(z=0.0, k=array([1.00000000e-04, 1.01391139e-04, 1.02801630e-04, ..., 9.72747224e+01, 9.86279486e+01, 1.00000000e+02], shape=(1001,)), nonlinear=False, halofit='mead2020', var_1='tot', var_2='tot', **kwargs)

This routine uses the CAMB Boltzmann solver to return power spectra for the chosen cosmology. Depending on the value of ‘nonlinear’, the power spectrum is linear or non-linear; the ‘halofit’ argument chooses the non-linear model.

Parameters:
  • z (array, default = 0) – Redshifts.

  • k (array, default = np.logspace(-4., 2., 1001)) – Scales in units of \(h/\mathrm{Mpc}\).

  • nonlinear (boolean, default = False) – Whether to return non-linear power spectra.

  • halofit (string, default = 'mead2020') – Which version of Halofit to use. See CAMB documentation for further info.

  • var_1 (string, default = 'tot') – Density field for the first component of the power spectrum.

  • var_2 (string, default = ‘tot’) –

    Density field for the second component of the power spectrum.

    • ’tot’ : total matter

    • ’cdm’ : cold dark matter

    • ’b’ : baryons

    • ’nu’ : neutrinos

    • ’cb’ : cold dark matter + baryons

    • ’gamma’ : photons

    • ’v_cdm’ : cdm velocity

    • ’v_b’ : baryon velocity

    • ’Phi’ : Weyl potential

  • kwargs – Keyword arguments to be passed to camb.set_params. See CAMB documentation for further info: https://camb.readthedocs.io/en/latest/

Returns:

  • k (array) – Scales in \(h/\mathrm{Mpc}\). Basically the same ‘k’ of the input.

  • pk (2D array of shape (len(z), len(k))) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

camb_XPk(z=0.0, k=array([1.00000000e-04, 1.01391139e-04, 1.02801630e-04, ..., 9.72747224e+01, 9.86279486e+01, 1.00000000e+02], shape=(1001,)), nonlinear=False, halofit='mead2020', var_1=['tot'], var_2=['tot'], **kwargs)

The function CAMB_XPk() runs the Python wrapper of CAMB and returns auto- and cross-spectra for all the quantities specified in ‘var_1’ and ‘var_2’. Depending on the value of ‘nonlinear’, the power spectrum is linear or non-linear. It returns scales in units of \(h/\mathrm{Mpc}\) and power spectra in units of (\((\mathrm{Mpc}/h)^3\).

Parameters:
  • z (array, default = 0) – Redshifts.

  • k (array, default = np.logspace(-4., 2., 1001)) – Scales in units of \(h/\mathrm{Mpc}\).

  • nonlinear (boolean, default = False) – Whether to return non-linear power spectra.

  • halofit (string, default = 'mead2020') – Which version of Halofit to use. See CAMB documentation for further info.

  • var_1 (list of strings, default = ['tot']) – Density field for the first component of the power spectrum.

  • var_2 (list of strings, default = ['tot']) –

    Density field for the second component of the power spectrum.

    • ’tot’ : total matter

    • ’cdm’ : cold dark matter

    • ’b’ : baryons

    • ’nu’ : neutrinos

    • ’cb’ : cold dark matter + baryons

    • ’gamma’ : photons

    • ’v_cdm’ : cdm velocity

    • ’v_b’ : baryon velocity

    • ’Phi’ : Weyl potential

  • kwargs – Keyword arguments to be passed to camb.set_params. See CAMB documentation for further info: https://camb.readthedocs.io/en/latest/

Returns:

  • k (array) – Scales in \(h/\mathrm{Mpc}\). Basically the same ‘k’ of the input.

  • pk (dictionary) – Keys are given by ‘var_1-var_2’. Each of these is a 2D array of shape (len(z), len(k)) containing \(P_\mathrm{var_1-var_2}(z,k)\) in units of \((\mathrm{Mpc}/h)^3\).

class_Cl(l_max=3000, lensing=True, do_tensors=True, l_max_tensors=500, r=0.07, **kwargs)

Computation of the CMB angular power spectrum for the chosen cosmology.

Parameters:
  • l_max (integer, default = 3000) – Maximum multipole to compute.

  • lensing (boolean, default = True) – Compute lensed components.

  • do_tensors (boolean, default = True) – Compute tensors components.

  • l_max_tensors (int, default = 3000) – Maximum multipole for computation of tensor components.

  • r (float, default = 0.07) – Tensor-to-scalar ratio.

  • kwargs – Keyword arguments of Class (see the file explanatory.ini in Class for a list of them)

Returns:

  • l (array) – Array of integers that goes from 2 to l_max

  • Cl (dictionary) – Contains the CMB angular power spectrum.

    • ’TT’, ‘TE’, ‘EE’, ‘BB’ are the unlensed components

    • ’TT-lensed’, `’TE-lensed’, ‘EE-lensed’, ‘BB-lensed’ are the lensed components

class_Pk(z=0.0, k=array([1.00000000e-04, 1.01391139e-04, 1.02801630e-04, ..., 9.72747224e+01, 9.86279486e+01, 1.00000000e+02], shape=(1001,)), nonlinear=False, halofit='halofit', **kwargs)

This routine uses CLASS to return power spectra for the chosen cosmology. Depending on the value of ‘nonlinear’, the power spectrum is linear or non-linear.

Parameters:
  • z (array, default = 0) – Redshifts.

  • k (array, default = np.logspace(-4., 2., 1001)) – Scales in units of \(h/\mathrm{Mpc}\).

  • nonlinear (boolean, default = False) – Whether to return non-linear power spectra.

  • kwargs – Keyword arguments of classy.pyx (see the file explanatory.ini in Class or https://github.com/lesgourg/class_public/blob/master/python/classy.pyx)

Returns:

  • k (array) – Scales in \(h/\mathrm{Mpc}\). Basically the same ‘k’ of the input.

  • pk (2D array of shape (len(z), len(k))) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

class_XPk(z=0.0, k=array([1.00000000e-04, 1.01391139e-04, 1.02801630e-04, ..., 9.72747224e+01, 9.86279486e+01, 1.00000000e+02], shape=(1001,)), nonlinear=False, halofit='halofit', var_1=['tot'], var_2=['tot'], **kwargs)

The function class_XPk() runs the Python wrapper of CLASS and returns auto- and cross-spectra for all the quantities specified in ‘var_1’ and ‘var_2’. Depending on the value of ‘nonlinear’, the power spectrum is linear or non-linear. Halofit by Takahashi is empoyed.

Parameters:
  • z (array, default = 0) – Redshifts.

  • k (array, default = np.logspace(-4., 2., 1001)) – Scales in units of \(h/\mathrm{Mpc}\).

  • nonlinear (boolean, default = False) – Whether to return non-linear power spectra.

  • var_1 (list of strings, default = ['tot']) – Density field for the first component of the power spectrum.

  • var_2 (list of strings, default = ['tot']) –

    Density field for the second component of the power spectrum.

    • ’tot’ : total matter

    • ’cdm’ : cold dark matter

    • ’b’ : baryons

    • ’nu’ : massive neutrinos

    • ’ur’ : massless neutrinos

    • ’cb’ : cold dark matter + baryons

    • ’cold’ : cold dark matter + baryons + warm dark matter

    • ’gamma’ : photons

    • ’Phi’ : Weyl potential

    • ’Psi’ : Weyl potential

  • kwargs – Keyword arguments of classy.pyx (see the file explanatory.ini in Class or https://github.com/lesgourg/class_public/blob/master/python/classy.pyx)

Returns:

  • k (array) – Scales in \(h/\mathrm{Mpc}\). Basically the same ‘k’ of the input.

  • pk (dictionary) – Keys are given by ‘var_1-var_2’. Each of these is a 2D array of shape (len(z), len(k)) containing \(P_\mathrm{var_1-var_2}(z,k)\) in units of \((\mathrm{Mpc}/h)^3\).

comoving_distance(z, massive_nu_approx=True)

Comoving distance to a given redshift in \(\mathrm{Mpc}/h\).

Parameters:
  • z (array) – Redshifts.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

array.

comoving_distance_interpolation(z)

Comoving distance to a given redshift in \(\mathrm{Mpc}/h\). It uses an logarithmic interpolation of the Hubble function \(H(z)\) to speed up integration. Tested in the range \(10^{-16}<z<10^{6}\)

Parameters:

z (array) – Redshifts.

Returns:

array.

compute_Gamma_wdm()

Returns the WDM temperature in units of CMB

Returns:

array, same size of WDM species included in the model

compute_sigma_8(k=[], pk=[])

This routine computes \(sigma_8\).

Parameters:
  • k (array, default = []) – Scales in units of \(h/\mathrm{Mpc}\).

  • pk (array, default = []) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

Returns:

float

cosmic_horizon(z=0.0, massive_nu_approx=True)

Cosmological horizon as function of redshift in \(\mathrm{Mpc}/h\).

Parameters:
  • z (float, default = 0.0) – Redshift.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

float

decaying_dark_matter_suppression(k, z, tau, f_ddm)

Suppression of the matter power spectrum due to decaying dark matter (DDM), according to Hubert et al., 2021. It predicts the correct shape at up to \(k>10 h/\mathrm{Mpc}\) and \(z<2.35\).

Warning

This function returns the total suppression in power. To obtain the suppression in the transfer function, take the square root of the output.

Parameters:
  • k (array) – Scales in units of \(h/\mathrm{Mpc}\).

  • z (array) – Redshifts.

  • tau (float) – Half-life time of the particle in Gyr

  • f_ddm (float between 0 and 1) – fraction of DDM.

Returns:

2D array of shape (len(z), len(k))

delta_f_K(z_1, z_2, massive_nu_approx=True)

Difference in geometric factor (distance) between two redshifts in \(\mathrm{Mpc}/h\).

Parameters:
  • z_1 (float) – Redshift number 1.

  • z_2 (float) – Redshift number 2.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

array.

effective_bias(z=0.0, M_min=10000000000.0, M_max=1e+17, k=[], pk=[], mass_fun='ST', **kwargs)

It computes the effective halo bias as

\[b_\mathrm{eff} = \frac{\int_{M_{min}}^{M_{max}} dM \ b(M) \ \frac{dn}{dM}}{\int_{M_{min}}^{M_{max}} dM \ \frac{dn}{dM}}\]

where \(b(M)\) is the linear halo bias given the kind of mass function.

Parameters:
  • z (array, default = 0) – Redshift, used only for Tinker and Crocce mass functions

  • M_min (float>1e2, default = 1e10) – Minimum halo mass in \(M_\odot/h\).

  • M_max (float<1e18, default = 1e17) – Maximum halo mass in \(M_\odot/h\).

  • k (array, default = []) – Scales of power spectrum in units of \(h/\mathrm{Mpc}\).

  • pk (2D array, default = []) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

  • mass_fun (string, default = ‘ST’) –

    Kind of halo mass function.

    • ’Sheth-Tormen’,’ST’,’ShethTormen’ for Sheth-Tormen

    • ’Press-Schechter’, ‘PS’, ‘PressSchechter’ for Press-Schechter

    • ’Tinker’, ‘T’, ‘T08’ for Tinker et al. (2008)

  • kwargs – Keyword arguments to pass to ‘mass_fun’.

Returns:

array, same length as z

fR_correction(k, z, f_R0, nonlinear=True)

Enhancement of the matter power spectrum due to f(R) gravity. The formula used is from Winther et al. (2019)

Warning

This function returns the total suppression in power. To obtain the suppression in the transfer function, take the square root of the output.

Parameters:
  • k (array) – Scales in units of \(h/\mathrm{Mpc}\).

  • z (array) – Redshifts.

  • f_R0 (float) – modified gravity amplitude

  • nonlinear (boolean, default = True) – whether to return the linear or nonlinear enhancement

Returns:

2D array of shape (len(z), len(k))

f_K(z, massive_nu_approx=True)

Geometric factor to a given redshift in \(\mathrm{Mpc}/h\). If \(\chi(z)\) is the comoving distance and \(k\) is the curvature, then

\[ \begin{align}\begin{aligned}f_K(z) =\left\{\begin{array}{ll} \chi(z) & \text{for } K=0 \\\ \frac{1}{\sqrt{K}} \ \sin[\sqrt{K}\chi(z)] & \text{for } K>0\\ \frac{1}{\sqrt{|K|}} \ \sinh[\sqrt{|K|}\chi(z)] & \text{for } K<0\\ \end{array}.\right.\end{aligned}\end{align} \]
Parameters:
  • z (array) – Redshifts.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

array.

f_K_interpolation(z)

Geometric factor to a given redshift in \(\mathrm{Mpc}/h\). It uses interpolation of H(z), making computation faster for non-trivial cosmologies. If \(\chi(z)\) is the comoving distance and \(k\) is the curvature, then

\[ \begin{align}\begin{aligned}f_K(z) =\left\{\begin{array}{ll} \chi(z) & \text{for } K=0 \\\ \frac{1}{\sqrt{K}} \ \sin[\sqrt{K}\chi(z)] & \text{for } K>0\\ \frac{1}{\sqrt{|K|}} \ \sinh[\sqrt{|K|}\chi(z)] & \text{for } K<0\\ \end{array}.\right.\end{aligned}\end{align} \]
Parameters:

z (array) – Redshifts.

Returns:

array.

feedback_suppression(k, z, log_Mc, eta_b, z_c)

Suppression of the matter power spectrum according to the Baryon Correction Model (Schneider et al., 2015).

Parameters:
  • k (array) – Scales in units of \(h/\mathrm{Mpc}\).

  • z (array) – Redshifts.

  • log_Mc (float>12.1) – Feedback mass: all halos below the mass of 10.**log_Mc are stripped of their gas.

  • eta_b (float) – Ratio between the thermal velocity of the gas and the escape velocity from the halo.

  • z_c (float) – Scale redshift of feedback.

Returns:

2D array of shape (len(z), len(k))

growth_cb_unnormalized(k, z)

Non normalized scale-dependent growth factor for cdm+baryons. See colibri.cosmology.cosmo.growth_factor_CDM_baryons() for further information

growth_cbnu_unnormalized(k, z)

Unnormalized scale-dependent growth factor for matter. See colibri.cosmology.cosmo.growth_factor_CDM_baryons() for further information

growth_factor_CDM_baryons(k, z)

Cold dark matter + baryon scale-dependent growth factor at a given redshift, normalized to 1 today.

Parameters:
  • k (array) – Scales in units of \(h/\mathrm{Mpc}\).

  • z (array) – Redshifts.

Returns:

2D array of shape (len(z), len(k))

growth_factor_CDM_baryons_neutrinos(k, z)

Total matter (i.e. cold dark matter + baryon + neutrino) scale-dependent growth factor at a given redshift, normalized to 1 today.

Parameters:
  • k (array) – Scales in units of \(h/\mathrm{Mpc}\).

  • z (array) – Redshifts.

Returns:

2D array of shape (len(z), len(k))

growth_factor_scale_independent(z)

Scale-independent total matter growth factor for a LCDM cosmology at a given redshift, normalized to 1 today.

Parameters:

z (array) – Redshifts.

Returns:

array

halo_bias(sigma, mass_fun='ST', **kwargs)

Eulerian bias for the a given halo mass function as function of the RMS mass fluctuation in spheres \(\sigma(M)\).

Parameters:
  • sigma (array) – RMS mass fluctuation.

  • mass_fun (string, default = ‘ST’) –

    Kind of halo mass function.

    • ’Sheth-Tormen’,’ST’,’ShethTormen’ for Sheth-Tormen

    • ’Press-Schechter’, ‘PS’, ‘PressSchechter’ for Press-Schechter

    • ’Tinker’, ‘T’, ‘T08’ for Tinker et al. (2008)

  • kwargs – Keyword arguments to pass to ‘mass_fun’.

Returns:

array

halo_mass_function(logM, z=0.0, k=[], pk=[], window='th', mass_fun='Sheth-Tormen', beta=2.0, prop_const=2.5, **kwargs)

Halo mass function, i.e. number of halos per unit volume per unit mass.

Parameters:
  • logM (array) – logarithm (base 10!) of the masses at which to compute the variance, in units of \(M_\odot/h\). To compute these masses from radii, use colibri.cosmology.cosmo.mass_in_radius().

  • z (array, default = 0) – Redshift, used only if Tinker or MICE/Crocce mass functions are requested. Must be of same length as pk.

  • k (array, default = []) – Scales of power spectrum in units of \(h/\mathrm{Mpc}\).

  • pk (array, default = []) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

  • window (string, default = 'th') –

    Window function used to filter.

    • ’th’,`’th’,’tophat’,’top-hat’` for top-hat filter

    • ’gauss’, ‘Gaussian’, ‘Gauss’, ‘gaussian’, ‘g’, for Gaussian

    • ’sharp’, ‘heaviside’, ‘s’ for sharp-k filter

    • ’smooth’, ‘smoothk’, ‘sm’ for smooth-k filter

  • mass_fun (string, default = ‘ST’) –

    Kind of halo mass function.

    • ’Sheth-Tormen’,’ST’,’ShethTormen’ for Sheth-Tormen

    • ’Press-Schechter’, ‘PS’, ‘PressSchechter’ for Press-Schechter

    • ’Despali’, ‘D’ for Despali et al. (2015)

    • ’Tinker’, ‘T’, ‘T08’ for Tinker et al. (2008)

    • ’MICE’, ‘Crocce’, ‘C’ for Crocce et al. (2010)

  • beta (float, default = 2) – slope of the smooth-k window (used only if window==smooth)

  • prop_const (float, default = 2.5.) – proportional constant of radius to mass (used only if window==sharp)

  • kwargs – Keyword arguments to pass to ‘mass_fun’.

Returns:

2D array containing \(\frac{dn}{dM}\) in \(h^4 \ \mathrm{Mpc}^{-3} \ M_\odot^{-1}\)

isotropic_volume_distance(z, massive_nu_approx=True)

Isotropic volume distance to a given redshift in \(\mathrm{Mpc}/h\).

Parameters:
  • z (array) – Redshifts.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

array.

k_FS(z)

Massive neutrino free-streaming scale in \(h/\mathrm{Mpc}\).

Parameters:

z (array) – Redshifts.

Returns:

array, size of number of massive neutrinos

k_eq()

Scale corresponding to epoch of equality (peak of matter power spectrum) in \(h/\mathrm{Mpc}\).

Returns:

float.

l_to_k(l, z, massive_nu_approx=True)

Conversion factor from multipoles to scales given the redshift

Parameters:
  • l (array) – Multipoles

  • z (array) – Redshifts.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

array.

lagrange_to_euler(z=0.0, delta_v=None, delta_c=None)

Mapping between Eulerian and Lagrangian radii in \(\mathrm{Mpc}/h\).

Parameters:
  • z (float) – Redshift

  • delta_v (float) – Critical underdensity in linear theory.

  • delta_c (float) – Critical overdensity in linear theory.

Returns:

array.

lookback_time(z=1.0)

Cosmic time from today to a given redshift in Myr.

Parameters:
  • z (float, default = 1.0) – Redshift.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

float

luminosity_distance(z, massive_nu_approx=True)

Luminosity distance to a given redshift in \(\mathrm{Mpc}/h\).

Parameters:
  • z (array) – Redshifts.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

array.

luminosity_distance_interpolation(z)

Luminosity distance to a given redshift in \(\mathrm{Mpc}/h\). It uses interpolation of H(z), making computation faster for non-trivial cosmologies.

Parameters:

z (array) – Redshifts.

Returns:

array.

mass_in_radius(R, var='cb', window='th', prop_const=2.5)

Mass contained in a sphere of radius R in \(M_\odot/h\).

Parameters:
  • R (array) – Radii in \(\mathrm{Mpc}/h\).

  • var (string, default = 'cb') –

    component with respect to which to compute the variance.

    • ’cb’ : cold dark matter + baryons

    • ’cdm’ : cold dark matter

    • ’cold’: cold dark matter + baryons + warm dark matter

    • ’b’ : baryons

    • ’nu’ : neutrinos

    • ’tot’ : total matter

  • window (string, default = 'th') –

    Window function used to filter.

    • ’th’,`’th’,’tophat’,’top-hat’` for top-hat filter

    • ’gauss’, ‘Gaussian’, ‘Gauss’, ‘gaussian’, ‘g’, for Gaussian

    • ’sharp’, ‘heaviside’, ‘s’ for sharp-k filter

    • ’smooth’, ‘smoothk’, ‘sm’ for smooth-k filter

  • prop_const (float, default = 2.5.) – proportional constant of radius to mass (used only if window==sharp)

Returns:

array.

mass_variance(logM, k=[], pk=[], var='cb', window='th', **kwargs)

Mass variance in spheres as a function of mass.

Parameters:
  • logM (array) – logarithm (base 10!) of the masses at which to compute the variance, in units of \(M_\odot/h\). To compute these masses from radii, use colibri.cosmology.cosmo.mass_in_radius()

  • k (array, default = []) – Scales of power spectrum in units of \(h/\mathrm{Mpc}\).

  • pk (2D array, one for each redshift, default = []) – Power spectrum in redshifts and scales in units of \((\mathrm{Mpc}/h)^3\).

  • var (string, default = 'cb') –

    component with respect to which to compute the variance.

    • ’cb’ : cold dark matter + baryons

    • ’cdm’: cold dark matter

    • ’b’ : baryons

    • ’nu’ : neutrinos

    • ’tot’: total matter

  • window (string, default = 'th') –

    Window function used to filter.

    • ’th’,`’th’,’tophat’,’top-hat’` for top-hat filter

    • ’gauss’, ‘Gaussian’, ‘Gauss’, ‘gaussian’, ‘g’, for Gaussian

    • ’sharp’, ‘heaviside’, ‘s’ for sharp-k filter

Returns:

An interpolated function that gives \(\sigma^2(\log_{10}(M))\), evaluable between 2 and 18 (therefore between \(M = 10^2\) and \(10^{18} \ M_\odot/h\)).

mass_variance_multipoles(logM, k=[], pk=[], var='tot', window='th', j=0, beta=2.0, **kwargs)

Multipoles of the mass variance as function of mass, namely:

\[\sigma^2_j(M) = \int_0^\infty \frac{dk \ k^{2+2j}}{2\pi^2} P(k) \ W^2[kR(M)],\]

where \(W\) is a window function, \(R\) is a radius in \(\mathrm{Mpc}/h\) and \(M\) is the mass enclosed in such radius according to the window function.

Parameters:
  • logM (array) – logarithm (base 10!) of the masses at which to compute the variance, in units of \(M_\odot/h\). To compute these masses from radii, use colibri.cosmology.cosmo.mass_in_radius()

  • k (array, default = []) – Scales of power spectrum in units of \(h/\mathrm{Mpc}\).

  • pk (2D array, one for each redshift, default = []) – Power spectrum in redshifts and scales in units of \((\mathrm{Mpc}/h)^3\).

  • var (string, default = 'tot') –

    component with respect to which to compute the variance.

    • ’cb’ : cold dark matter + baryons

    • ’cold’: cold dark matter + baryons + warm dark matter

    • ’cdm’ : cold dark matter

    • ’b’ : baryons

    • ’nu’ : neutrinos

    • ’tot’ : total matter

  • window (string, default = 'th') –

    Window function used to filter.

    • ’th’,`’th’,’tophat’,’top-hat’` for top-hat filter

    • ’gauss’, ‘Gaussian’, ‘Gauss’, ‘gaussian’, ‘g’, for Gaussian

    • ’sharp’, ‘heaviside’, ‘s’ for sharp-k filter

    • ’smooth’, ‘smoothk’, ‘sm’ for smooth-k filter

  • beta (float, default = 2) – slope of the smooth-k window (used only if window==smooth)

  • j (even integer, default = 0) – Order of multipole.

Returns:

2D array containing \(\sigma^2_j(\log_{10}M,z)\)

neutrino_thermal_velocity(z)

Thermal velocity in km/s of each neutrino species at a given redshift. Approximation valid only at \(z \ll z_\mathrm{nr}\)

Parameters:

z (array) – Redshifts.

Returns:

array.

normalize_Pk(k, pk, new_sigma8)

This routine normalizes the input power spectrum to the required \(sigma_8\).

Parameters:
  • k (array, default = []) – Scales in units of \(h/\mathrm{Mpc}\).

  • pk (array, default = []) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

  • new_sigma_8 – Value to which normalize.

Returns:

array of normalized power spectrum in \((\mathrm{Mpc}/h)^3\).

particle_mass_in_simulation(L, N, kind='cb')

Mass of a single particle (in \(M_\odot/h\)) in a simulation box, given the length L of the box itself (in \(\mathrm{Mpc}/h\)) and the number of particles N per side.

Parameters:
  • L (array) – Boxsize in \(\mathrm{Mpc}/h\).

  • N (array) – Number of particles per side.

  • kind (string, default = ‘cb’) –

    • ‘cb’ : cold dark matter + baryons

    • ’cdm’: cold dark matter

    • ’b’ : baryons

    • ’nu’ : neutrinos

    • ’tot’: total matter

Returns:

2D array of shape (len(N), len(L))

peak_height(logM, k=[], pk=[])

Peak height as a function of log10(M).

Parameters:
  • logM (array) – logarithm (base 10!) of the masses at which to compute the variance, in units of \(M_\odot/h\). To compute these masses from radii, use colibri.cosmology.cosmo.mass_in_radius()

  • k (array, default = []) – Scales of power spectrum in units of \(h/\mathrm{Mpc}\).

  • pk (2D array, one for each redshift, default = []) – Power spectrum in redshifts and scales in units of \((\mathrm{Mpc}/h)^3\).

Returns:

2D array containing \(\delta_c/\sigma(\log_{10}M,z)\)

q_acc(z)

Acceleration parameter at a given redshift.

Parameters:

z (array) – Redshifts.

Returns:

array.

radius_of_mass(M, var='cb', window='th', prop_const=2.5)

Radius that contains a certain amount of mass in \(\mathrm{Mpc}/h\).

Parameters:
  • M (array) – Masses in \(M_\odot/h\).

  • var (string, default = 'cb') –

    component with respect to which to compute the variance.

    • ’cb’ : cold dark matter + baryons

    • ’cdm’ : cold dark matter

    • ’cold’: cold dark matter + baryons + warm dark matter

    • ’b’ : baryons

    • ’nu’ : neutrinos

    • ’tot’ : total matter

  • window (string, default = 'th') –

    Window function used to filter.

    • ’th’,`’th’,’tophat’,’top-hat’` for top-hat filter

    • ’gauss’, ‘Gaussian’, ‘Gauss’, ‘gaussian’, ‘g’, for Gaussian

    • ’sharp’, ‘heaviside’, ‘s’ for sharp-k filter

    • ’smooth’, ‘smoothk’, ‘sm’ for smooth-k filter

  • prop_const (float, default = 2.5.) – proportional constant of radius to mass (used only if window==sharp)

Returns:

array.

redshift(a=1.0)

Returns the redshift given the scale factor.

Parameters:

a (float, default = 1.0) – Scale factor.

Returns:

float

remove_bao(k_in, pk_in, k_low=0.028, k_high=0.45)

This routine removes the BAOs from the input power spectrum and returns the no-wiggle power spectrum in \((\mathrm{Mpc}/h)^3\). Originally written by Mario Ballardini (you can find it in the montepython repository . )

Parameters:
  • k_in (array) – Scales in units of \(h/\mathrm{Mpc}\).

  • pk_in (array) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

  • k_low (float, default = 2.8e-2) – Lowest scale to spline in \(h/\mathrm{Mpc}\).

  • k_high (float, default = 4.5e-1) – Highest scale to spline in \(h/\mathrm{Mpc}\).

Returns:

array, power spectrum without BAO.

remove_bao_gaussian_filtering(k, pk, Lambda=0.25)

This routine removes the BAOs from the input power spectrum and returns the no-wiggle power spectrum in \((\mathrm{Mpc}/h)^3\). Adapted from Andrea Oddo’s PBJ libraries

Parameters:
  • k (array) – Scales in units of \(h/\mathrm{Mpc}\).

  • pk (array) – Power spectrum in units of \((\mathrm{Mpc}/h)^3\).

  • Lambda (float, default = 0.25) – Smoothing scale in \(h/\mathrm{Mpc}\).

Returns:

array, power spectrum without BAO.

rho(z)

Matter density of the Universe at a given redshift in units of \(h^2 M_\odot \mathrm{Mpc}^{-3}\).

Parameters:

z (array) – Redshifts.

Returns:

array.

rho_crit(z)

Critical density of the Universe at a given redshift in units of \(h^2 M_\odot \mathrm{Mpc}^{-3}\).

Parameters:

z (array) – Redshifts.

Returns:

array.

scale_factor(z=0.0)

Returns the scale factor given the redshift.

Parameters:

z (float, default = 0.0) – Redshift.

Returns:

float

sound_horizon_Class()

Sound horizon at drag epoch in units of Mpc/h.

Returns:

float.

sound_horizon_EH()

Sound horizon at drag epoch according to Eisenstein & Hu approximation

Returns:

float.

sound_horizon_approx()

Sound horizon at drag epoch according to arXiv:2106.00428 approximation

Returns:

float.

thermal_velocity(z, M_X, Omega_X, g_X=1.5, stat='FD')

Thermal velocity in km/s of a given dark matter particle. Approximation valid only at \(z \ll z_\mathrm{nr}\)

Parameters:
  • z (array) – Redshifts.

  • M_X (float) – dark matter mass in keV.

  • Omega_X (float) – dark matter density parameter.

  • g_X (float, default = 1.5) – Spin multiplicity of the species.

  • stat (string, default = 'FD') – Whether the particle is a fermion (i.e. following a Fermi-Dirac statistics) or a boson (Bose-Einstein statistics). Accepted values are FD for the former and BE for the latter.

Returns:

array.

v_rec(z, massive_nu_approx=True)

Recession velocity of galaxies at a given redshift in km/s.

Parameters:
  • z (array) – Redshifts.

  • massive_nu_approx (boolean, default = True) – Whether to use self.H_massive() or self.H() to compute Hubble expansion, i.e. whether to consider massive neutrinos as matter (great speed-up).

Returns:

array.

void_size_function(R, z, k, pk, model, Delta_NL, delta_c=None, **kwargs)

This routine returns the void size function, i.e. the number of voids per unit volume per unit radius, following three different recipes which can all be found listed in Jennings, Li, Hu (2013).

Parameters:
  • R (array) – (Eulerian) radii of voids, in \(\mathrm{Mpc}/h\).

  • z (array) – Redshifts.

  • k (array) – Scales of power spectrum in units of \(h/\mathrm{Mpc}\).

  • pk (2D array, first dimension must match len(z)) – Power spectrum in redshifts and scales in units of \((\mathrm{Mpc}/h)^3\).

  • model (string) – Model to use, choose among ‘linear’, ‘SvdW’, ‘Vdn’

  • Delta_NL (float between 0 and -1) – Critical (non-linear) underdensity for collapse of voids.

  • delta_c (float, default None) – Critical overdensity for collapse. If None the standard value 1.686 is used

  • kwargs – keyword arguments

Returns:

  • R (2D array) – Lagrangian radii corresponding, at each redshift, to the comoving ones in input.

  • VSF (2D array) – Containing \(\frac{dn}{d\ln R}\) in \(h^3 \ \mathrm{Mpc}^{-3}\)

void_size_function_EST(R, z, k, pk, delta_v=None, a=1.0, p=0.0)

This routine returns the void size function, i.e. the number of voids per unit volume per unit (Lagrangian) radius, according ot the Excursion Set of Troughs theory. It returns two 2D arrays containing the Lagrangian radii as function of redshift and the void size function in units of \((h/\mathrm{Mpc})^4\).

Parameters:
  • R (array) – (Eulerian) radii of voids, in \(\mathrm{Mpc}/h\).

  • z (array) – Redshifts.

  • k (array) – Scales of power spectrum in units of \(h/\mathrm{Mpc}\).

  • pk (2D array, first dimension must match len(z)) – Power spectrum in redshifts and scales in units of \((\mathrm{Mpc}/h)^3\).

  • delta_v (float, default = None) – Critical underdensity in linear theory. If None, it is substituted by -1.76.

  • a (float) – Sheth-Tormen-like parameter

  • p (float) – Sheth-Tormen-like parameter

Returns:

  • RL (2D array) – Lagrangian radii corresponding, at each redshift, to the comoving ones in input.

  • dndR (2D array) – Containing \(\frac{dn}{dR}\) in \(h^4 \ \mathrm{Mpc}^{-4}\)

volume_of_mass(M, var='cb', window='th', prop_const=2.5)

Volume of a window function of a given mass in \((\mathrm{Mpc}/h)^3\).

Parameters:
  • M (array) – Masses in \(M_\odot/h\).

  • var (string, default = 'cb') –

    component with respect to which to compute the variance.

    • ’cb’ : cold dark matter + baryons

    • ’cdm’ : cold dark matter

    • ’cold’: cold dark matter + baryons + warm dark matter

    • ’b’ : baryons

    • ’nu’ : neutrinos

    • ’tot’ : total matter

  • window (string, default = 'th') –

    Window function used to filter.

    • ’th’,`’th’,’tophat’,’top-hat’` for top-hat filter

    • ’gauss’, ‘Gaussian’, ‘Gauss’, ‘gaussian’, ‘g’, for Gaussian

    • ’sharp’, ‘heaviside’, ‘s’ for sharp-k filter

    • ’smooth’, ‘smoothk’, ‘sm’ for smooth-k filter

  • prop_const (float, default = 2.5.) – proportional constant of radius to mass (used only if window==sharp)

Returns:

array.

volume_of_radius(R, window='th', prop_const=2.5)

Volume of a window function of a given radius in \((\mathrm{Mpc}/h)^3\).

Parameters:
  • R (array) – Radii in \(\mathrm{Mpc}/h\).

  • var (string, default = 'cb') –

    component with respect to which to compute the variance.

    • ’cb’ : cold dark matter + baryons

    • ’cdm’ : cold dark matter

    • ’cold’: cold dark matter + baryons + warm dark matter

    • ’b’ : baryons

    • ’nu’ : neutrinos

    • ’tot’ : total matter

  • window (string, default = 'th') –

    Window function used to filter.

    • ’th’,`’th’,’tophat’,’top-hat’` for top-hat filter

    • ’gauss’, ‘Gaussian’, ‘Gauss’, ‘gaussian’, ‘g’, for Gaussian

    • ’sharp’, ‘heaviside’, ‘s’ for sharp-k filter

    • ’smooth’, ‘smoothk’, ‘sm’ for smooth-k filter

  • prop_const (float, default = 2.5.) – proportional constant of radius to mass (used only if window==sharp)

Returns:

array.

w_DE(z)

Dark energy parameter of state as function of redshift.

Parameters:

z (array) – Redshifts.

Returns:

array with \(w_{de}(z)\).

z_drag()

Drag epoch redshift according to arXiv:2106.00428 approximation

Returns:

float.

z_drag_EH()

Drag epoch redshift according to Eisenstein & Hu approximation

Returns:

float.

z_eq()

Redshift at which radiation and matter had the same density.

Returns:

float.

z_rec_EH()

Drag epoch redshift according to Eisenstein & Hu approximation

Returns:

float.

z_rec_approx()

Decoupling redshift according to arXiv:2106.00428 approximation

Returns:

float.