SphericalOverdensity

class hmf.core.mass_definitions.SphericalOverdensity[source]

Base class of the spherical-overdensity definitions.

Attributes

name

A short name, e.g. "200m", "500c", "vir", "fof(b=0.2)".

from_name() reads it back to an equal definition: a number that :g would round (e.g. 18 pi^2) is written in full.

references: ClassVar[tuple[str, ...]] = ()
resolved

itself (an SOGeneric’s preferred).

Type:

The definition masses are actually in

Methods

accepts(other: MassDefinition) → bool

Whether a fit measured in this definition can be evaluated in other directly.

Every definition accepts itself (an equal value); SOGeneric also accepts every SphericalOverdensity.

Parameters:

other – The definition asked for.

Return type:

bool

delta_halo_mean(*, omega_m_z: ArrayLike) → ndarray[tuple[Any, ...], dtype[float64]]

The halo overdensity relative to the mean density of CDM + baryons.

See delta_halo_mean_kernel().

Parameters:

omega_m_z (float or array_like) – \(\Omega_m(z)\) of CDM + baryons.

Returns:

\(\Delta_m\).

Return type:

numpy.float64 or numpy.ndarray

delta_halo_mean_kernel(*, omega_m_z: ArrayLike) → ndarray[tuple[Any, ...], dtype[float64]]

The halo overdensity relative to the mean density, \(\Delta_m\).

A pure, elementwise kernel of \(\Omega_m(z)\) (of CDM + baryons), on plain arrays. Each subclass documents its formula.

Parameters:

omega_m_z – \(\Omega_m(z)\), dimensionless.

Returns:

\(\Delta_m\), dimensionless, with the shape of omega_m_z.

Return type:

numpy.ndarray

Raises:
  • DomainError – If an \(\Omega_m(z)\) is not finite and > 0.

  • ValueError – For a definition without an overdensity (SelfBound).

classmethod from_name(name: str) → MassDefinition

The definition of a short name: "<Delta>m", "<Delta>c", "vir", …

Parameters:

name – "200m" (SOMean), "500c" (SOCritical), "vir" (SOVirial), "so(preferred 200m)" (SOGeneric, with the name of its preferred definition), "fof" or "fof(b=0.3)" (FOF) or "self_bound" (SelfBound); case and spaces are ignored.

Return type:

MassDefinition

Raises:

ValueError – If the name is not one of these.

halo_density(*, omega_m_z: ArrayLike, rho_mean0: Any) → ndarray[tuple[Any, ...], dtype[float64]]

The comoving halo density (see halo_density_kernel()).

Parameters:
  • omega_m_z (float or array_like) – \(\Omega_m(z)\) of CDM + baryons.

  • rho_mean0 (Quantity) – The comoving mean density of CDM + baryons, in Msun h^2 / Mpc^3.

Returns:

In Msun h^2 / Mpc^3.

Return type:

Quantity

halo_density_kernel(*, omega_m_z: ArrayLike, rho_mean0: ArrayLike) → ndarray[tuple[Any, ...], dtype[float64]]

The comoving halo density, \(\Delta_m\bar\rho_{\rm cb,0}\).

Parameters:
  • omega_m_z – \(\Omega_m(z)\) of CDM + baryons, dimensionless.

  • rho_mean0 – The comoving mean density of CDM + baryons, in Msun h^2 / Mpc^3 (hmf.core.species.rho_mean0()); broadcast with omega_m_z.

Returns:

In Msun h^2 / Mpc^3 (comoving); times \((1+z)^3\) for the physical one.

Return type:

numpy.ndarray

Raises:
  • DomainError – If a value is not finite and > 0.

  • ValueError – For a definition without an overdensity.

m_from_radius(*, r: Any, omega_m_z: ArrayLike, rho_mean0: Any) → ndarray[tuple[Any, ...], dtype[float64]]

The mass of haloes of comoving radius r (see m_from_radius_kernel()).

Parameters:
  • r (Quantity) – Comoving radii in Mpc/h.

  • omega_m_z (float or array_like) – \(\Omega_m(z)\) of CDM + baryons.

  • rho_mean0 (Quantity) – The comoving mean density of CDM + baryons, in Msun h^2 / Mpc^3.

Returns:

Masses in Msun/h, in this definition.

Return type:

Quantity

m_from_radius_kernel(*, r: ArrayLike, omega_m_z: ArrayLike, rho_mean0: ArrayLike) → ndarray[tuple[Any, ...], dtype[float64]]

The mass of haloes of comoving radius r: \(4\pi r^3\rho_{\rm halo}/3\).

Parameters:
  • r – Comoving radii in Mpc/h.

  • omega_m_z – \(\Omega_m(z)\) of CDM + baryons, broadcast with r.

  • rho_mean0 – The comoving mean density of CDM + baryons, in Msun h^2 / Mpc^3.

Returns:

Masses in Msun/h, in this definition, with the broadcast shape.

Return type:

numpy.ndarray

Raises:
  • DomainError – If a value is not finite and > 0.

  • ValueError – For a definition without an overdensity.

radius_from_m(*, m: Any, omega_m_z: ArrayLike, rho_mean0: Any) → ndarray[tuple[Any, ...], dtype[float64]]

The comoving radius of haloes of mass m (see radius_from_m_kernel()).

Parameters:
  • m (Quantity) – Masses in Msun/h, in this definition.

  • omega_m_z (float or array_like) – \(\Omega_m(z)\) of CDM + baryons.

  • rho_mean0 (Quantity) – The comoving mean density of CDM + baryons, in Msun h^2 / Mpc^3.

Returns:

Comoving radii in Mpc/h.

Return type:

Quantity

radius_from_m_kernel(*, m: ArrayLike, omega_m_z: ArrayLike, rho_mean0: ArrayLike) → ndarray[tuple[Any, ...], dtype[float64]]

The comoving radius of haloes of mass m: \([3m/(4\pi\rho_{\rm halo})]^{1/3}\).

Parameters:
  • m – Masses in Msun/h, in this definition.

  • omega_m_z – \(\Omega_m(z)\) of CDM + baryons, broadcast with m.

  • rho_mean0 – The comoving mean density of CDM + baryons, in Msun h^2 / Mpc^3.

Returns:

Comoving radii in Mpc/h, with the broadcast shape.

Return type:

numpy.ndarray

Raises:
  • DomainError – If a value is not finite and > 0.

  • ValueError – For a definition without an overdensity.