Watson¶
- class hmf.core.fits.Watson(*, C_a=0.023, d_a=0.456, d_b=0.139, p=0.072, q=2.13, A_0=0.194, alpha_0=1.805, beta_0=2.267, gamma_0=1.287, z_hi=6.0, A_hi=0.563, alpha_hi=3.81, beta_hi=0.874, gamma_hi=1.453, A_a=1.097, A_b=3.216, A_c=0.074, alpha_a=5.907, alpha_b=3.599, alpha_c=2.344, beta_a=3.136, beta_b=3.058, beta_c=2.349, gamma_z=1.318)[source]¶
The Watson et al. (2013) spherical-overdensity (AHF) mass function.
\[f(\sigma) = \Gamma(\Delta, \sigma, z)\, A\left[\left(\frac{\beta}{\sigma} \right)^\alpha + 1\right]\exp\left(-\frac{\gamma}{\sigma^2}\right).\]Three fits are used, by redshift (published v4 of the paper): at z = 0 the present-day fit (
*_0); at \(z \ge\)z_hithe high-redshift fit (*_hi); in between the redshift-dependent fit of eqs. 14-16, \(X(z) = \Omega_m(z)[X_a(1+z)^{-X_b} + X_c]\) for \(X = A, \alpha, \beta\), and \(\gamma =\)gamma_z. As in the paper, the fits are not joined smoothly. \(\Gamma\) (eq. 12) corrects for the halo overdensity \(\Delta\) (relative to the mean), and is 1 at \(\Delta = 178\).- Parameters:
C_a (float, default 0.023) – Gamma: the coefficient of the C(Delta) exponent.
d_a (float, default 0.456) – Gamma: d = -d_a Omega_m(z) - d_b.
d_b (float, default 0.139) – Gamma: d = -d_a Omega_m(z) - d_b.
p (float, default 0.072) – Gamma: the amplitude p of the sigma-dependent term.
q (float, default 2.13) – Gamma: the exponent q of sigma.
A_0 (float, default 0.194) – A of the z = 0 fit.
alpha_0 (float, default 1.805) – alpha of the z = 0 fit.
beta_0 (float, default 2.267) – beta of the z = 0 fit.
gamma_0 (float, default 1.287) – gamma of the z = 0 fit.
z_hi (float, default 6.0) – The redshift from which the high-redshift fit is used.
A_hi (float, default 0.563) – A of the high-redshift fit.
alpha_hi (float, default 3.81) – alpha of the high-redshift fit.
beta_hi (float, default 0.874) – beta of the high-redshift fit.
gamma_hi (float, default 1.453) – gamma of the high-redshift fit.
A_a (float, default 1.097) – A(z) = Omega_m(z) [A_a (1+z)^-A_b + A_c].
A_b (float, default 3.216) – A(z) = Omega_m(z) [A_a (1+z)^-A_b + A_c].
A_c (float, default 0.074) – A(z) = Omega_m(z) [A_a (1+z)^-A_b + A_c].
alpha_a (float, default 5.907) – alpha(z), as for A(z).
alpha_b (float, default 3.599) – alpha(z), as for A(z).
alpha_c (float, default 2.344) – alpha(z), as for A(z).
beta_a (float, default 3.136) – beta(z), as for A(z).
beta_b (float, default 3.058) – beta(z), as for A(z).
beta_c (float, default 2.349) – beta(z), as for A(z).
gamma_z (float, default 1.318) – gamma of the redshift-dependent fit.
Model metadata
- alias: ClassVar[str | None] = 'Watson'¶
The short name the model is registered under, if any. Set by the
aliasclass keyword; never inherited.
- calibration_domain: ClassVar[Domain | None] = Domain(bounds=(('delta_halo', Interval(lower=100.0, upper=1600.0, unit=None, lower_open=False, upper_open=False)), ('ln_sigma_inv', Interval(lower=-0.55, upper=1.05, unit=None, lower_open=False, upper_open=False)), ('z', Interval(lower=0.0, upper=26.0, unit=None, lower_open=False, upper_open=False))), source="Watson et al. 2013, AHF haloes: the z = 0 fit is 'valid in the range -0.55 <= ln(1/sigma) < 1.05' (Sec. 4.5.2); the z-dependent fit is accurate to ~10% for z < 15 (Sec. 4.5.2, Fig. 9; no sigma range stated); the z >= 6 fit to 'all our data from z = 6 upwards' (Fig. 10, z = 6-26), valid for -0.06 <= ln(1/sigma) < 1.24. Gamma is calibrated for 100 <= Delta <= 1600 at z = 0, 1 and 3 (Sec. 4.6). WMAP5 (Omega_m = 0.27, sigma_8 = 0.8).")¶
Where the fit was calibrated against simulations, with its source;
Nonefor a fit that was not calibrated (e.g. an analytic one).
- measured_mass_definition: ClassVar[MeasuredMassDefinition] = MeasuredMassDefinition(kind='so_any', linking_length=None, overdensity=None, preferred=MeasuredMassDefinition(kind='so_mean', linking_length=None, overdensity=178, preferred=None, note=''), note='Watson et al. 2013, Sec. 3.3: SO with Delta = 178 times the mean density (where Gamma = 1); AHF host haloes. hmf 3.x preferred the virial definition.')¶
The halo mass definition the fit was measured in.
- modifies_dndm: ClassVar[bool] = False¶
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] = "Watson et al. 2013 (arXiv v4 = published): Table 2 (z = 0 'AHF' and z >= 6 fits; the Sec. 4.5.2 text swaps alpha_0 and beta_0, Table 2 is followed), eqs. 14-16 (0 < z < 6) and eqs. 17-19 (Gamma)."¶
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, ...]] = ('Watson, W. A., et al., 2013. MNRAS 433, 1230. https://doi.org/10.1093/mnras/stt791',)¶
References to cite when the model is used, each a formatted citation.
- requires: ClassVar[frozenset[str]] = frozenset({'delta_halo', 'omega_m_z', 'z'})¶
The inputs (from
INPUTS) thatfsigma()needs, besides sigma.
- simulations: ClassVar[SimulationDetails | None] = SimulationDetails(box_size=<Quantity [ 11.4, 20. , 114. , 425. , 1000. , 3200. , 6000. ] Mpc / littleh>, n_particles=(28991029248, 165288374272, 28991029248, 165288374272, 41278242816, 64000000000, 216000000000), omega_m=(0.27, 0.27, 0.27, 0.27, 0.279, 0.279, 0.27), omega_b=(0.044, 0.044, 0.044, 0.044, 0.046, 0.046, 0.044), sigma_8=(0.8, 0.8, 0.8, 0.8, 0.817, 0.817, 0.8), h=(0.7, 0.7, 0.7, 0.7, 0.701, 0.701, 0.7), n_s=(0.96, 0.96, 0.96, 0.96, 0.96, 0.96, 0.96), softening=<Quantity [0.00018, 0.00018, 0.00186, 0.00387, 0.01447, 0.04 , 0.05 ] Mpc / littleh>, transfer=('CAMB', 'CAMB', 'CAMB', 'CAMB', 'CAMB', 'CAMB', 'CAMB'), z_start=(300, 300, 300, 300, 150, 120, 100), initial_conditions=('ZA', 'ZA', 'ZA', 'ZA', 'ZA', 'ZA', 'ZA'), halo_finder='AHF', n_min=1000, z_range=(0.0, 30.0), names=None, notes='As for Watson_FoF; haloes found with AHF (host haloes only). The redshift evolution was calibrated on the CPMSO haloes.', source='Watson et al. 2013 (arXiv v4), Secs. 2.1-2.2, 4.3 and Table 1.')¶
The simulations the fit was calibrated on (None for a fit to no simulations).
- valid_domain: ClassVar[Domain] = Domain(bounds=(('delta_halo', Interval(lower=1.0, upper=inf, unit=None, lower_open=False, upper_open=True)), ('omega_m_z', Interval(lower=0.0, upper=inf, unit=None, lower_open=True, upper_open=True)), ('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, z >= 0, Omega_m(z) > 0, and Delta >= 1 (a halo is overdense; Gamma diverges as Delta -> 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.- 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.- 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(x: FitInputs) bool | ndarray[tuple[Any, ...], dtype[bool]]¶
Whether each input is inside
calibration_domain.- 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.
- 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 buildsFitInputsdirectly (see “Evaluating a fit” in themodule documentation).- 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.
- 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, omega_m_z: ArrayLike) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]¶
The parameters \((A, \alpha, \beta, \gamma)\) at redshift
z.- Parameters:
z – Redshift.
omega_m_z – \(\Omega_m(z)\).
- Returns:
\(A, \alpha, \beta, \gamma\), broadcast over the inputs.
- Return type: