Theory#

This module compute some theoretical quantities.

pyexshalos.theory.CLPT_Powers(k: ndarray, P: ndarray, Lambda: float = 0.7, kmax: float = 0.7, nmin: int = 5, nmax: int = 10, verbose: bool = False) Dict[str, ndarray]#

Compute the power spectra of the operators using Convolution Lagrangian Perturbation Theory (CLPT).

Parameters:
  • k (numpy.ndarray) – Wavenumber of the power spectrum.

  • P (numpy.ndarray) – Linear power spectrum.

  • Lambda (float) – Scale to be used to smooth the power spectrum. Fiducial value: 0.7

  • kmax (float) – Maximum wavenumber of the outputs. Fiducial value: 0.7

  • nmin (int) – Minimum order used in the full computation of the terms of the expansion. Fiducial value: 5

  • nmax (int) – Maximum order used in the Limber approximation of the terms of the expansion. Fiducial value: 10

  • verbose (bool) – Whether to output information in the C code. Fiducial value: False

Returns:

Dictionary with the power spectra of the operators:

  • ”k”: Ndarray with the wavenumbers

  • ”Plin”: Ndarray with linear power spectrum used as input

  • ”P11”: Ndarray with result for the 11 power spectrum

Return type:

dict

pyexshalos.theory.Compute_sigma(k: ndarray, P: ndarray, R: ndarray | None = None, M: ndarray | None = None, Om0: float = 0.31, z: float = 0.0) ndarray#

Compute the variance of the density field.

Parameters:
  • k (numpy.ndarray) – Wavenumbers of the power spectrum.

  • P (numpy.ndarray) – Power spectrum.

  • R (Optional[numpy.ndarray]) – Smoothing radius (used to compute the mass). Fiducial value: None

  • M (Optional[numpy.ndarray]) – Mass. Fiducial value: None

  • Om0 (float) – Omega matter at z=0 (used to compute the mass). Fiducial value: 0.31

  • z (float) – Redshift. Fiducial value: 0.0

Returns:

Variance of the density field on the given scales.

Return type:

numpy.ndarray

pyexshalos.theory.Get_Dz(Om0: float = 0.31, zmax: float = 1000, zmin: float = -0.5, nzs: int = 1000) Dict[str, ndarray]#

Compute the growth function over a range of redshifts.

Parameters:
  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

  • zmax (float) – Maximum redshift to consider. Fiducial value: 1000

  • zmin (float) – Minimum redshift to consider. Fiducial value: -0.5

  • nzs (int) – Number of redshift steps. Fiducial value: 1000

Returns:

Dictionary with the keys

  • ”z”: Ndarray with redshifts

= “a”: Ndarray with scale factors - “Dz” Ndarray with growth factors - “dDz”: Ndarray with derivatives of the growth factor

Return type:

dict

pyexshalos.theory.Get_Ha(a: float = 1.0, Om0: float = 0.31) float#

Return the Hubble function, in units of 100*h, at a given scale factor.

Parameters:
  • a (float) – Scale factor. Fiducial value: 1.0

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

Returns:

Hubble function in units of 100*h at scale factor a.

Return type:

float

pyexshalos.theory.Get_Hz(z: float = 0.0, Om0: float = 0.31) float#

Return the Hubble function, in units of 100*h, at a given redshift.

Parameters:
  • z (float) – Redshift. Fiducial value: 0.0

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

Returns:

Hubble function in units of 100*h at redshift z.

Return type:

float

pyexshalos.theory.Get_Lc(Om0: float = 0.31, Mcell: float = 85000000000.0) float#

Get the size of each cell given its mass.

Parameters:
  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

  • Mcell (float) – Mass of the cell in units of solar masses per h. Fiducial value: 8.5e+10

Returns:

Size of the cell in Mpc/h.

Return type:

float

pyexshalos.theory.Get_Mcell(Om0: float = 0.31, Lc: float = 2.0) float#

Compute the mass of a cell in the density grid.

Parameters:
  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

  • Lc (float) – Size of each cell in Mpc/h. Fiducial value: 2.0

Returns:

Mass of the cell in units of solar masses per h.

Return type:

float

pyexshalos.theory.Get_Omz(z: float = 0.0, Om0: float = 0.31) float#

Return the value of the matter overdensity at a given redshift.

Parameters:
  • z (float) – Redshift. Fiducial value: 0.0

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

Returns:

Matter overdensity at redshift z.

Return type:

float

pyexshalos.theory.Get_bh1(M: ndarray, s: ndarray | None = None, model: int | str = 'PS', theta: float | ndarray | None = None, delta_c: float | None = None, Om0: float = 0.31, z: float = 0.0, k: ndarray | None = None, P: ndarray | None = None, Lagrangian: bool = False) ndarray#

Compute the first-order halo bias (b1).

Parameters:
  • M (numpy.ndarray) – Mass array.

  • s (Optional[numpy.ndarray]) – Variance of the linear density field. Fiducial value: None

  • model (Union[int, str]) – HMF model to use (0: Press-Schechter, 1: Sheth-Tormen, 2: Tinker, 3: Linear Diffusive Barrier). Can also be a string identifier (“PS”, “ST”, “Tinker”, “2LDB”). Fiducial value: None

  • theta (Optional[Union[float, np.ndarray]]) – Model parameters. For Sheth-Tormen: [a, b, p], for Tinker: Delta, for Linear Diffusive Barrier: [b, D, dv, J_max].

  • delta_c (Optional[float]) – Critical density for collapse. Fiducial value: None

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

  • z (float) – Redshift. Fiducial value: 0.0

  • k (Optional[numpy.ndarray]) – Wavenumbers of the power spectrum (required if s is None). Fiducial value: None

  • P (Optional[numpy.ndarray]) – Power spectrum (required if s is none). Fiducial value: None

  • Lagrangian (bool) – Whether to compute the Lagrangian bias.

Returns:

First-order halo bias (b1).

Return type:

numpy.ndarray

pyexshalos.theory.Get_bh2(M: ndarray, s: ndarray | None = None, model: int | str = 'PS', theta: float | ndarray | None = None, delta_c: float | None = None, Om0: float = 0.31, z: float = 0.0, k: ndarray | None = None, P: ndarray | None = None, Lagrangian: bool = False, b1: ndarray | None = None) ndarray#

Compute the second-order halo bias (b2).

Parameters:
  • M (numpy.ndarray) – Mass array.

  • s (Optional[numpy.ndarray]) – Variance of the density field. Fiducial value: None

  • model (Union[int, str]) – HMF model to use (0: Press-Schechter, 1: Sheth-Tormen, 2: Matteo, 3: Lazeyras). Can also be a string identifier (“PS”, “ST”, “Matteo”, “Lazeyras”). Fiducial value: “PS”

  • theta (Optional[Union[float, np.ndarray]]) – Model parameters. For Sheth-Tormen: [a, b, p], for Matteo: b1, for Lazeyras: b1.

  • delta_c (Optional[float]) – Critical density for collapse. Fiducial value: None

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

  • z (float) – Redshift. Fiducial value: 0.0

  • k (Optional[numpy.ndarray]) – Wavenumbers of the power spectrum (required if s is None). Fiducial value: None

  • P (Optional[numpy.ndarray]) – Power spectrum (required if s is None). Fiducial value: None

  • Lagrangian (bool) – Whether to compute the Lagrangian bias.

  • b1 (Optional[numpy.ndarray]) – First-order halo bias (used in Matteo’s and Lazeyras’s models). Fiducial value: None

Returns:

Array containing the second-order halo bias values (b2).

Return type:

numpy.ndarray

pyexshalos.theory.Get_bh3(M: ndarray, s: ndarray | None = None, model: int | str = 'PS', theta: float | ndarray | None = None, delta_c: float | None = None, Om0: float = 0.31, z: float = 0.0, k: ndarray | None = None, P: ndarray | None = None, Lagrangian: bool = False, bs2: float = 0.0) ndarray#

Compute the third-order halo bias (b3).

Parameters:
  • M (numpy.ndarray) – Mass array.

  • s (Optional[numpy.ndarray]) – Variance of the density field. Fiducial value: None

  • model (Union[int, str]) – HMF model to use (0: Press-Schechter, 1: Sheth-Tormen). Can also be a string identifier (“PS”, “ST”). Fiducial value: “PS”

  • theta (Optional[Union[float, np.ndarray]]) – Model parameters. For Sheth-Tormen: [a, b, p].

  • delta_c (Optional[float]) – Critical density for collapse. Fiducial value: None

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

  • z (float) – Redshift. Fiducial value: 0.0

  • k (Optional[numpy.ndarray]) – Wavenumbers of the power spectrum (required if s is None). Fiducial value: None

  • P (Optional[numpy.ndarray]) – Power spectrum (required if s is None). Fiducial value: None

  • Lagrangian (bool) – Whether to compute the Lagrangian bias.

  • bs2 (float) – Second-order halo bias. Fiducial value: 0.0

Returns:

Array containing the third-order halo bias values (b3).

Return type:

numpy.ndarray

pyexshalos.theory.Get_dHa(a: float = 1.0, Om0: float = 0.31) float#

Return the derivative of the Hubble’s function, with respect to a in units of 100*h, at a given scale factor.

Parameters:
  • a (float) – Scale factor. Fiducial value: 1.0

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

Returns:

Derivative of the Hubble’s function in units of 100*h at scale factor a.

Return type:

float

pyexshalos.theory.Get_deltac(z: float = 0.0, Om0: float = 0.31) float#

Return the value of delta_c (matter density contrast for halo formation) following a fit.

Parameters:
  • z (float) – Redshift. Fiducial value: 0.0

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

Returns:

Value of delta_c at redshift z.

Return type:

float

pyexshalos.theory.Get_dndlnm(M: ndarray, sigma: ndarray | None = None, model: int | str = 'PS', theta: float | ndarray | None = None, delta_c: float | None = None, Om0: float = 0.31, z: float = 0.0, k: ndarray | None = None, P: ndarray | None = None) ndarray#

Compute the logarithmic derivative of the halo mass function with respect to mass.

Parameters:
  • M (numpy.ndarray) – Mass array.

  • sigma (Optional[numpy.ndarray]) – Variance of the density field. Fiducial value: None

  • model (Union[int, str]) – HMF model to use (0: Press-Schechter, 1: Sheth-Tormen, 2: Tinker, 3: Linear Diffusive Barrier). Can also be a string identifier (“PS”, “ST”, “Tinker”, “2LDB”). Fiducial value: “PS”

  • theta (Optional[Union[float, np.ndarray]]) – Model parameters. For Sheth-Tormen: [a, b, p], for Tinker: Delta, for Linear Diffusive Barrier: [b, D, dv, J_max].

  • delta_c (Optional[float]) – Critical density for collapse. Fiducial value: None

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

  • z (float) – Redshift. Fiducial value: 0.0

  • k (Optional[numpy.ndarray]) – Wavenumbers of the power spectrum (required if sigma is None). Fiducial value: None

  • P (Optional[numpy.ndarray]) – Power spectrum (required if sigma is None). Fiducial value: None

Returns:

Halo mass function.

Return type:

numpy.ndarray

pyexshalos.theory.Get_fz(z: float = 0.0, Om0: float = 0.31) float#

Return the growth rate at a given redshift.

Parameters:
  • z (float) – Redshift. Fiducial value: 0.0

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

Returns:

Growth rate at redshift z.

Return type:

float

pyexshalos.theory.Growth_eq(y: Tuple[float, float], a: float, Om0: float = 0.31) ndarray#

Define the system of differential equations used to compute the growth function.

Parameters:
  • y (tuple of float) – Tuple containing the density contrast (d) and its derivative (v).

  • a (float) – Scale factor. Fiducial value.

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

Returns:

Array containing the derivatives of density contrast and its velocity.

Return type:

numpy.ndarray

pyexshalos.theory.Pgg_EFTofLSS(k: ndarray | None = None, parameters: Dict[str, float] = {}, b: ndarray | None = None, cs: ndarray | None = None, c: ndarray | None = None, IR_resummation: bool = True, cb: bool = True, RSD: bool = True, AP: bool = False, Om_fid: float = 0.31, z: float = 0.0, ls: List[int] | int = [0, 2, 4], pk_mult: ndarray | None = None, fz: float | None = None, OUT_MULT: bool = False, h_units: bool = True, vectorized: bool = False) Dict[str, ndarray]#

Compute the 1-loop matter or galaxy power spectrum using classPT.

Parameters:
  • k (Optional[numpy.ndarray]) – Wavenumbers of the power spectrum (need to run CLASS-PT). Fiducial value: None

  • parameters (dict) – Cosmological parameters used by CLASS. Fiducial value: {}

  • b (Optional[numpy.ndarray]) – Values of the bias parameters (b1, b2, bG2, bGamma3, b4). Fiducial value: None

  • cs (Optional[numpy.ndarray]) – Values of the stochastic parameters. 1D or 2D (multitracers) array. Fiducial value: None

  • c (Optional[numpy.ndarray]) – Values of the counterterms. 1D or 2D (multitracers) array. Fiducial value: None

  • IR_resummation (bool) – Option to do the IR resummation of the spectrum. Fiducial value: True

  • cb (bool) – Option to add baryons. Fiducial value: True

  • RSD (bool) – Option to give the power spectrum in redshift space. Fiducial value: True

  • AP (bool) – Option to use the Alcock-Paczynski (AP) effect. Fiducial value: False

  • Om_fid (float) – Omega matter fiducial for the AP correction. Fiducial value: 0.31

  • z (float) – Redshift of the power spectrum. Fiducial value: 0.0

  • ls (Union[List[int], int]) – The multipoles to be computed [0, 2, 4]. List or int.

  • pk_mult (Optional[numpy.ndarray]) – Multipoles of the power spectrum (don’t need CLASS-PT). Fiducial value: None

  • fz (Optional[float]) – Growth rate at redshift z. Fiducial value: None

  • OUT_MULT (bool) – Whether output multipoles. Fiducial value: False

  • h_units (bool) – Whether to use h-units. Fiducial value: True

  • vectorized (bool) – Whether to use vectorized operations. Fiducial value: False

Returns:

Dictionary with the computed power spectra and additional information.

Return type:

dict

pyexshalos.theory.Wth(k: ndarray, R: float) ndarray#

Compute the top-hat window function in Fourier space.

Parameters:
  • k (numpy.ndarray) – Wavenumber.

  • R (float) – Smoothing radius.

Returns:

Window function value.

Return type:

np.ndarray

pyexshalos.theory.Xi_lm(r: ndarray, k: ndarray, P: ndarray, Lambda: float = 0.7, l: int = 0, mk: int = 2, mr: int = 0, K: int = 11, alpha: float = 4.0, Rmax: float = 1.0, verbose: bool = False) ndarray#

Compute the generalized correlation functions (Xi_lm).

Parameters:
  • r (numpy.ndarray) – Radial distances for the output.

  • k (numpy.ndarray) – Wavenumber of the power spectrum.

  • P (numpy.ndarray) – Linear power spectrum.

  • Lambda (float) – Scale to be used to smooth the power spectrum. Fiducial value: 0.7

  • l (int) – Order of the spherical Bessel’s function. Fiducial value: 0

  • mk (int) – Power of k in the integral. Fiducial value: 2

  • mr (int) – Power of r in the integral. Fiducial value: 0

  • K (int) – Number of points used by the Gaussian smooth. Fiducial value: 11

  • alpha (float) – Value of alpha used by the Gaussian smooth. Fiducial value: 4.0

  • Rmax (float) – Maximum radius for the smoothing. Fiducial value: 1.0

  • verbose (bool) – Whether to output information in the C code. Fiducial value: False

Returns:

The generalized correlation function :math: ‘xi_{lm} = int dk k^{mk} r^{mr} P(k) j_l(kr)’.

Return type:

numpy.ndarray

pyexshalos.theory.dlnsdlnm(M: ndarray, sigma: ndarray) ndarray#

Compute the derivative of the logarithm of sigma with respect to the logarithm of mass using finite differences.

Parameters:
  • M (numpy.ndarray) – Mass array.

  • sigma (numpy.ndarray) – Variance array.

Returns:

Array containing the derivatives of ln(sigma) with respect to ln(M).

Return type:

numpy.ndarray

pyexshalos.theory.fh(s: ndarray, model: int | str = 'PS', theta: float | ndarray | None = None, delta_c: float | None = None, Om0: float = 0.31, z: float = 0.0) ndarray#

Compute the halo mass function (HMF) based on different models.

Parameters:
  • s (numpy.ndarray) – Variance of the density field.

  • model (Union[int, str]) – HMF model to use (0: Press-Schechter, 1: Sheth-Tormen, 2: Tinker, 3: Linear Diffusive Barrier). Can also be a string identifier (“PS”, “ST”, “Tinker”, “2LDB”). Fiducial value: “PS”

  • theta (Optional[Union[float, np.ndarray]]) – Model parameters. For Sheth-Tormen: [a, b, p], for Tinker: Delta, for Linear Diffusive Barrier: [b, D, dv, J_max].

  • delta_c (Optional[float]) – Critical density for collapse. Fiducial value: None

  • Om0 (float) – Omega matter at z=0. Fiducial value: 0.31

  • z (float) – Redshift. Fiducial value: 0.0

Returns:

Array containing the multiplicity function.

Return type:

numpy.ndarray