MassFunction

class hmf.mass_function.hmf.MassFunction(*args, **kwargs)[source]

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.

Most outputs are provided as @cached_quantity 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).

In addition to the parameters directly passed to this class, others are available which are passed on to its superclass (Transfer). To read a standard documented list of (all) available parameters, use parameter_info(). If you want to just see the plain list of available parameters, use get_all_parameters(). To see the actual defaults for each parameter, use get_all_parameter_defaults().

Parameters:
  • Mmin – The log10 of the minimum halo mass to compute quantities for (units Msun/h).

  • Mmax – The log10 of the minimum halo mass to compute quantities for (units Msun/h).

  • dlog10m – The resolution of the mass array (logarithmically spaced).

  • hmf_model – The HMF fitting function to use.

  • hmf_params – Parameters specific to the chosen HMF.

  • mdef_model – The mass definition model to use. By default, use the mass definition in which the chosen HMF was measured. If that does not exist, use SOMean(200). If set, this must be compatible with the halo definition used in measuring the chosen HMF – unless disable_mass_conversion is set to False, in which case the HMF is automatically translated to a new mass definition.

  • mdef_params – Parameters specific to the mass definition model. Typically “overdensity” or “linking_length”.

  • delta_c – The critical overdensity for collapse.

  • filter_model – A model to compute the

Examples

Since all parameters have reasonable defaults, the most obvious thing to do is

>>> h = MassFunction()
>>> h.dndm

Many different parameters may be passed, both models and parameters of those models. For instance:

>>> h = MassFunction(z=1.0,Mmin=8,hmf_model="SMT")
>>> h.dndm

Once instantiated, changing parameters should be done through the update() method:

>>> h.update(z=2)
>>> h.dndm

Attributes

Methods

__init__(Mmin: float = 10.0, Mmax: float = 15.0, dlog10m: float = 0.01, hmf_model: str | BaseFittingFunction = <class 'hmf.mass_function.fitting_functions.Tinker08'>, hmf_params: dict[str, ~typing.Any] | None=None, mdef_model: None | str | BaseMassDefinition = None, mdef_params: dict | None = None, delta_c: float = 1.68647, filter_model: str | BaseFilter = <class 'hmf.density_field.filters.TopHat'>, filter_params: dict | None = None, disable_mass_conversion: bool = True, **transfer_kwargs)[source]
clone(**kwargs)

Create and return an updated clone of the current object.

classmethod get_all_parameter_defaults(recursive=True)

Dictionary of all parameters and defaults.

classmethod get_all_parameter_names()

Yield all parameter names in the class.

get_dependencies(*q)

Determine all parameter dependencies of the quantities in q.

Parameters:

q (str) – String(s) labelling a quantity

Returns:

deps – A set containing all parameters on which quantities in q are dependent.

Return type:

set

classmethod parameter_info(names=None)

Prints information about each parameter in the class.

Optionally, restrict printed parameters to those found in the list of names provided.

classmethod quantities_available()

Obtain a list of all available output quantities.

update(**kwargs)

Update parameters of the framework with kwargs.

validate()[source]

Perform validation of the input parameters as they relate to each other.