pyccl.halos.halo_model module

class pyccl.halos.halo_model.HMCalculator(self, *, mass_function, halo_bias, mass_def=None, log10M_min=8.0, log10M_max=16.0, nM=128, integration_method_M='simpson')[source]

Bases: CCLAutoRepr

This class implements a set of methods that can be used to compute various halo model quantities. A lot of these quantities will involve integrals of the sort:

\[\int dM\,n(M,a)\,f(M,k,a),\]

where \(n(M,a)\) is the halo mass function, and \(f\) is an arbitrary function of mass, scale factor and Fourier scales.

Parameters:
  • mass_function (str or MassFunc) – the mass function to use

  • halo_bias (str or HaloBias) – the halo bias function to use

  • mass_def (str or MassDef) – the halo mass definition to use

  • log10M_min (float) – lower bound of the mass integration range (base-10 logarithmic).

  • log10M_max (float) – lower bound of the mass integration range (base-10 logarithmic).

  • nM (int) – number of uniformly-spaced samples in \(\log_{10}(M)\) to be used in the mass integrals.

  • integration_method_M (str) – integration method to use in the mass integrals. Options: “simpson” and “spline”.

integrate_over_massfunc(func, cosmo, a)[source]

Returns the integral over mass of a given funcion times the mass function:

\[\int dM\,n(M,a)\,f(M)\]
Parameters:
  • func (callable) – a function accepting an array of halo masses as a single argument, and returning an array of the same size.

  • cosmo (Cosmology) – a Cosmology object.

  • a (float) – scale factor.

Returns:

integral value.

Return type:

float

number_counts(cosmo, *, selection, a_min=None, a_max=1.0, na=128)[source]

Solves the integral:

\[nc(sel) = \int dM\int da\,\frac{dV}{dad\Omega}\, n(M,a)\,sel(M,a)\]

where \(n(M,a)\) is the halo mass function, and \(sel(M,a)\) is the selection function as a function of halo mass and scale factor.

Note that the selection function is normalized to integrate to unity and assumed to represent the selection probaility per unit scale factor and per unit mass.

Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • selection (callable) – function of mass and scale factor that returns the selection function. This function should take in floats or arrays with a signature sel(m, a) and return an array with shape (len(m), len(a)) according to the numpy broadcasting rules.

  • a_min (float) – the minimum scale factor at which to start integrals over the selection function. Default: value of cosmo.cosmo.spline_params.A_SPLINE_MIN

  • a_max (float) – the maximum scale factor at which to end integrals over the selection function.

  • na (int) – number of samples in scale factor to be used in the integrals.

Returns:

the total number of clusters/halos.

Return type:

float

I_0_1(cosmo, k, a, prof)[source]

Solves the integral:

\[I^0_1(k,a|u) = \int dM\,n(M,a)\,\langle u(k,a|M)\rangle,\]

where \(n(M,a)\) is the halo mass function, and \(\langle u(k,a|M)\rangle\) is the halo profile as a function of scale, scale factor and halo mass.

Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • k (float or array) – comoving wavenumber.

  • a (float) – scale factor.

  • prof (HaloProfile) – halo profile.

Returns:

integral values evaluated at each value of k.

Return type:

(float or array)

I_1_1(cosmo, k, a, prof)[source]

Solves the integral:

\[I^1_1(k,a|u) = \int dM\,n(M,a)\,b(M,a)\, \langle u(k,a|M)\rangle,\]

where \(n(M,a)\) is the halo mass function, \(b(M,a)\) is the halo bias, and \(\langle u(k,a|M)\rangle\) is the halo profile as a function of scale, scale factor and halo mass.

Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • k (float or array) – comoving wavenumber.

  • a (float) – scale factor.

  • prof (HaloProfile) – halo profile.

Returns:

integral values evaluated at each value of k.

Return type:

(float or array)

I_1_3(cosmo, k, a, prof, *, prof2=None, prof_2pt, prof3=None)[source]

Solves the integral:

\[I^1_3(k,a|u_2, v_1, v_2) = \int dM\,n(M,a)\,b(M,a)\, \langle u_2(k,a|M) v_1(k',a|M) v_2(k',a|M)\rangle,\]

where we approximate

\[\langle u_2(k,a|M) v_1(k',a|M) v_2(k', a|M)\rangle \sim \langle u_2(k,a|M)\rangle \langle v_1(k',a|M) v_2(k', a|M)\rangle,\]

where \(n(M,a)\) is the halo mass function, \(b(M,a)\) is the halo bias, and \(\langle u_2(k,a|M) v_1(k',a|M) v_2(k',a|M)\rangle\) is the 3pt halo profile as a function of scales k and k’, scale factor and halo mass.

Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • k (float or array) – comoving wavenumber.

  • a (float) – scale factor.

  • prof (HaloProfile) – halo profile.

Returns:

integral values evaluated at each value of k. Its shape will be (N_k, N_k), with N_k the size of the k array.

Return type:

(float or array)

I_0_2(cosmo, k, a, prof, *, prof2=None, prof_2pt)[source]

Solves the integral:

\[I^0_2(k,a|u,v) = \int dM\,n(M,a)\, \langle u(k,a|M) v(k,a|M)\rangle,\]

where \(n(M,a)\) is the halo mass function, and \(\langle u(k,a|M) v(k,a|M)\rangle\) is the two-point moment of the two halo profiles.

Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • k (float or array) – comoving wavenumber.

  • a (float) – scale factor.

  • prof (HaloProfile) – halo profile.

  • prof2 (HaloProfile) – a second halo profile. If None, prof will be used as prof2.

  • prof_2pt (Profile2pt) – a profile covariance object returning the the two-point moment of the two profiles being correlated.

Returns:

integral values evaluated at each value of k.

Return type:

(float or array)

I_1_2(cosmo, k, a, prof, *, prof2=None, prof_2pt, diag=True)[source]

Solves the integral:

\[I^1_2(k,a|u,v) = \int dM\,n(M,a)\,b(M,a)\, \langle u(k,a|M) v(k,a|M)\rangle,\]

where \(n(M,a)\) is the halo mass function, \(b(M,a)\) is the halo bias, and \(\langle u(k,a|M) v(k,a|M)\rangle\) is the two-point moment of the two halo profiles.

Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • k (float or array) – comoving wavenumber.

  • a (float) – scale factor.

  • prof (HaloProfile) – halo profile.

  • prof2 (HaloProfile) – a second halo profile. If None, prof will be used as prof2.

  • prof_2pt (Profile2pt) – a profile covariance object returning the the two-point moment of the two profiles being correlated.

  • diag (bool) – If True, both halo profiles depend on the same k. If False, they will depend on k and k’, respectively. Default True.

Returns:

integral values evaluated at each value of k. If diag is True, the output will be a 1D-array; 2D-array, otherwise.

Return type:

(float or array)

I_0_22(cosmo, k, a, prof, *, prof2=None, prof3=None, prof4=None, prof12_2pt, prof34_2pt=None)[source]

Solves the integral:

\[I^0_{2,2}(k_u,k_v,a|u_{1,2},v_{1,2}) = \int dM\,n(M,a)\, \langle u_1(k_u,a|M) u_2(k_u,a|M)\rangle \langle v_1(k_v,a|M) v_2(k_v,a|M)\rangle,\]

where \(n(M,a)\) is the halo mass function, and \(\langle u(k,a|M) v(k,a|M)\rangle\) is the two-point moment of the two halo profiles.

Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • k (float or array) – comoving wavenumber.

  • a (float) – scale factor.

  • prof (HaloProfile) – halo profile.

  • prof2 (HaloProfile) – a second halo profile. If None, prof will be used as prof2.

  • prof3 (HaloProfile) – a third halo profile. If None, prof will be used as prof3.

  • prof4 (HaloProfile) – a fourth halo profile. If None, prof2 will be used as prof4.

  • prof12_2pt (Profile2pt) – a profile covariance object returning the the two-point moment of prof and prof2.

  • prof34_2pt (Profile2pt) – a profile covariance object returning the the two-point moment of prof3 and prof4. If None, prof12_2pt will be used.

Returns:

integral values evaluated at each value of k.

Return type:

(float or array)