Halo mass function¶
The mass function quantifies how many halos of a certain mass exist at a given redshift and in a given cosmology.
Basics¶
This module implements a number of models for the halo mass function. The easiest and recommended
use of the module is through the massFunction()
function, a wrapper for all individual
models:
from colossus.cosmology import cosmology
from colossus.lss import mass_function
cosmology.setCosmology('WMAP9')
mfunc_so = mass_function.massFunction(1E12, 0.0, mdef = 'vir', model = 'tinker08')
mfunc_fof = mass_function.massFunction(1E12, 0.0, mdef = 'fof', model = 'watson13')
Of course, the function accepts numpy arrays for the mass parameter. By default, the mass function is returned as \(f(\sigma)\), the natural units in PressSchechter theory, where
Here, \(\rho_0\) is the matter density at \(z = 0\) and \(\sigma\) is the variance
on the lagrangian size scale of the halo mass in question (see
sigma()
). The function can also return the mass function
in other units, namely as the number density per logarithmic interval in mass, \(dn/d\ln(M)\)
(units of comoving \(({\rm Mpc}/h)^{3}\), indicated by q_out = dndlnM
) and as
\(M^2 / \rho_0 dn/dM\) (dimensionless, indicated by q_out = M2dndM
). These conversions
can separately be performed separately using the convertMassFunction()
function. Please see
the Tutorials for more extensive code examples.
Mass function models¶
The following models are supported, and are listed in the models
dictionary. Their ID can
be passed as the model
parameter to the massFunction()
function:
ID 
mdefs 
zdep. 
Reference 

press74 
fof 
delta_c 

sheth99 
fof 
delta_c 

jenkins01 
fof 
No 

reed03 
fof 
delta_c 

warren06 
fof 
No 

reed07 
fof 
delta_c 

tinker08 
Any SO 
Yes 

crocce10 
fof 
No 

bhattacharya11 
fof 
Yes 

courtin11 
fof 
No 

angulo12 
fof 
No 

watson13 
fof, any SO 
Yes (SO) 

bocquet16 
200m,200c,500c 
Yes 

despali16 
Any SO 
Yes 

comparat17 
vir 
No 
Note that the mass definition (set to fof
by default) needs to match one of the allowed mass
definitions of the chosen model. For most models, only fof
is allowed, but some SO models are
calibrated to various mass definitions. The tinker08
model can handle any overdensity between
200m and 3200m (though they can be expressed as critical and virial overdensities as well).
There are two different types of redshift dependence of \(f(\sigma)\) listed above: some
models explicitly depend on redshift (e.g., bhattacharya11
), some models only change through
the small variation of the collapse overdensity \(\delta_{\rm c}\)
(see collapseOverdensity()
). The tinker08
model depends on redshift only through
the conversion of the overdensity threshold.
Mass functions based on the PressSchechter formalism (i.e., parameterizations in terms of f(sigma) which includes all of the mass functions implemented here) are, in principle, supposed to be valid across redshifts and cosmologies. However, it has been shown that this is true only approximately. Nevertheless, this function does not check whether the user input is outside the range where the model was calibrated, be it in halo mass, redshift, or cosmology.
Module contents¶
Characteristics of halo mass function models. 

Dictionary containing a list of models. 


The abundance of halos as a function of mass, variance, or peak height. 

Convert different units of the mass function. 

The mass function model of Press & Schechter 1974. 

The mass function model of Sheth & Tormen 1999. 

The mass function model of Jenkins et al 2001. 

The mass function model of Reed et al 2003. 

The mass function model of Warren et al 2006. 

The mass function model of Reed et al 2007. 

The mass function model of Tinker et al 2008. 

The mass function model of Crocce et al 2010. 

The mass function model of Courtin et al 2011. 

The mass function model of Bhattacharya et al 2011. 

The mass function model of Angulo et al 2012. 

The mass function model of Watson et al 2013. 

The mass function model of Bocquet et al 2016. 

The mass function model of Despali et al 2016. 

The mass function model of Comparat et al 2017. 
Module reference¶

class
lss.mass_function.
HaloMassFunctionModel
¶ Characteristics of halo mass function models.
This class contains certain characteristics of a mass function model, namely the mass definitions for which it is valid, whether it explicitly depends on the redshift (in some cases this dependence arises because of the slight dependence of the collapse overdensity on z), and how the collapse overdensity is computed by default (if applicable).
The
models
dictionary contains one item of this class for each available model.
z_dependence
= None¶ Indicates whether \(f(\sigma)\) depends on redshift in this model.

ps_dependence
= None¶ Indicates whether \(f(\sigma)\) depends directly on the power spectrum.

sigma_dependence
= None¶ Indicates whether \(f(\sigma)\) depends directly on \(\sigma(M)\) beyond the input \(\sigma\).

deltac_dependence
= None¶ Indicates whether \(f(\sigma)\) depends directly on the collapse overdensity.

mdef_dependence
= None¶ Indicates whether \(f(\sigma)\) depends on the mass definition (for SO models).

mdefs
= None¶ A list of mass definitions for which this model is valid. See Halo Mass Definitions for details.


lss.mass_function.
models
= {'angulo12': <lss.mass_function.HaloMassFunctionModel object>, 'bhattacharya11': <lss.mass_function.HaloMassFunctionModel object>, 'bocquet16': <lss.mass_function.HaloMassFunctionModel object>, 'comparat17': <lss.mass_function.HaloMassFunctionModel object>, 'courtin11': <lss.mass_function.HaloMassFunctionModel object>, 'crocce10': <lss.mass_function.HaloMassFunctionModel object>, 'despali16': <lss.mass_function.HaloMassFunctionModel object>, 'jenkins01': <lss.mass_function.HaloMassFunctionModel object>, 'press74': <lss.mass_function.HaloMassFunctionModel object>, 'reed03': <lss.mass_function.HaloMassFunctionModel object>, 'reed07': <lss.mass_function.HaloMassFunctionModel object>, 'sheth99': <lss.mass_function.HaloMassFunctionModel object>, 'tinker08': <lss.mass_function.HaloMassFunctionModel object>, 'warren06': <lss.mass_function.HaloMassFunctionModel object>, 'watson13': <lss.mass_function.HaloMassFunctionModel object>}¶ Dictionary containing a list of models.
An ordered dictionary containing one
HaloMassFunctionModel
entry for each model.

lss.mass_function.
massFunction
(x, z, q_in='M', q_out='f', mdef='fof', model='watson13', ps_args={'model': 'eisenstein98', 'path': None}, sigma_args={}, deltac_args={}, **kwargs)¶ The abundance of halos as a function of mass, variance, or peak height.
This function is a wrapper for all individual models implemented in this module. It accepts either mass, variance, or peak height as input (controlled by the
q_in
parameter, see thesigma()
andpeakHeight()
functions for details on those quantities). The output units are controlled by theq_out
parameter, see the basic usage section for details.This function also deals with different mass definitions. By default, the definition is set to
fof
, but some models can also return the mass function for SO definitions (seemodels
list). Parameters
 x: array_like
Either halo mass in \(M_{\odot}/h\), the variance \(\sigma\), or peak height \(\nu\), depending on the value of the
q_in
parameter; can be a number or a numpy array. z: float
Redshift
 q_in: str
Either
M
,sigma
, ornu
indicating which is passed for thex
parameter. q_out: str
The units in which the mass function is returned; can be
f
,dndlnM
, orM2dndM
. See the Basics section for details on these units. mdef: str
The mass definition in which the halo mass M is given (or from which the variance or peak height were computed). The returned mass function refers to this mass definition. Please see the model table for the mass definitions for which each model is valid. See Halo Mass Definitions for details.
 model: str
The model of the mass function used.
 ps_args: dict
Arguments passed to the
matterPowerSpectrum()
function. sigma_args: dict
Extra arguments to be passed to the
sigma()
function if mass is converted to a variance. deltac_args: dict
Extra parameters that are passed to the
collapseOverdensity()
function; see the documentation of the individual models for possible parameters. Note that not all models of the mass function rely on the collapse overdensity. kwargs: kwargs
Extra arguments passed to the function of the particular model. See the documentation of those functions for valid arguments.
 Returns
 mfunc: array_like
The halo mass function in the desired units.

lss.mass_function.
convertMassFunction
(mfunc, M, z, q_in, q_out, ps_args={'model': 'eisenstein98', 'path': None}, sigma_args={})¶ Convert different units of the mass function.
Virtually all models parameterize the mass function in the natural PressSchechter units, \(f(\sigma)\). This function convert any allowed units into any other units. See the basic usage section for details on the meaning of the units.
 Parameters
 mfunc: array_like
The mass function in the input units.
 M: array_like
Halo mass in \(M_{\odot}/h\); can be a number or a numpy array.
 z: float
Redshift
 q_in: str
The units in which the mass function is input; can be
f
,dndlnM
, orM2dndM
. See Basics section for the meaning of these units. q_out: str
The units in which the mass function is returned; see above.
 ps_args: dict
Arguments passed to the
matterPowerSpectrum()
function. sigma_args: dict
Extra arguments to be passed to the
sigma()
function when mass is converted to a variance.
 Returns
 mfunc: array_like
The halo mass function in the desired units.

lss.mass_function.
modelPress74
(sigma, z, deltac_args={'corrections': True})¶ The mass function model of Press & Schechter 1974.
This model depends on redshift only through the collapse overdensity \(\delta_{\rm c}\). By default, the collapse overdensity is computed including corrections due to cosmology.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 z: float
Redshift
 deltac_args: dict
Arguments passed to the
collapseOverdensity()
function.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelSheth99
(sigma, z, deltac_args={'corrections': True})¶ The mass function model of Sheth & Tormen 1999.
This model was created to account for the differences between the classic Press& Schechter 1974 model and measurements of the halo abundance in numerical simulations. The model is given in Equation 10. Note that, by default, the collapse overdensity is computed including corrections due to cosmology. Compared to the paper, the equation implemented here contains an extra factor of 2 because the original equation refers to the A = 1/2 normalization of Press & Schechter. This model is sometimes also known as “SMT” for Sheth, Mo and Tormen 2001 who use the same fitting function.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 z: float
Redshift
 deltac_args: dict
Arguments passed to the
collapseOverdensity()
function.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelJenkins01
(sigma)¶ The mass function model of Jenkins et al 2001.
The model is given in Equation 9. It does not explicitly rely on the collapse overdensity and thus has no redshift evolution.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelReed03
(sigma, z, deltac_args={'corrections': True})¶ The mass function model of Reed et al 2003.
This model corrects the Sheth & Tormen 1999 model at high masses, the functional form is given in Equation 9.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 z: float
Redshift
 deltac_args: dict
Arguments passed to the
collapseOverdensity()
function.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelWarren06
(sigma)¶ The mass function model of Warren et al 2006.
This model does not explicitly rely on the collapse overdensity and thus has no redshift dependence. The functional form is given in Equation 5.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelReed07
(sigma, z, ps_args={'model': 'eisenstein98', 'path': None}, sigma_args={}, deltac_args={'corrections': True}, exact_n=True)¶ The mass function model of Reed et al 2007.
This model takes the changing slope of the power spectrum into account. This slope can be computed numerically using the Colossus interpolation tables, or using the approximation in Equation 14 (the more exact numerical version is the default). The paper gives two expressions for their mass function, this code uses Equation 11.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 z: float
Redshift
 ps_args: dict
Arguments passed to the
matterPowerSpectrum()
function. sigma_args: dict
Extra arguments to be passed to the
sigma()
function when mass is converted to a variance. deltac_args: dict
Arguments passed to the
collapseOverdensity()
function. exact_n: bool
Compute the slope of the power spectrum numerically or approximate it.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelTinker08
(sigma, z, mdef)¶ The mass function model of Tinker et al 2008.
This model was the first calibrated for SO rather than FOF masses, and can predict the mass function for a large range of overdensities (\(200 \leq \Delta_{\rm m} \leq 3200\)). The authors found that the SO mass function is not universal with redshift and took this dependence into account explicitly (Equations 38).
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 z: float
Redshift
 mdef: str
The mass definition to which
sigma
corresponds. See Halo Mass Definitions for details.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelCrocce10
(sigma, z)¶ The mass function model of Crocce et al 2010.
This function was calibrated between z = 0 and 1, and is given in Equation 22.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelCourtin11
(sigma)¶ The mass function model of Courtin et al 2011.
The model uses the same functional form as the Sheth & Tormen 1999, but with different parameters and a fixed collapse overdensity \(\delta_{\rm c} = 1.673\). Note that there appears to be an error in Equations 8 and 22: the factor of \(\sqrt{a}\) should be in the numerator rather than denominator in order to reproduce the ST expression. Other authors have taken the formula literally, e.g. Watson et al. 2013. Here, we assume that the intended expression is, indeed, that of ST.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelBhattacharya11
(sigma, z, deltac_args={'corrections': False})¶ The mass function model of Bhattacharya et al 2011.
This model was calibrated between redshift 0 and 2. The authors found that varying \(\delta_{\rm c}\) does not account for the redshift dependence. Thus, they keep it fixed and added an explicit redshift dependence into the model. The functional form is given in Table 4.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 z: float
Redshift
 deltac_args: dict
Arguments passed to the
collapseOverdensity()
function.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelAngulo12
(sigma)¶ The mass function model of Angulo et al 2012.
The model is specified in Equation 2. Note that there is a typo in this equation that was corrected in other implementations of the model.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelWatson13
(sigma, z, mdef)¶ The mass function model of Watson et al 2013.
This function contains multiple models, namely the redshiftindependent model for the FOF mass function as given in Equation 12, the redshiftevolving fit to the AHF mass function given in Equations 1416, as well as the dependence on mass definition given in Equations 1719. At z = 0 and z > 6 the authors suggest slightly different sets of parameters for the SO mass function which are used at those redshifts. Please note that the different parameterizations do not agree, as in, the redshiftdependent formula at z ~ 0 does not match the z = 0 expression. To get the redshiftdependent version at z = 0, simply use a very small redshift.
Note that there is a typo in the paper text, where the values of \(\alpha\) and \(\beta\) are switched. The correct values are in Table 2.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 z: float
Redshift
 mdef: str
The mass definition to which
sigma
corresponds. See Halo Mass Definitions for details.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelBocquet16
(sigma, z, mdef, ps_args={'model': 'eisenstein98', 'path': None}, sigma_args={}, deltac_args={'corrections': True}, hydro=True)¶ The mass function model of Bocquet et al 2016.
The parameters were separately fit for dark matteronly and hydrodynamical simulations. The fits cover three mass definitions (200m, 200c, and 500c); requesting a different definition raises an exception. Note that, beyond different bestfit parameters, the 200c and 500c mass functions rely on a conversion that depends explicitly on redshift, cosmology, and halo mass (rather than peak height).
Due to this conversion to halo mass, the model does implicitly depend on the power spectrum, variance etc parameters beyond the value of sigma.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 z: float
Redshift
 mdef: str
The mass definition to which
sigma
corresponds. See Halo Mass Definitions for details. ps_args: dict
Arguments passed to the
matterPowerSpectrum()
function. sigma_args: dict
Extra arguments to be passed to the
sigma()
function when mass is converted to a variance. deltac_args: dict
Arguments passed to the
collapseOverdensity()
function. hydro: bool
If True, return the model for hydro simulations, otherwise DMonly.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelDespali16
(sigma, z, mdef, deltac_args={'corrections': True}, ellipsoidal=False)¶ The mass function model of Despali et al 2016.
The parameters were fit for a number of different mass definitions, redshifts, and cosmologies. Here, we use the most general parameter set using the rescaling formula for redshift and mass definitions given in Equation 12. Furthermore, the user can choose between results based on conventional SO halo finding and an ellipsoidal halo finder.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 z: float
Redshift
 mdef: str
The mass definition to which
sigma
corresponds. See Halo Mass Definitions for details. ellipsoidal: bool
If True, return the results for an ellipsoidal halo finder, otherwise standard SO.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.

lss.mass_function.
modelComparat17
(sigma)¶ The mass function model of Comparat et al 2017.
This model was calibrated only at redshift 0, and for the virial SO mass definition. The cosmology used is the
multidarkplanck
cosmology (which is very close toplanck13
). Outside of this redshift and cosmology, the model relies on the universality of the mass function.The functional form is the same as in the Bhattacharya et al 2011 model, but without their redshift dependence. The parameters used here are updated compared to the published version of the paper.
 Parameters
 sigma: array_like
Variance; can be a number or a numpy array.
 Returns
 f: array_like
The halo mass function \(f(\sigma)\), has the same dimensions as
sigma
.