pyccl.halos.massdef module

pyccl.halos.massdef.mass2radius_lagrangian(cosmo, M)[source]

Returns Lagrangian radius for a halo of mass \(M\). The Lagrangian radius is defined as that enclosing the mass of the halo assuming a homogeneous Universe.

\[R = \left(\frac{3\,M}{4\pi\,\rho_{M,0}}\right)^{1/3}\]
Parameters:
  • cosmo (Cosmology) – A Cosmology object.

  • M (float or array) – halo mass in units of \(M_\odot\).

Returns:

Lagrangian radius in comoving Mpc.

Return type:

(float or array)

pyccl.halos.massdef.convert_concentration(cosmo, *, c_old, Delta_old, Delta_new)[source]

Computes the concentration parameter for a different mass definition. This is done assuming an NFW profile. The output concentration c_new is found by solving the equation:

\[f(c_{\rm old}) \Delta_{\rm old} = f(c_{\rm new}) \Delta_{\rm new}\]

where

\[f(x) = \frac{x^3}{\log(1+x) - x/(1+x)}.\]
Parameters:
  • cosmo (Cosmology) – A Cosmology object.

  • c_old (float or array) – concentration to translate from.

  • Delta_old (float) – Delta parameter associated to the input concentration. See description of the MassDef class.

  • Delta_new (float) – Delta parameter associated to the output concentration.

Returns:

concentration parameter for the new mass definition.

Return type:

(float or array)

class pyccl.halos.massdef.MassDef(self, Delta, rho_type)[source]

Bases: CCLAutoRepr, CCLNamedClass

Halo mass definition. Halo masses are defined in terms of an overdensity parameter \(\Delta\) and an associated density \(X\) (either the matter density or the critical density):

\[M_\Delta = \frac{4 \pi}{3} \Delta\,\rho_X\, R_\Delta^3\]

where \(R_\Delta\) is the halo radius. This object also holds methods to translate between \(R_\Delta\) and \(M_\Delta\), and to translate masses between different definitions if a concentration-mass relation is provided.

You may also define halo masses based on a Friends-of-Friends algorithm, in which case simply pass Delta='fof' below.

Parameters:
  • Delta (float) – overdensity parameter. Pass 'vir' if using virial overdensity. Pass 'fof' for Friends-of-Friends halos.

  • rho_type (str) – either ‘critical’ or ‘matter’.

property name

Give a name to this mass definition.

get_Delta_vir(cosmo, a)[source]

Computes the virial collapse density contrast with respect to the critical density assuming a \(\Lambda\) CDM model. We use the fitting function from Bryan and Norman 1998. The virial overdensity is returned for the density type of this object’s mass definition (e.g. ‘critical’ or ‘matter’).

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

  • a (float) – scale factor

Returns:

value of the virial overdensity.

Return type:

float

get_Delta(cosmo, a)[source]

Gets overdensity parameter associated to this mass definition.

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

  • a (float) – scale factor

Returns:

value of the overdensity parameter.

Return type:

float

get_mass(cosmo, R, a)[source]

Translates a halo radius into a mass

\[M_\Delta = \frac{4 \pi}{3} \Delta\,\rho_X\, R_\Delta^3\]
Parameters:
  • cosmo (Cosmology) – A Cosmology object.

  • R (float or array) – halo radius (\({\rm Mpc}\), physical, not comoving).

  • a (float) – scale factor.

Returns:

halo mass in units of \(M_\odot\).

Return type:

(float or array)

get_radius(cosmo, M, a)[source]

Translates a halo mass into a radius

\[R_\Delta = \left(\frac{3M_\Delta}{4 \pi \rho_X\,\Delta}\right)^{1/3}\]
Parameters:
  • cosmo (Cosmology) – A Cosmology object.

  • M (float or array) – halo mass in units of \(M_\odot\).

  • a (float) – scale factor.

Returns:

halo radius in units of \({\rm Mpc}\) (physical, not comoving).

Return type:

(float or array)

classmethod from_name(name)[source]

Return mass definition subclass from name string.

Parameters:

name (str) – a mass definition name (e.g. '200m' for \(\Delta=200\) times the matter density).

Returns:

MassDef instance corresponding to the input name.

classmethod create_instance(input_)[source]

Process the input and generate an object of the class. Input can be an instance of the class, or a name string. Optional **kwargs may be passed.

classmethod from_specs(mass_def=None, *, mass_function=None, halo_bias=None, concentration=None)[source]

Instantiate mass definition and halo model ingredients.

Unspecified halo model ingredients are ignored. mass_def is always instantiated.

Parameters:
  • mass_def (MassDef, str or None) – Mass definition. If a string, instantiate from its name. If None, obtain the one from the first specified halo model ingredient.

  • mass_function (MassFunc or str) – Mass function subclass. Strings are auto-instantiated using mass_def. None values are ignored.

  • halo_bias (HaloBias or str) – Halo bias subclass. Strings are auto-instantiated using mass_def. None values are ignored.

  • concentration (Concentration or str) – Concentration subclass. Strings are auto-instantiated using mass_def. None values are ignored.

Returns:

Tuple of up to 4 elements.

pyccl.halos.massdef.mass_translator(*, mass_in, mass_out, concentration)[source]

Translate between mass definitions, assuming an NFW profile.

Returns a function that can be used to translate between halo masses according to two different definitions.

Parameters:
  • mass_in (MassDef or str) – mass definition of the input mass.

  • mass_out (MassDef or str) – mass definition of the output mass.

  • concentration (Concentration or str) – concentration-mass relation to use for the mass conversion. It must be calibrated for masses using the mass_in definition.

Returns:

Function that ranslates between two masses. The returned function f can be called as: f(cosmo, M, a), where cosmo is a Cosmology object, M is a mass (or array of masses), and a is a scale factor.