pynbody.analysis.hmf.halo_mass_function

pynbody.analysis.hmf.halo_mass_function#

pynbody.analysis.hmf.halo_mass_function(context, log_M_min=8.0, log_M_max=15.0, delta_log_M=0.1, kern='ST', pspec=<class 'pynbody.analysis.hmf.PowerSpectrum'>, delta_crit=1.686)[source]#

Returns the halo mass function, dN/d log_{10} M in units of Mpc^-3 h^3.

See Halo Mass function for an example and more information.

Parameters:
  • context (SimSnap) – The snapshot from which to pull the cosmological context. Sigma8 normalization and growth function redshift dependence is always taken into account. If camb is installed, an appropriate power spectrum is calculated for other cosmological parameters (e.g. baryon density, Hubble constant) from the simulation. Otherwise, a default Planck18 power spectrum is used.

  • log_M_min (float, optional) – The minimum halo mass (Msol h^-1) to consider. Default is 8.

  • log_M_max (float, optional) – The maximum halo mass (Msol h^-1) to consider. Default is 15.

  • delta_log_M (float, optional) – The bin spacing of halo masses. Default is 0.1.

  • kern (str or function, optional) – The kernel function which dictates what type of mass function to calculate. Default is “ST” (Sheth-Tormen). Other options are “PS” (Press-Schechter), “J” (Jenkins), “W” (Warren), “REEDZ” (Reed et al 2007 with redshift dependence), “REEDU” (Reed et al 2007 without redshift dependence), “B” (Bhattacharya).

  • pspec (PowerSpectrumCAMB, optional) – A power spectrum object (which also defines the window function), overriding the cosmological parameters of the simulation.

  • delta_crit (float, optional) – The critical overdensity for collapse. Default is 1.686.

Returns:

  • M (SimArray) – The centre of the mass bins, in Msol h^-1.

  • sigma (SimArray) – The linear variance of the corresponding sphere.

  • N (SimArray) – The abundance of halos of that mass (Mpc^-3 h^3 comoving, per decade of mass).

Notes

Because numerical derivatives are involved, the value of delta_log_M affects the accuracy.

The halo mass function code in pynbody was implemented in 2012 when there were no other python libraries that could do this. Since then, cosmology-focussed libraries such as hmf, and CCL have been developed. For precision cosmology applications, we recommend using these libraries.

The functionality here is retained for quick cross-checks of simulations.