pyccl.halos.profiles.profile_base module

class pyccl.halos.profiles.profile_base.HaloProfile(self, *, mass_def, concentration=None, is_number_counts=False)[source]

Bases: CCLAutoRepr

This class implements functionality associated to halo profiles. You should not use this class directly. Instead, use one of the subclasses implemented in CCL for specific halo profiles, or write your own subclass. HaloProfile classes contain methods to compute halo profiles in real (3D) and Fourier spaces, as well as other projected (2D) quantities.

A minimal implementation of a HaloProfile subclass should contain a method _real that returns the real-space profile as a function of cosmology, comoving radius, mass and scale factor. The default functionality in the base HaloProfile class will then allow the automatic calculation of the Fourier-space and projected profiles, as well as the cumulative mass density, based on the real-space profile using FFTLog to carry out fast Hankel transforms. See the CCL note for details. Alternatively, you can implement a _fourier method for the Fourier-space profile, and all other quantities will be computed from it. It is also possible to implement specific versions of any of these quantities if one wants to avoid the FFTLog calculation.

property is_number_counts

If True, this profile represents source-count overdensities, normalised by the mean number density within their survey window function. This must be propagated when estimated super-sample effects in the covariance matrix.

get_normalization(cosmo=None, a=None, *, hmc=None)[source]

Profiles may be normalized by an overall function of redshift (or scale factor). This function may be cosmology-dependent and often comes from integrating certain halo properties over mass. This method returns this normalizing factor. For example, to get the normalized profile in real space, one would call the real() method, and then divide the result by the value returned by this method.

Parameters:
Returns:

normalization factor of this profile.

Return type:

float

update_precision_fftlog(**kwargs)

Update the precision of FFTLog for the Hankel transforms.

Parameters:
  • padding_lo_fftlog (float) – Factor by which the minimum scale is multiplied to avoid aliasing. Default: 0.1.

  • padding_hi_fftlog (float) – Factor by which the maximum scale is multiplied to avoid aliasing. Default: 10.

  • n_per_decade (float) – Samples per decade for the Hankel transforms. Default: 100.

  • extrapol ({'linx_liny', 'linx_logy'}) – Extrapolation type when FFTLog has narrower output support. Default 'linx_liny'.

  • padding_lo_extra (float) – Additional minimum scale padding for double Hankel transforms, used when computing 2D projected and cumulative profiles. In these, the first transform goes from 3D real space to Fourier, and the second transform goes from Fourier to 2D real space. Default: 0.1.

  • padding_hi_extra (float) – As padding_lo_extra for the maximum scale. Default: 10.

  • large_padding_2D (bool) – Override padding_xx_extra in the intermediate transform, and use padding_xx_fftlog. The default is False.

  • plaw_fourier (float) – FFTLog pre-whitens its arguments (makes them flatter) to avoid aliasing. The plaw_fourier parameter describes the tilt of the profile, \(P(r) \propto r^{\mathrm{tilt}}\), for standard 3D transforms. Default: -1.5

  • plaw_fourier_projected (float) – As plaw_fourier for 2D transforms (when computing 2D projected or cumulative profiles. Default: -1.0.

real(cosmo, r, M, a)[source]

Returns the 3D real-space value of the profile as a function of cosmology, radius, halo mass and scale factor.

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

  • r (float or array) – comoving radius in Mpc.

  • M (float or array) – halo mass in units of M_sun.

  • a (float) – scale factor.

Returns:

halo profile. The shape of the output will be (N_M, N_r) where N_r and N_m are the sizes of r and M respectively. If r or M are scalars, the corresponding dimension will be squeezed out on output.

Return type:

(float or array)

fourier(cosmo, k, M, a)[source]

Returns the Fourier-space value of the profile as a function of cosmology, wavenumber, halo mass and scale factor.

\[\rho(k)=\frac{1}{2\pi^2} \int dr\, r^2\, \rho(r)\, j_0(k r)\]
Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • k (float or array) – comoving wavenumber (in \(Mpc^{-1}\)).

  • M (float or array) – halo mass.

  • a (float) – scale factor.

Returns:

Fourier-space profile. The shape of the output will be (N_M, N_k) where N_k and N_m are the sizes of k and M respectively. If k or M are scalars, the corresponding dimension will be squeezed out on output.

Return type:

(float or array)

projected(cosmo, r_t, M, a)[source]

Returns the 2D projected profile as a function of cosmology, radius, halo mass and scale factor.

\[\Sigma(R)= \int dr_\parallel\, \rho(\sqrt{r_\parallel^2 + R^2})\]
Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • r_t (float or array) – transverse comoving radius in Mpc.

  • M (float or array) – halo mass in units of M_sun.

  • a (float) – scale factor.

Returns:

projected profile. The shape of the output will be (N_M, N_r) where N_r and N_m are the sizes of r and M respectively. If r or M are scalars, the corresponding dimension will be squeezed out on output.

Return type:

(float or array)

cumul2d(cosmo, r_t, M, a)[source]

Returns the 2D cumulative surface density as a function of cosmology, radius, halo mass and scale factor.

\[\Sigma(<R)= \frac{2}{R^2} \int dR'\, R'\, \Sigma(R')\]
Parameters:
  • cosmo (Cosmology) – a Cosmology object.

  • r_t (float or array) – transverse comoving radius in Mpc.

  • M (float or array) – halo mass in units of M_sun.

  • a (float) – scale factor.

Returns:

cumulative surface density. The shape of the output will be (N_M, N_r) where N_r and N_m are the sizes of r and M respectively. If r or M are scalars, the corresponding dimension will be squeezed out on output.

Return type:

(float or array)

convergence(cosmo, r, M, *, a_lens, a_source)[source]

Returns the convergence as a function of cosmology, radius, halo mass and the scale factors of the source and the lens.

\[\kappa(R) = \frac{\Sigma(R)}{\Sigma_{\rm crit}},\]

where \(\Sigma(R)\) is the 2D projected surface mass density (see projected()), and \(\Sigma_{\rm crit}\) is the critical surface density (see sigma_critical()).

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

  • r (float or array) – comoving radius.

  • M (float or array) – halo mass.

  • a_lens (float) – scale factor of lens.

  • a_source (float or array) – scale factor of source. If an array, it must have the same shape as r.

Returns:

convergence \(\kappa\). The shape of the output will be (N_M, N_r) where N_r and N_m are the sizes of r and M respectively. If r or M are scalars, the corresponding dimension will be squeezed out on output.

Return type:

(float or array)

shear(cosmo, r, M, *, a_lens, a_source)[source]

Returns the shear (tangential) as a function of cosmology, radius, halo mass and the scale factors of the source and the lens.

\[\gamma(R) = \frac{\Delta\Sigma(R)}{\Sigma_{\mathrm{crit}}} = \frac{\overline{\Sigma}(< R) - \Sigma(R)}{\Sigma_{\mathrm{crit}}},\]

where \(\overline{\Sigma}(< R)\) is cumulative surface density (see cumul2d()), \(\Sigma(R)\) is the projected 2D density (see projected()), and \(\Sigma_{\rm crit}\) is the critical surface density (see sigma_critical()).

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

  • r (float or array) – comoving radius in Mpc.

  • M (float or array) – halo mass in units of M_sun.

  • a_lens (float) – scale factor of lens.

  • a_source (float or array) – source’s scale factor. If array, it must have the same shape as r.

Returns:

shear \(\gamma\). The shape of the output will be (N_M, N_r) where N_r and N_m are the sizes of r and M respectively. If r or M are scalars, the corresponding dimension will be squeezed out on output.

Return type:

(float or array)

reduced_shear(cosmo, r, M, *, a_lens, a_source)[source]

Returns the reduced shear as a function of cosmology, radius, halo mass and the scale factors of the source and the lens.

\[g_t (R) = \frac{\gamma(R)}{(1 - \kappa(R))},\]

where \(\gamma(R)\) is the shear and \(\kappa(R)\) is the convergence.

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

  • r (float or array) – comoving radius in Mpc.

  • M (float or array) – halo mass in units of M_sun.

  • a_lens (float) – scale factor of lens.

  • a_source (float or array) – source’s scale factor. If array, it must have the same shape as r.

Returns:

reduced shear \(g_t\). The shape of the output will be (N_M, N_r) where N_r and N_m are the sizes of r and M respectively. If r or M are scalars, the corresponding dimension will be squeezed out on output.

Return type:

(float or array)

magnification(cosmo, r, M, a_lens, a_source)[source]

Returns the magnification for input parameters.

\[\mu(R) = \frac{1}{\left[(1 - \kappa(R))^2 - \vert \gamma(R) \vert^2 \right]]},\]

where \(\gamma(R)\) is the shear and \(\kappa(R)\) is the convergence (see shear() and convergence()).

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

  • r (float or array) – comoving radius in Mpc.

  • M (float or array) – halo mass in units of M_sun.

  • a_lens (float) – scale factor of lens.

  • a_source (float or array) – source’s scale factor. If array, it must have the same shape as r.

Returns:

magnification \(\mu\). The shape of the output will be (N_M, N_r) where N_r and N_m are the sizes of r and M respectively. If r or M are scalars, the corresponding dimension will be squeezed out on output.

Return type:

(float or array)

class pyccl.halos.profiles.profile_base.HaloProfileMatter(self, *, mass_def, concentration=None, is_number_counts=False)[source]

Bases: HaloProfile

Base for matter halo profiles.

get_normalization(cosmo, a, *, hmc=None)[source]

Returns the normalization of all matter overdensity profiles, which is simply the comoving matter density.

Parameters:
Returns:

normalization factor of this profile.

Return type:

float

class pyccl.halos.profiles.profile_base.HaloProfilePressure(self, *, mass_def, concentration=None, is_number_counts=False)[source]

Bases: HaloProfile

Base for pressure halo profiles.

class pyccl.halos.profiles.profile_base.HaloProfileCIB(self, *, mass_def, concentration=None, is_number_counts=False)[source]

Bases: HaloProfile

Base for CIB halo profiles.