The halo model

class colibri.halo.halo(z, k, code='camb', BAO_smearing=False, cosmology=<colibri.cosmology.cosmo object>)

The class halo computes the non-linear power spectrum in the halo model and useful quantities related to it, such as mass functions, densities of virialized objects and concentration parameters. For a review, see arXiv:0206508 .

Parameters:
  • z (array) – Redshifts.

  • k (array) – Array of scales in \(h/\mathrm{Mpc}\).

  • code (string, default = ‘camb’) – Boltzmann solver to compute the linear power spectrum. Choose among ‘camb’, ‘class’, ‘eh’ (for Eisenstein-Hu). N.B. If Eisenstein-Hu is selected, effects of massive neutrinos and evolving dark energy cannot be accounted for, as such spectrum is a good approximation for LCDM cosmologies only.

  • BAO_smearing (boolean, default = False) – Whether to damp the BAO feature due to non-linearities.

  • cosmology (cosmo instance, default = cosmology.cosmo()) – Fixes the cosmological parameters. If not declared, the default values are chosen (see colibri.cosmology.cosmo() documentation).

Returns:

The initialization automatically computes the linear matter power spectrum. After initialization, the following quantities will be available:

  • self.k_ext (array) - Extended array of scales spanning \(10^{-6} - 10^8 \ h/\mathrm{Mpc}\).

  • self.pk_ext (2D array) - Extended power spectra of shape (len(z), len(k_ext)) in units of \((\mathrm{Mpc}/h)^3\).

  • self.mass (array np.logspace(2., 18., 512)) - Array of masses in \(M_\odot/h\) at which some quantities will be evaluated.

  • self.Pk (dictionary) - The only keys available after initialization are

    • self.Pk['matter']['linear']: 2D array of shape (len(z), len(k)) containing the linear matter power spectra in \((\mathrm{Mpc}/h)^3\).

    • self.Pk['matter']['no-wiggle']: 2D array of shape (len(z), len(k)) containing the no-wiggle linear matter power spectra in \((\mathrm{Mpc}/h)^3\). It is an array of zeros if BAO_smearing is False.

    • self.Pk['matter']['de-wiggled']: 2D array of shape (len(z), len(k)) containing the de-wiggled linear matter power spectra in \((\mathrm{Mpc}/h)^3\). It is an array of zeros if BAO_smearing is False.

Delta_v(z)

Overdensity of a virialized halo

Parameters:

z (array, default = 0) – Redshifts.

Returns:

array

M_star()

This routine computes the typical halo mass at redshift z = 0. This is defined as the mass for which \(\nu = \frac{1.686}{\sigma(z=0,M)} = 1\). Result in \(M_\odot/h\).

R_s(M, kwargs_concentration={})

Scale radius of a halo given the mass in Msun/h.

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

  • kwargs_concentration (dictionary, default = {}) – Keyword arguments to pass to colibri.halo.halo.conc().

Returns:

array of size len(M) in Mpc/h

R_v(M)

Virial radius of a halo, in units of \(\mathrm{Mpc}/h\).

Parameters:

M (array) – Masses in \(M_\odot/h\)

Returns:

array of size len(M)

conc(M, c0=9.0, b=0.13)

This parameter enters in the Fourier transform of the NFW profile. It is defined as the ratio between the virial radius of the halo and the scale radius that appears in the definition of the NFW density profile in configuration space. The concentration parameter has been shown to follow a log-normal distribution with mean

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

  • c0 (float) – Normalization of concentration parameter formula.

  • b (float) – Slope of concentration parameter formula. N.B. Notice that the actual exponent in the formula is -b.

Returns:

array of size len(M)

halo_Pk(kwargs_mass_function={}, kwargs_concentration={})

It returns the halo power spectrum split in the 1-halo and 2-halo terms.

\[P^{(1h)}(k) = \int_0^\infty dM \ \frac{M^2}{\bar{\rho}^2} \ \frac{dn}{dM} \ u^2(k,M)\]
\[P^{(2h)}(k) = \left[ \int_0^\infty dM \ \frac{M}{\bar{\rho}} \frac{dn}{dM} \ b(M) \ u(k,M) \right]^2 P_{lin}(k)\]
Parameters:
Returns:

Nothing, but the following keys are added to the self.Pk dictionary

  • ['matter']['1-halo'] (2D array of shape (len(z), len(k)) ) - 1-halo term of the matter power spectrum

  • ['matter']['2-halo'] (2D array of shape (len(z), len(k)) ) - 2-halo term of the matter power spectrum

  • ['matter']['total halo'] (2D array of shape (len(z), len(k)) ) - Sum of 1-halo and 2-halo terms.

halo_bias_ST(nu, a=0.707, p=0.3)

This routine returns the linear Sheth-Tormen halo bias.

Parameters:
  • nu (array) – Peak height.

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

  • p (array, default = 0.3) – Sheth-Tormen parameter.

Returns:

2D array containing \(b_\nu^{ST}(z,\nu)\), where redshifts are given in the initialization.

load_Pk()

Loads the linear power spectrum with the code specified in initialization. The result is extrapolated to k_ext.

Returns:

Nothing, but it creates (or overwrites) the keys ['matter']['linear'], ['matter']['no-wiggle'], ['matter']['no-wiggle'] in the self.Pk dictionary

load_halo_mass_function(**kwargs)

This routine returns the halo mass function at the points specified by the array self.mass in the initialization.

Parameters:

kwargs – Keyword arguments to pass to colibri.halo.halo.mass_fun_ST().

Returns:

2D array containing the halo mass function in units of \(h^4 \ \mathrm{Mpc}^{-3} \ M_\odot^{-1}.\) Its shape is (len(z), len(M), where M = self.mass and redshifts are given in the initialization.

mass_fun_ST(nu, a=0.707, p=0.3)

This routine returns the universal mass function by Sheth-Tormen as function of the peak height.

Parameters:
  • nu (array) – Peak height.

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

  • p (array, default = 0.3) – Sheth-Tormen parameter.

Returns:

2D array containing \(f_\nu^{ST}(z,\nu)\), where redshifts are given in the initialization.

norm_2h(bias, **kwargs)

Normalization to the 2-halo term (due to integration effects).

Parameters:

kwargs – Keyword arguments to pass to colibri.halo.halo.mass_fun_ST().

Returns:

array of size len(z)

nu()

Peak height, i.e. \(1.686/\sigma(z,M)\).

Returns:

D array containing \(\nu(z,M)\), where M = self.mass and redshifts are given in the initialization.

sigma2()

Mass variance in spheres, evaluated at the masses of the initialization which are transforms into radii.

Returns:

2D array containing \(\sigma^2(z,M)\), where M = self.mass and redshifts are given in the initialization.

smoothing_radius(M)

Radius containing a mass \(M\)

Parameters:

M (array) – Masses in \(M_\odot/h\)

Returns:

array

u_NFW(c, x)

It returns the Navarro-Frenk-White (NFW) profile in Fourier space, normalized such that its integral is equal to unity.

Parameters:
  • x (array) – Abscissa.

  • c (float) – Concentration parameter.

Returns:

array of size len(x)

Halo Occupation Distribution

class colibri.galaxy.galaxy(z, k, code='camb', BAO_smearing=False, cosmology=<colibri.cosmology.cosmo object>)[source]

The galaxy class inherits all the functions from colibri.halo.halo() and has the final goal to compute the galaxy power spectrum in the Halo Occupation Distribution (HOD) prescription. As such, the class contains some routies to compute the average number of central/ satellite galaxies per halo. The call of a galaxy instance takes the following arguments:

Parameters:
  • z (array) – Redshifts.

  • k (array) – Array of scales in \(h/\mathrm{Mpc}\).

  • code (string, default = ‘camb’) – Boltzmann solver to compute the linear power spectrum. Choose among ‘camb’, ‘class’, ‘eh’ (for Eisenstein-Hu). N.B. If Eisenstein-Hu is selected, effects of massive neutrinos and evolving dark energy cannot be accounted for, as such spectrum is a good approximation for LCDM cosmologies only.

  • BAO_smearing (boolean, default = True) – Whether to damp the BAO feature due to non-linearities.

  • cosmology (cosmo instance, default = cosmology.cosmo()) – Fixes the cosmological parameters. If not declared, the default values are chosen (see colibri.cosmology.cosmo() documentation).

Returns:

The initialization automatically calls a halo instance (see colibri.halo.halo()) and therefore all the quantities described there are also available here. Also, the key ['galaxies']['real space'] is added to the self.Pk dictionary.

logistic_function(M, log_Mmin, sigma_logM)[source]

Example function of HOD for central galaxies in a halo of mass M. A step-like function with a transition region of a certain width.

\[N_{cen}(M) = \frac{1}{2} \left[1+\mathrm{erf}\left(\frac{\log M - \log M_{min}}{\sigma_{\log M}}\right)\right]\]
Parameters:
  • M (array) – Masses in \(M_\odot/h\)

  • log_Mmin (float) – Mass for which the probability of having a central galaxy in a halo of a certain mass is 1/2.

  • sigma_logM (float) – Width of the transition from 0 to 1 central galaxy in a halo.

Returns:

array

step_function(M, logMmin)[source]

Example function of HOD for central galaxies in a halo of mass M: a step function.

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

  • log_Mmin (float) – Mass for which the probability of having a central galaxy in a halo of a certain mass is 1/2.

Returns:

array

power_law(M, log_Mcut, log_M1, alpha)[source]

Typical HOD for satellite galaxies. A power-law with a cutoff here is used.

\[N_{sat}(M) = \left(\frac{M-M_{cut}}{M_1}\right)^\alpha\]
Parameters:
  • M (array) – Masses in \(M_\odot/h\)

  • log_Mcut (float) – Cutoff mass below which there are no satellite galaxies.

  • log_M1 (float) – Scale mass for satellite galaxies in a halo.

  • alpha (float) – Exponent of the power law.

Returns:

array

power_law_step(M, log_M1, alpha)[source]

Typical HOD for satellite galaxies. No low-mass cutoff is used.

\[N_{sat}(M) = \left(\frac{M}{M_1}\right)^\alpha\]
Parameters:
  • M (array) – Masses in \(M_\odot/h\)

  • log_M1 (float) – Scale mass for satellite galaxies in a halo.

  • alpha (float) – Exponent of the power law.

Returns:

array

load_HOD(kind_central=None, kind_satellite=None, kwargs_central={}, kwargs_satellite={})[source]

This method loads the number of central and satellite galaxies for every redshift. It is an essential ingredient of the halo model for galaxies. One can load it here or while calling the colibri.galaxy.galaxy.galaxy_Pk() function.

Parameters:
  • kind_central (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_central.

  • kind_satellite (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_satellite.

  • kwargs_central (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

  • kwargs_satellite (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

Returns:

Nothing, but it loads the quantities:

  • self.Ncen (array) - Number of central galaxies evaluated at self.mass

  • self.Nsat (array) - Number of satellite galaxies evaluated at self.mass

  • self.Ntot (array) - Number of total galaxies evaluated at self.mass.

N.B. To avoid having satellite galaxies in halos which do not have a central, the number of total galaxies is computed in the following way:

\[N_{tot}(M) = N_{cen}(M) \left(1+N_{sat}(M)\right)\]
average_galaxy_density(**kwargs)[source]

Average number of galaxies given a HOD model at all the redshifts required. This function can be called only after having called colibri.galaxy.galaxy.load_HOD().

Parameters:

kwargs – Keyword arguments to pass to colibri.halo.halo.mass_fun_ST()

Returns:

array of shape len(z) in units of \(h^3 \mathrm{Mpc}^{-3}\)

galaxy_Pk(kind_central=None, kwargs_central={}, kind_satellite=None, kwargs_satellite={}, kwargs_mass_function={}, kwargs_concentration={})[source]

It computes the galaxy power spectrum in the HOD prescription along with the 1-halo and 2-halo terms.

\[P_g^{(1h)}(k) = \frac{1}{\bar{n_g}^2} \int_0^\infty dM \ \frac{dn}{dM} \ \left[2 \ N_{cen}(M) \ N_{sat}(M) \ u(k|M) + N_{sat}^2(M) \ u^2(k,M)\right]\]
\[P_g^{(2h)}(k) = \left[\frac{1}{\bar{n_g}} \int_0^\infty dM \ \frac{dn}{dM} \ b(M) \ N_{tot}(M) \ u(k,M) \right]^2 P_{lin}(k)\]
Parameters:
  • kind_central (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_central.

  • kind_satellite (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_satellite.

  • kwargs_central (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

  • kwargs_satellite (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

  • kwargs_mass_function (dictionary, default = {}) – Keyword arguments to pass to colibri.halo.halo.mass_fun_ST().

  • kwargs_concentration (dictionary, default = {}) – Keyword arguments to pass to colibri.halo.halo.conc().

Returns:

Nothing, but the following keys are added to the self.Pk dictionary

  • ['galaxies']['real space']['1-halo'] (2D array of shape (len(z), len(k)) ) - 1-halo term of the matter power spectrum

  • ['galaxies']['real space']['2-halo'] (2D array of shape (len(z), len(k)) ) - 2-halo term of the matter power spectrum

  • ['galaxies']['real space']['total halo'] (2D array of shape (len(z), len(k)) ) - Sum of 1-halo and 2-halo terms.

Redshift-space distortions

class colibri.RSD.RSD(z, k, mu, k_par, k_perp, code='camb', BAO_smearing=False, cosmology=<colibri.cosmology.cosmo object>)

The RSD class inherits all the functions from the colibri.galaxy.galaxy() class and therefore from the colibri.halo.halo() one. It computes the galaxy redshift-space power spectrum in the Halo Occupation Distribution (HOD) prescription through the Kaiser effect and the dispersion model (both Gaussian and Lorentzian damping functions are provided). This can be done in multipole space (with Legendre expansion), in the (\(k_\parallel, k_\perp\)) space and also in the (\(k,\mu\)) space.

There are 4 models which can be used to compute the power spectrum, tarting from the (\(k,\mu\)) case

  • linear: the linear matter power spectrum is used as a base

\[P_g^{(s)}(k,\mu) = \left(b+f\mu^2\right)^2 \ P_{lin}(k) \ \mathcal D(k\mu\sigma_v)\]
  • non-linear: the non-linear matter power spectrum is used (with Halofit) as a base

\[P_g^{(s)}(k,\mu) = \left(b+f\mu^2\right)^2 \ P_{nl}(k) \ \mathcal D(k\mu\sigma_v)\]
  • HOD: the galaxy power spectrum in real space is used (with HOD) as a base

\[P_g^{(s)}(k,\mu) = \left(1+\beta\mu^2\right)^2 \ P_g^{(HOD)}(k) \ \mathcal D(k\mu\sigma_v)\]
  • halo model: the galaxy power spectrum in redshift space is computed directly from HOD, with the damping functions which are applied directly to halo profiles.

Parameters:
  • z (array) – Redshifts.

  • k (array) – Array of scales in \(h/\mathrm{Mpc}\).

  • mu (array) – Cosines of angle between k and the line-of-sight.

  • k_par (array) – Array of scales in \(h/\mathrm{Mpc}\).

  • k_perp (array) – Array of scales in \(h/\mathrm{Mpc}\).

  • code (string, default = ‘camb’) – Boltzmann solver to compute the linear power spectrum. Choose among ‘camb’, ‘class’, ‘eh’ (for Eisenstein-Hu). N.B. If Eisenstein-Hu is selected, effects of massive neutrinos and evolving dark energy cannot be accounted for, as such spectrum is a good approximation for LCDM cosmologies only.

  • BAO_smearing (boolean, default = True) – Whether to damp the BAO feature due to non-linearities.

  • cosmology (cosmo instance, default = cosmology.cosmo()) – Fixes the cosmological parameters. If not declared, the default values are chosen (see colibri.cosmology.cosmo() documentation).

Returns:

The initialization automatically calls a galaxy instance (see colibri.galaxy.galaxy()) and therefore all the quantities described there are also available here. Also, the key ['galaxies']['redshift space'] is added to the self.Pk dictionary.

damping(x, kind='Lorentzian')

Damping in power spectrum due to random motions of galaxies inside halos.

Parameters:
  • x (array) – Abscissa.

  • kind (string, default = Lorentzian) – Kind of damping function, choose between Gaussian and Lorentzian.

Returns:

array

galaxy_RSD_Pk(model='nonlinear', bias=1.0, growth_rate=0.5, velocity_dispersion=300.0, fingers_of_god='Lorentzian', kind_central=None, kwargs_central={}, kind_satellite=None, kwargs_satellite={}, kwargs_mass_function={}, kwargs_concentration={})

Galaxy power spectrum in redshift-space as function of (\(k,\mu\))

Parameters:
  • model (string, default = nonlinear) –

    Model of computation of the power spectrum. Accepted values are:

    • [linear, Linear, lin, l, L] for the linear power spectrum

    • [non-linear’, `nonlinear, NL, nl] for the non-linear power spectrum (with Halofit)

    • [HOD, hod] to use the HOD for the galaxy real-space power spectrum,

    • [halomodel, halo model, halo, H] to compute directly the halo model redshift-space power spectrum.

  • bias (array of size len(z), default = 1.) – Array of galaxy biases (used only if linear or non-linear models are used).

  • growth_rate (array of size len(z), default = 0.5) – Array of growth rates, \(f = \frac{d\ln D}{d\ln a}\).

  • velocity_dispersion (array of size len(z), default = 300.) – Array of average velocity dispersion of galaxies in halos, in \(km/s\).

  • fingers_of_god (string, default = 'Lorentzian') – Kind of damping function, choose between ‘Gaussian’ and ‘Lorentzian’.

  • kind_central (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_central.

  • kind_satellite (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_satellite.

  • kwargs_central (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

  • kwargs_satellite (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

  • kwargs_mass_function (dictionary, default = {}) – Keyword arguments to pass to colibri.halo.halo.mass_fun_ST().

  • kwargs_concentration (dictionary, default = {}) – Keyword arguments to pass to colibri.halo.halo.conc().

Returns:

Nothing, but the following keys are added to the self.Pk dictionary

  • ['galaxies']['redshift space']['k-mu'] (3D array of shape (len(z), len(k), len(mu)) ) - 1-halo term of the matter power spectrum

galaxy_RSD_Pk_2D(model='nonlinear', bias=1.0, growth_rate=0.5, velocity_dispersion=300.0, fingers_of_god='Lorentzian', kind_central=None, kwargs_central={}, kind_satellite=None, kwargs_satellite={}, kwargs_mass_function={}, kwargs_concentration={})

Galaxy power spectrum multipoles in redshift-space as function of wavevectors parallel and perpendicular to the line of sight.

Parameters:
  • model (string, default = nonlinear) –

    Model of computation of the power spectrum. Accepted values are:

    • [linear, Linear, lin, l, L] for the linear power spectrum

    • [non-linear’, `nonlinear, NL, nl] for the non-linear power spectrum (with Halofit)

    • [HOD, hod] to use the HOD for the galaxy real-space power spectrum,

    • [halomodel, halo model, halo, H] to compute directly the halo model redshift-space power spectrum.

  • bias (array of size len(z), default = 1.) – Array of galaxy biases (used only if linear or non-linear models are used).

  • growth_rate (array of size len(z), default = 0.5) – Array of growth rates, \(f = \frac{d\ln D}{d\ln a}\).

  • velocity_dispersion (array of size len(z), default = 300.) – Array of average velocity dispersion of galaxies in halos, in \(km/s\).

  • fingers_of_god (string, default = 'Lorentzian') – Kind of damping function, choose between ‘Gaussian’ and ‘Lorentzian’.

  • kind_central (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_central.

  • kind_satellite (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_satellite.

  • kwargs_central (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

  • kwargs_satellite (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

  • kwargs_mass_function (dictionary, default = {}) – Keyword arguments to pass to colibri.halo.halo.mass_fun_ST().

  • kwargs_concentration (dictionary, default = {}) – Keyword arguments to pass to colibri.halo.halo.conc().

Returns:

Nothing, but the following keys are added to the self.Pk dictionary

  • ['galaxies']['redshift space']['k_par-k_perp'] (3D array of shape (len(z), len(k_par), len(k_perp)) ) - 1-halo term of the matter power spectrum

galaxy_RSD_Pk_multipoles(l=[0, 2, 4], model='nonlinear', bias=1.0, growth_rate=0.5, velocity_dispersion=300.0, fingers_of_god='Lorentzian', kind_central=None, kwargs_central={}, kind_satellite=None, kwargs_satellite={}, kwargs_mass_function={}, kwargs_concentration={})

Galaxy power spectrum multipoles in redshift-space as function of k

Parameters:
  • l (list/array of integers, default = [0,2,4]) – List of multipoles to compute.

  • model (string, default = nonlinear) –

    Model of computation of the power spectrum. Accepted values are:

    • [linear, Linear, lin, l, L] for the linear power spectrum

    • [non-linear’, `nonlinear, NL, nl] for the non-linear power spectrum (with Halofit)

    • [HOD, hod] to use the HOD for the galaxy real-space power spectrum,

    • [halomodel, halo model, halo, H] to compute directly the halo model redshift-space power spectrum.

  • bias (array of size len(z), default = 1.) – Array of galaxy biases (used only if linear or non-linear models are used).

  • growth_rate (array of size len(z), default = 0.5) – Array of growth rates, \(f = \frac{d\ln D}{d\ln a}\).

  • velocity_dispersion (array of size len(z), default = 300.) – Array of average velocity dispersion of galaxies in halos, in \(km/s\).

  • fingers_of_god (string, default = 'Lorentzian') – Kind of damping function, choose between ‘Gaussian’ and ‘Lorentzian’.

  • kind_central (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_central.

  • kind_satellite (callable, default = None) – First argument must be mass (in \(M_\odot/h\)), other specified by kwargs_satellite.

  • kwargs_central (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

  • kwargs_satellite (dictionary) – Every key is a keyword parameter for the galaxy distribution and each value is a list of length equal to the size of the redshift required.

  • kwargs_mass_function (dictionary, default = {}) – Keyword arguments to pass to colibri.halo.halo.mass_fun_ST().

  • kwargs_concentration (dictionary, default = {}) – Keyword arguments to pass to colibri.halo.halo.conc().

Returns:

Nothing, but the key ['galaxies']['redshift space']['multipoles'] is added to the self.Pk dictionary. This in turn is a new dictionary whose keys are ['number of multiple']. Each of these new keys is a 2D array of shape (len(z), len(k))