profiles.density.SNFWDensityProfile.compute_cosmological_overdensity_profile#
- SNFWDensityProfile.compute_cosmological_overdensity_profile(z: float, R: unyt_array | unyt_quantity, cosmology: Cosmology | None = None, **kwargs)#
Compute the spherical overdensity profile relative to the critical density at redshift \(z\).
The overdensity is defined as:
\[\Delta(R) = \frac{3 M(R)}{4 \pi R^3 \rho_{\mathrm{crit}}(z)}\]where \(M(R)\) is the enclosed mass and \(\rho_{\mathrm{crit}}(z)\) is the critical density.
- Parameters:
z (
float
) – Redshift at which to compute the critical density.R (
unyt_quantity
orunyt_array
) – Radius or array of radii where overdensity is computed (must carry length units).cosmology (
Cosmology
, optional) – Cosmology used to compute \(\rho_{\mathrm{crit}}(z)\). Defaults topisces_config['physics.default_cosmology']
.**kwargs – Additional arguments passed to
compute_enclosed_mass()
.
- Returns:
overdensity – Dimensionless overdensity \(\Delta(R)\) at each radius.
- Return type:
- Raises:
ValueError – If cosmology cannot compute the critical density.
Examples
import unyt from astropy.cosmology import Planck18 from pisces.profiles.density import ( NFWDensityProfile, ) profile = NFWDensityProfile( rho_0=0.05 * unyt.Msun / unyt.kpc**3, r_s=10 * unyt.kpc, ) R = unyt.array.unyt_array([1, 10, 100], "kpc") delta = profile.compute_cosmological_overdensity_profile( z=0.5, R=R, cosmology=Planck18 ) print(delta)