hmf.mass_function.integrate_hmf.hmf_integral_gtm¶
- hmf.mass_function.integrate_hmf.hmf_integral_gtm(M, dndm, mass_density=False)[source]¶
Cumulatively integrate dn/dm.
- Parameters
M (array_like) – Array of masses.
dndm (array_like) – Array of dn/dm (corresponding to M)
mass_density (bool, False) – Whether to calculate mass density (or number density).
- Returns
ngtm – Cumulative integral of dndm.
- Return type
array_like
Examples
Using a simple power-law mass function:
>>> import numpy as np >>> m = np.logspace(10,18,500) >>> dndm = m**-2 >>> ngtm = hmf_integral_gtm(m,dndm) >>> np.allclose(ngtm,1/m) #1/m is the analytic integral to infinity. True
The function always integrates to m=1e18, and extrapolates with a spline if data not provided:
>>> m = np.logspace(10,12,500) >>> dndm = m**-2 >>> ngtm = hmf_integral_gtm(m,dndm) >>> np.allclose(ngtm,1/m) #1/m is the analytic integral to infinity. True