Bocquet200cHydro¶
- class hmf.core.fits.Bocquet200cHydro(*, A=0.202, b=2.21, d=1.57, e=2.0, A_z=1.147, b_z=0.375, d_z=-0.196, e_z=-1.074)[source]¶
The Bocquet et al. (2016) mass function for M200c, with hydrodynamics.
See
Bocquet200cDMOnlyfor the mass conversion.- Parameters:
A (float, default 0.202) – The amplitude A at z = 0.
b (float, default 2.21) – The exponent b of e/sigma at z = 0 (the paper’s a).
d (float, default 1.57) – The exponential cut-off d at z = 0 (the paper’s c).
e (float, default 2.0) – The scale e of sigma at z = 0 (the paper’s b).
A_z (float, default 1.147) – The redshift exponent of A.
b_z (float, default 0.375) – The redshift exponent of b.
d_z (float, default -0.196) – The redshift exponent of d.
e_z (float, default -1.074) – The redshift exponent of e.
Model metadata
- alias: ClassVar[str | None] = 'Bocquet200cHydro'¶
The short name the model is registered under, if any. Set by the
aliasclass keyword; never inherited.
- calibration¶
Where this model was calibrated, with its source (
Noneif it was not).The class’s
calibration_domain, unless it depends on the instance’s parameters.
- calibration_domain: ClassVar[Domain | None] = Domain(bounds=(('m', Interval(lower=440000000000.0, upper=7000000000000000.0, unit=Unit("solMass / littleh"), lower_open=False, upper_open=False)), ('z', Interval(lower=0.0, upper=2.0, unit=None, lower_open=False, upper_open=False))), source="Bocquet et al. 2016 (arXiv v3): halo masses from 6.2e11 Msun (Table 1, Box4) to 1e16 Msun (Sec. 2.2), i.e. 4.4e11-7.0e15 Msun/h for their h = 0.704, in the fit's own mass definition; z = 0-2 (Fig. 2 caption; Sec. 4.1). One cosmology (WMAP7: Omega_m = 0.272, sigma_8 = 0.809; Sec. 2.1). sigma range: not stated.")¶
Where the fit was calibrated against simulations, with its source;
Nonefor a fit that was not calibrated (e.g. an analytic one). Ask an instance forcalibration.
- measured_mass_definition: ClassVar[MassDefinition] = SOCritical(overdensity=200.0)¶
The halo mass definition the fit was measured in (see “Mass definitions” in the
module documentation).
- measured_mass_definition_note: ClassVar[str] = 'Bocquet et al. 2016, Sec. 2.2. f(sigma) is meant to be used with sigma at M200m (issue #392), and the mass function with the ratio mass_ratio_to_200m (eq. 5; App. A), which modify_dndm applies.'¶
Where
measured_mass_definitioncomes from in the paper, and anything else worth knowing about it (halo finder, unbinding, …).
- modifies_dndm: ClassVar[bool] = True¶
Whether
modify_dndm_kernel()changes the mass function (see “Post-processing the mass function” in themodule documentation); if False, it is the identity.
- normalized¶
Whether \(f\) integrates to 1 over \(\ln\sigma^{-1}\) (all mass in haloes).
- parameter_source: ClassVar[str] = 'Bocquet et al. 2016 (arXiv v3 = published), Table 2; paper (a, b, c) -> hmf (b, e, d).'¶
The exact source (paper, version, table or equation) of the parameter defaults, e.g. “Tinker et al. 2008, ApJ 688, 709 (published), Table 2”.
- references: ClassVar[tuple[str, ...]] = ('Bocquet, S., et al., 2016. MNRAS 456, 2361. https://doi.org/10.1093/mnras/stv2657',)¶
References to cite when the model is used, each a formatted citation.
- requires: ClassVar[frozenset[str]] = frozenset({'z'})¶
The inputs (from
INPUTS) thatfsigma()needs, besides sigma.
- simulations: ClassVar[SimulationDetails | None] = SimulationDetails(box_size=<Quantity [ 47.9424, 128.128 , 896.896 , 2687.872 ] Mpc / littleh>, n_particles=(191102976, 191102976, 3553559576, 95006081547), omega_m=(0.272, 0.272, 0.272, 0.272), omega_b=(0.0456, 0.0456, 0.0456, 0.0456), sigma_8=(0.809, 0.809, 0.809, 0.809), h=(0.704, 0.704, 0.704, 0.704), n_s=(0.963, 0.963, 0.963, 0.963), softening=<Quantity [0.0009856, 0.00264 , 0.00704 , 0.00704 ] Mpc / littleh>, transfer=None, z_start=(60, 60, 60, 60), initial_conditions=('ZA', 'ZA', 'ZA', 'ZA'), halo_finder='SUBFIND', n_min=10000, z_range=(0.0, 2.0), names=('Box4/uhr', 'Box3/hr', 'Box1/mr', 'Box0/mr'), notes='Magneticum, hydrodynamical runs (as many gas particles as dark matter; Box4/uhr runs only to z = 0.13). Box sizes and softenings are given in Mpc and kpc (converted here).', source='Bocquet et al. 2016 (arXiv v3), Secs. 2.1-2.2 and Tables 1-2.')¶
The simulations the fit was calibrated on (None for a fit to no simulations).
- valid_domain: ClassVar[Domain] = Domain(bounds=(('sigma', Interval(lower=0.0, upper=inf, unit=None, lower_open=True, upper_open=True)), ('z', Interval(lower=0.0, upper=inf, unit=None, lower_open=False, upper_open=True))), source='sigma > 0 and z >= 0.')¶
fsigma()raises outside it.- Type:
Where the formula is defined or sensible
Methods
- check_required(x: FitInputs) None¶
Raise if an input needed to evaluate the fit is missing from
x.- Parameters:
x – The inputs.
- Raises:
ValueError – If an input in
requires(or needed to checkvalid_domain) is missing.
- check_valid(x: FitInputs) None¶
Raise if any input is outside
valid_domain.- Parameters:
x – The inputs.
- Raises:
DomainError – Always, if any value is outside the valid domain: this does not depend on any policy.
- classmethod coerce(value: object) Self¶
Convert a value to a model of this kind: the converter of a model field.
- Parameters:
value – An instance of
cls, which is returned as it is; or a name, import path or class thatget()accepts, which is looked up and instantiated with its default parameters.- Returns:
An instance of
cls.- Return type:
- Raises:
ModelNotFoundError – If
valueis a name that no model of this kind is known by.TypeError – If
valueis of any other type, or names a class that is not a concrete subclass ofcls.
Examples
>>> from hmf.core.filters import Filter, TopHat >>> Filter.coerce("TopHat") == TopHat() True
- classmethod domain_inputs() frozenset[str]¶
The inputs (besides sigma) needed to evaluate the fit and check both domains.
- classmethod fields_info() tuple[FieldInfo, ...]¶
Describe this class’s fields, without creating an instance.
- Returns:
The name, type, default and documentation of each field.
- Return type:
tuple of FieldInfo
- fsigma(sigma: ArrayLike, *, z: ArrayLike | None = None, omega_m_z: ArrayLike | None = None, delta_halo: ArrayLike | None = None, delta_c: ArrayLike | None = None, n_eff: ArrayLike | None = None, m: ArrayLike | None = None) ndarray[tuple[Any, ...], dtype[float64]]¶
The multiplicity function, \(f(\sigma) = \nu f(\nu)\).
mmust be a Quantity (seehmf.core.units); every other input is dimensionless. Code that already has plain arrays in canonical units callsfsigma_kernel()orevaluate_fsigma()instead (see “Evaluating a fit” in themodule documentation). It applies no calibration policy (seeevaluate_fsigma()for that), but always checksvalid_domain.- Parameters:
sigma – \(\sigma(m, z)\).
z – Redshift.
omega_m_z – \(\Omega_m(z)\).
delta_halo – The halo overdensity relative to the mean density.
delta_c – The critical overdensity for collapse.
n_eff – The effective spectral index.
m – The halo mass, a Quantity (e.g. in
Msun_h).
- Returns:
\(f(\sigma)\) (dimensionless), broadcast over the inputs.
- Return type:
- Raises:
ValueError – If an input the fit requires is not given.
UnitBoundaryError – If
mis not a Quantity.DomainError – If any input is outside
valid_domain, or makes the fit’s parameters unphysical.
- fsigma_kernel(x: FitInputs) ndarray[tuple[Any, ...], dtype[float64]]¶
fsigma()at kernel level, from inputs that are plain arrays.The inputs are in canonical units (the mass in Msun/h); see
hmf.core._kernels. It checks the valid domain, asfsigma()does, and applies no calibration policy (seeevaluate_fsigma()).- Parameters:
x – The inputs.
- Return type:
- Raises:
ValueError – If an input the fit requires is not in
x.DomainError – As for
fsigma().
- classmethod get(name: str | type[Model]) type[Self]¶
Look up a model of this kind.
- Parameters:
name – An alias (
"Tinker08"), a qualified name ("hmf.core.fits:Tinker08"), an import path to a class not yet imported ("pkg.mod:Cls"or"pkg.mod.Cls"), or a class.- Returns:
The model class (not an instance). It is always a subclass of
cls.- Return type:
- Raises:
ModelNotFoundError – If no model of this kind is known by
name, even after loading thehmf.modelsentry points and tryingnameas an import path.TypeError – If
nameresolves to something that is not a concrete subclass ofcls.
- classmethod get_aliases() Mapping[str, str]¶
Return a read-only mapping from alias to qualified name, for this kind.
- classmethod get_models() Mapping[str, type[Self]]¶
Return the registered models of this kind, by qualified name.
Plugins advertised in the
hmf.modelsentry-point group are loaded first.- Returns:
A read-only mapping from qualified name to class. Called on a kind, it is a live view of the registry. Called on a non-kind subclass, it holds only the models that subclass it.
- Return type:
Mapping
- in_calibration_domain_kernel(x: FitInputs) bool | ndarray[tuple[Any, ...], dtype[bool]]¶
Whether each input is inside
calibration, at kernel level.It checks
xagainstvalid_domain, asfsigma_kernel()does.- Parameters:
x – The inputs, from
inputs().- Returns:
A bool if every input is a scalar, else the broadcast array.
Trueif the fit has no calibration domain (it isNone).- Return type:
bool or numpy.ndarray of bool
- Raises:
ValueError – If an input needed to check the domain was not given.
DomainError – If any input is outside
valid_domain.
- inputs(sigma: ArrayLike, *, z: ArrayLike | None = None, omega_m_z: ArrayLike | None = None, delta_halo: ArrayLike | None = None, delta_c: ArrayLike | None = None, n_eff: ArrayLike | None = None, m: ArrayLike | None = None) FitInputs¶
Collect the inputs, checking that the required ones are given.
Parameters are as for
fsigma()(mis a Quantity). Code that already has plain arrays in canonical units callsinputs_from_arrays()instead (see “Evaluating a fit” in themodule documentation).- Parameters:
- Returns:
The inputs as plain arrays, in canonical units.
- Return type:
- Raises:
ValueError – If an input in
requires(or needed to checkvalid_domain) is missing.UnitBoundaryError – If
mis not a Quantity.
- inputs_from_arrays(sigma: ArrayLike, *, z: ArrayLike | None = None, omega_m_z: ArrayLike | None = None, delta_halo: ArrayLike | None = None, delta_c: ArrayLike | None = None, n_eff: ArrayLike | None = None, m: ArrayLike | None = None) FitInputs¶
Collect inputs that are plain arrays, checking that the required ones are given.
The one place where a
FitInputsis filled in:inputs(),fsigma()and library code (e.g. a mass-functionStage) all build theirs here. It does not check the values againstvalid_domain:fsigma_kernel()andevaluate_fsigma()do.- Parameters:
sigma – \(\sigma(m, z)\) (dimensionless).
z – As for
fsigma()(dimensionless);Noneif not given.omega_m_z – As for
fsigma()(dimensionless);Noneif not given.delta_halo – As for
fsigma()(dimensionless);Noneif not given.delta_c – As for
fsigma()(dimensionless);Noneif not given.n_eff – As for
fsigma()(dimensionless);Noneif not given.m – The halo mass in Msun/h, a plain array;
Noneif not given.
- Returns:
The inputs as float arrays.
- Return type:
- Raises:
ValueError – If an input in
requires(or needed to checkvalid_domain) is missing.
- mass_ratio_to_200m(m: Any, *, z: ArrayLike, omega_m0: ArrayLike, H0: Any) ndarray[tuple[Any, ...], dtype[float64]]¶
The ratio \(M_\Delta/M_{200m}\) of the fit’s mass to M200m.
Bocquet et al. build their 200c and 500c mass functions from \(dn/dM_\Delta = f(\sigma)(\bar\rho_m/M_\Delta)(d\ln\sigma^{-1}/dM_\Delta) (M_\Delta/M_{200m})\) (eq. 5), with this ratio: 1 for the 200m fits, eq. A2 for 200c and eq. 6 for 500c.
modify_dndm_kernel()multiplies the mass function by it (withmass_ratio_to_200m_kernel(), the same calculation on plain arrays in canonical units). Evaluating sigma at M200m is left to the mass-functionStage(issue #392).- Parameters:
m – Halo mass in the fit’s definition, a Quantity: in h-units, or physical units (converted with
H0).z – Redshift.
omega_m0 – The density parameter of CDM + baryons today.
H0 – The Hubble constant, a scalar Quantity (e.g.
70 * H0_unit). It converts physical masses, and gives h to the fits, which take ln(M / Msun).
- Returns:
The (dimensionless) ratio, broadcast over
mandz.- Return type:
numpy.float64 or numpy.ndarray
- mass_ratio_to_200m_kernel(m: ArrayLike, *, z: ArrayLike, omega_m0: ArrayLike, h: ArrayLike) ndarray[tuple[Any, ...], dtype[float64]]¶
mass_ratio_to_200m()at kernel level:ma plain array in Msun/h.A pure kernel (see
hmf.core._kernels):z,omega_m0andh(dimensionless) broadcast withm. It checks them from their extent.- Parameters:
m – Halo masses in the fit’s definition, in Msun/h: a plain array.
z – Redshift.
omega_m0 – The density parameter of CDM + baryons today.
h – The dimensionless Hubble parameter (the ratios take ln(M / Msun)).
- Returns:
\(M_\Delta/M_{200m}\), with the broadcast shape of the inputs.
- Return type:
- Raises:
DomainError – If an
m,omega_m0orhis not finite and > 0, or azis not finite and >= 0.
- modify_dndm(m: Any, dndm: Any, *, z: ArrayLike, ngtm: Any, H0: Any, omega_m0: ArrayLike) Any¶
Map the mass function computed from
fsigma()to the fit’s.The identity unless
modifies_dndm(see “Post-processing the mass function” in themodule documentation). Every fit takes the same arguments, whether it uses them or not. This method converts them and callsmodify_dndm_kernel(), which a mass-functionStagecalls directly.- Parameters:
m – Halo masses, a Quantity: in h-units, or physical units (converted with
H0).dndm – The mass function from
fsigma(), a Quantity (number density per mass).z – Redshift.
ngtm – The cumulative mass function n(>m) from
fsigma(), a Quantity.H0 – The Hubble constant, a scalar Quantity (e.g.
70 * H0_unit). It converts physical units, and gives h to fits whose formula is in physical units.omega_m0 – The density parameter of CDM + baryons today.
- Returns:
The fit’s mass function, in
dndm_unit.- Return type:
Quantity
- modify_dndm_kernel(m: ArrayLike, dndm: ArrayLike, *, z: ArrayLike, ngtm: ArrayLike, h: ArrayLike, omega_m0: ArrayLike) ndarray[tuple[Any, ...], dtype[float64]]¶
modify_dndm()at kernel level, on plain arrays.A pure kernel in canonical units (see
hmf.core._kernels): the identity, unless the fit setsmodifies_dndm(its class documentation describes the correction). All arguments broadcast. It checks the arguments that say where the mass function is evaluated (m,z,h,omega_m0), from their extent;dndmandngtmare values it maps, and may be NaN (e.g. masked by a domain policy).- Parameters:
- Returns:
The fit’s mass function, in h^4 / (Msun Mpc^3).
- Return type:
- Raises:
DomainError – If an
m,horomega_m0is not finite and > 0, or azis not finite and >= 0.
- parameters(z: ArrayLike) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]¶
The parameters (A, b, d, e) at redshift
z.- Parameters:
z – Redshift.
- Returns:
The parameters, each with the shape of
z.- Return type: