hmf

This is the primary module for user-interaction with the hmf package.

The module contains a single class, MassFunction, which wraps almost all the functionality of hmf in an easy-to-use way.

class hmf.hmf.MassFunction(Mmin=10, Mmax=15, dlog10m=0.01, mf_fit=<class 'hmf.fitting_functions.Tinker08'>, delta_h=200.0, delta_wrt='mean', cut_fit=True, z2=None, nz=None, _fsig_params={}, delta_c=1.686, filter=<class 'hmf.filters.TopHat'>, filter_params={}, **transfer_kwargs)

An object containing all relevant quantities for the mass function.

The purpose of this class is to calculate many quantities associated with the dark matter halo mass function (HMF). The class is initialized to form a cosmology and takes in various options as to how to calculate all further quantities.

All required outputs are provided as @property attributes for ease of access.

Contains an update() method which can be passed arguments to update, in the most optimal manner. All output quantities are calculated only when needed (but stored after first calculation for quick access).

Quantities related to the transfer function can be accessed through the transfer property of this object.

Parameters:

Mmin : float

Minimum mass at which to perform analysis [units \(\log_{10}M_\odot h^{-1}\)].

Mmax : float

Maximum mass at which to perform analysis [units \(\log_{10}M_\odot h^{-1}\)].

dlog10m : float

log10 interval between mass bins

mf_fit : str or callable, optional, default "SMT"

A string indicating which fitting function to use for \(f(\sigma)\)

Available options:

  1. 'PS': Press-Schechter form from 1974
  2. 'ST': Sheth-Mo-Tormen empirical fit 2001 (deprecated!)
  3. 'SMT': Sheth-Mo-Tormen empirical fit from 2001
  4. 'Jenkins': Jenkins empirical fit from 2001
  5. 'Warren': Warren empirical fit from 2006
  6. 'Reed03': Reed empirical from 2003
  7. 'Reed07': Reed empirical from 2007
  8. 'Tinker': Tinker empirical from 2008
  9. 'Watson': Watson empirical 2012
  10. 'Watson_FoF': Watson Friend-of-friend fit 2012
  11. 'Crocce': Crocce 2010
  12. 'Courtin': Courtin 2011
  13. 'Angulo': Angulo 2012
  14. 'Angulo_Bound': Angulo sub-halo function 2012
  15. 'Bhattacharya': Bhattacharya empirical fit 2011
  16. 'Behroozi': Behroozi extension to Tinker for high-z 2013

Alternatively, one may define a callable function, with the signature func(self), where self is a MassFunction object (and has access to all its attributes). This may be passed here.

delta_wrt : str, {"mean", "crit"}

Defines what the overdensity of a halo is with respect to, mean density of the universe, or critical density.

delta_h : float, optional, default 200.0

The overdensity for the halo definition, with respect to delta_wrt

user_fit : str, optional, default ""

A string defining a mathematical function in terms of x, used as the fitting function, where x is taken as \(\( \sigma \)\). Will only be applicable if mf_fit == "user_model".

cut_fit : bool, optional, default True

Whether to forcibly cut \(f(\sigma)\) at bounds in literature. If false, will use whole range of M.

delta_c : float, default 1.686

The critical overdensity for collapse, \(\delta_c\)

kwargs : keywords

These keyword arguments are sent to the hmf.transfer.Transfer class.

Included are all the cosmological parameters (see the docs for details).

Attributes

H0
M
Mmax
Mmin
N_nu
N_nu_massive
cosmolopy_dict Collect parameters into a dictionary suitable for cosmolopy.
cs2_lam
cut_fit
delta_c
delta_h
delta_halo Overdensity of a halo w.r.t mean density
delta_k Dimensionless power spectrum, \(\Delta_k = \frac{k^3 P(k)}{2\pi^2}\)
delta_wrt
dlnk
dlog10m
dndlnm The differential mass function in terms of natural log of M, len=len(M) [units \(h^3 Mpc^{-3}\)]
dndlog10m The differential mass function in terms of log of M, len=len(M) [units \(h^3 Mpc^{-3}\)]
dndm The number density of haloes, len=len(M) [units \(h^4 M_\odot^{-1} Mpc^{-3}\)]
filter
filter_mod
filter_params
force_flat
fsigma The multiplicity function, \(f(\sigma)\), for mf_fit.
growth The growth factor \(d(z)\)
h
how_big Size of simulation volume in which to expect one halo of mass M, len=len(M) [units \(Mpch^{-1}\)]
kr_warning
lnk
lnk_max
lnk_min
lnsigma Natural log of inverse mass variance, len=len(M)
mean_dens
mean_dens_z Mean density of universe at redshift z
mf_fit
n
n_eff Effective spectral index at scale of halo radius, len=len(M)
ngtm The cumulative mass function above M, len=len(M) [units \(h^3 Mpc^{-3}\)]
nonlinear_delta_k Dimensionless nonlinear power spectrum, \(\Delta_k = \frac{k^3 P_{\rm nl}(k)}{2\pi^2}\)
nonlinear_power Non-linear log power [units \(Mpc^3/h^3\)]
nu The parameter :math:`
nz
omegab
omegab_h2
omegac
omegac_h2
omegak
omegam
omegam_z Density parameter at redshift of this instance.
omegan
omegav
power Normalised log power spectrum [units \(Mpc^3/h^3\)]
pycamb_dict Collect parameters into a dictionary suitable for pycamb.
radii The radii corresponding to the masses M
rho_gtm Mass density in haloes >M, len=len(M) [units \(M_\odot h^2 Mpc^{-3}\)]
rho_ltm Mass density in haloes <M, len=len(M) [units \(M_\odot h^2 Mpc^{-3}\)]
sigma The mass variance at z, len=len(M)
sigma_8
t_cmb
takahashi
tau
transfer_fit
transfer_options
w
y_he
z
z2
z_reion

Methods

cosmo_update(**kwargs)
update(**kwargs) Update the class optimally with given arguments.
delta_halo

Overdensity of a halo w.r.t mean density

dndlnm

The differential mass function in terms of natural log of M, len=len(M) [units \(h^3 Mpc^{-3}\)]

dndlog10m

The differential mass function in terms of log of M, len=len(M) [units \(h^3 Mpc^{-3}\)]

dndm

The number density of haloes, len=len(M) [units \(h^4 M_\odot^{-1} Mpc^{-3}\)]

fsigma

The multiplicity function, \(f(\sigma)\), for mf_fit. len=len(M)

how_big

Size of simulation volume in which to expect one halo of mass M, len=len(M) [units \(Mpch^{-1}\)]

lnsigma

Natural log of inverse mass variance, len=len(M)

mean_dens_z

Mean density of universe at redshift z

n_eff

Effective spectral index at scale of halo radius, len=len(M)

Notes

This function, and any derived quantities, can show small non-physical ‘wiggles’ at the 0.1% level, if too coarse a grid in ln(k) is used. If applications are sensitive at this level, please use a very fine k-space grid.

Uses eq. 42 in Lukic et. al 2007.

ngtm

The cumulative mass function above M, len=len(M) [units \(h^3 Mpc^{-3}\)]

In the case that M does not extend to sufficiently high masses, this routine will auto-generate dndm for an extended mass range. If cut_fit is True, and this extension is invalid, then a power-law fit is applied to extrapolate to sufficient mass.

In the case of the Behroozi fit, it is impossible to auto-extend the mass range except by the power-law fit, thus one should be careful to supply appropriate mass ranges in this case.

nu
The parameter :math:`

u = left( rac{delta_c}{sigma} ight)^2`, len=len(M)

omegam_z

Density parameter at redshift of this instance.

radii

The radii corresponding to the masses M

rho_gtm

Mass density in haloes >M, len=len(M) [units \(M_\odot h^2 Mpc^{-3}\)]

In the case that M does not extend to sufficiently high masses, this routine will auto-generate dndm for an extended mass range. If cut_fit is True, and this extension is invalid, then a power-law fit is applied to extrapolate to sufficient mass.

In the case of the Behroozi fit, it is impossible to auto-extend the mass range except by the power-law fit, thus one should be careful to supply appropriate mass ranges in this case.

rho_ltm

Mass density in haloes <M, len=len(M) [units \(M_\odot h^2 Mpc^{-3}\)]

Note

As of v1.6.2, this assumes that the entire mass density of halos is encoded by the mean_density parameter (ie. all mass is found in halos). This is not explicitly true of all fitting functions (eg. Warren), in which case the definition of this property is somewhat inconsistent, but will still work.

In the case that M does not extend to sufficiently high masses, this routine will auto-generate dndm for an extended mass range. If cut_fit is True, and this extension is invalid, then a power-law fit is applied to extrapolate to sufficient mass.

In the case of the Behroozi fit, it is impossible to auto-extend the mass range except by the power-law fit, thus one should be careful to supply appropriate mass ranges in this case.

sigma

The mass variance at z, len=len(M)