BaseFittingFunction¶
- class hmf.mass_function.fitting_functions.BaseFittingFunction(nu2: ndarray, m: None | ndarray = None, z: float = 0.0, n_eff: None | ndarray = None, mass_definition: None | BaseMassDefinition = None, cosmo: FLRW = FlatLambdaCDM(name='Planck15', H0=<Quantity 67.74 km / (Mpc s)>, Om0=0.3075, Tcmb0=<Quantity 2.7255 K>, Neff=3.046, m_nu=<Quantity [0., 0., 0.06] eV>, Ob0=0.0486), delta_c: float = 1.68647, **model_parameters)[source]¶
Base-class for a halo mass function fit.
This class should not be called directly, rather use a subclass which is specific to a certain fitting formula. The only method necessary to define for any subclass is fsigma, as well as a dictionary of default parameters as a class variable _defaults. Model parameters defined here are accessed through the
paramsinstance attribute (and may be overridden at instantiation by the user). A subclass may optionally define acutmaskproperty, to override the default behaviour of returning True for the whole range.In addition, several class attributes, req_*, identify the required arguments for a given subclass. These must be set accordingly.
Examples
The following would be an example of defining the Sheth-Tormen mass function (which is already included), showing the basic idea of subclassing this class:
>>> class SMT(FittingFunction): >>> # Subclass requirements >>> req_sigma = False >>> req_z = False >>> >>> # Default parameters >>> _defaults = {"a":0.707, "p":0.3, "A":0.3222} >>> >>> @property >>> def fsigma(self): >>> A = self.params['A'] >>> a = self.params["a"] >>> p = self.params['p'] >>> >>> return (A * np.sqrt(2.0 * a / np.pi) * self.nu * >>> np.exp(-(a * self.nu2) / 2.0) >>> * (1 + (1.0 / (a * self.nu2)) ** p))
In that example, we did not specify
cutmask.- Parameters:
- nu2array_like
A vector of peak-heights, \(\delta_c^2/\sigma^2\) corresponding to m
- marray_like, optional
A vector of halo masses [units M_sun/h]. Only necessary if
req_massis True. Typically provides limits of applicability. Must correspond to nu2.- zfloat, optional
The redshift. Only required if
req_zis True, in which case the default is 0.- n_effarray_like, optional
The effective spectral index at m. Only required if
req_neffis True.- mass_definition
hmf.halos.mass_definitions.MassDefinitioninstance A halo mass definition. Only required for fits which explicitly include a parameterization for halo definition.
- cosmo
astropy.cosmology.FLRWinstance, optional A cosmology. Default is Planck15. Either omegam_z or cosmo is required if
req_omzis True. If both are passed, omegam_z takes precedence.- **model_parametersunpacked-dictionary
These parameters are model-specific. For any model, list the available parameters (and their defaults) using
<model>._defaults
Attributes
Methods
- __init__(nu2: ndarray, m: None | ndarray = None, z: float = 0.0, n_eff: None | ndarray = None, mass_definition: None | BaseMassDefinition = None, cosmo: FLRW = FlatLambdaCDM(name='Planck15', H0=<Quantity 67.74 km / (Mpc s)>, Om0=0.3075, Tcmb0=<Quantity 2.7255 K>, Neff=3.046, m_nu=<Quantity [0., 0., 0.06] eV>, Ob0=0.0486), delta_c: float = 1.68647, **model_parameters)[source]
- classmethod get_measured_mdef()[source]
Get the mass definition used in the defining simulation.