BaryonForge.Profiles.Schneider25 module
- class BaryonForge.Profiles.Schneider25.DarkMatter(self, r_max_int=10, **kwargs)[source]
Bases:
Schneider25ProfilesClass representing the dark matter (DM) density profile using a truncated Navarro-Frenk-White (NFW) model.
This class extends Schneider25Profiles to implement a real-space DM density profile that includes: - A standard NFW profile, - A truncation factor based on a halo-specific radius, - An additional exponential cutoff to prevent numerical overflow at large radii.
The truncation radius is defined as:
\[r_t = \epsilon(\nu) \cdot R,\]where:
\[\epsilon(\nu) = \epsilon_0 + \epsilon_1 \nu,\]and ( nu ) is the peak height of the halo.
The normalization of the profile is computed numerically by integrating over each halo’s radius from a fixed minimum value to its virial radius. This ensures the total mass is preserved while accounting for truncation.
The final density profile is given by:
\[\rho(r) = \frac{\rho_c}{(r/r_s)(1 + r/r_s)^2} \cdot \frac{1}{\left(1 + (r/r_t)^2\right)^2} \cdot \frac{1}{1 + \exp\left[2(r - r_\text{cutoff})\right]},\]where: - ( rho_c ) is the normalization to match the total halo mass, - ( r_s = R / c ) is the scale radius from the concentration–mass relation, - ( r_t ) is the truncation radius as defined above, - ( r_text{cutoff} ) is a user-defined soft cutoff radius to suppress unphysical densities at large ( r ).
Notes
If no concentration–mass relation is provided via cdelta or c_M_relation, the default Diemer & Kravtsov (2015) relation is used. The method handles both scalar and array inputs for radii and halo masses.
See Schneider25Profiles for base class documentation.
- class BaryonForge.Profiles.Schneider25.TwoHalo(self, r_max_int=10, **kwargs)[source]
Bases:
Schneider25ProfilesClass representing the two-halo term profile.
This class is derived from the Schneider25Profiles class and provides an implementation of the two-halo term profile. It utilizes the 2-point correlation function directly, rather than employing the full halo model.
See Schneider25Profiles for more docstring details.
Notes
The TwoHalo class calculates the two-halo term profile using the linear matter power spectrum to ensure the correct large-scale clustering behavior. The profile is defined using the matter-matter correlation function, \(\xi_{\text{mm}}(r)\), and a mass-dependent bias term.
The two-halo term density profile is given by:
\[\rho_{\text{2h}}(r) = \left(1 + b(M) \cdot \xi_{\text{mm}}(r)\right) \cdot \rho_{\text{m}}(a) \cdot \text{kfac}\]where:
\(b(M)\) is the linear halo bias, defined as:
\[b(M) = 1 + \frac{q \nu_M^2 - 1}{\delta_c} + \frac{2p}{\delta_c \left(1 + (q \nu_M^2)^p\right)}\]\(\nu_M\) is the peak height parameter, \(\nu_M = \delta_c / \sigma(M)\).
\(\delta_c\) is the critical density for spherical collapse.
\(\xi_{\text{mm}}(r)\) is the matter-matter correlation function.
\(\rho_{\text{m}}(a)\) is the mean matter density at scale factor a.
\(\text{kfac}\) is an additional exponential cutoff factor to prevent numerical overflow.
See Sheth & Tormen 1999 for more details on the bias prescription.
The two-halo term is only valid when the cosmology object’s matter power spectrum is set to ‘linear’. An assertion check is included to ensure this.
Examples
Create a TwoHalo profile and compute the density at specific radii:
>>> two_halo_profile = TwoHalo(**parameters) >>> cosmo = ... # Define or load a cosmology object with linear matter power spectrum >>> r = np.logspace(-2, 1, 50) # Radii in comoving Mpc >>> M = 1e14 # Halo mass in solar masses >>> a = 0.5 # Scale factor corresponding to redshift z >>> density_profile = two_halo_profile.real(cosmo, r, M, a)
- class BaryonForge.Profiles.Schneider25.Stars(self, **kwargs)[source]
Bases:
Schneider25ProfilesClass representing the two-halo term density profile based on linear theory.
This class extends Schneider25Profiles and implements the large-scale clustering contribution to the halo density profile (the two-halo term) using the linear matter correlation function and a Sheth-Tormen-type halo bias prescription.
The real-space profile is defined as:
\[\rho_{\mathrm{2h}}(r) = \left[1 + b(M)\,\xi_{\mathrm{mm}}(r)\right] \cdot \bar{\rho}_m(a) \cdot f_{\mathrm{excl}}(r, R) \cdot k_{\mathrm{cut}}(r),\]where: - ( b(M) ) is the halo bias, given by:
\[b(M) = 1 + \frac{q \nu^2 - 1}{\delta_c} + \frac{2p}{\delta_c\left[1 + (q \nu^2)^p\right]},\]( nu = delta_c / sigma(M) ) is the peak height,
( delta_c ) is the critical overdensity for collapse (rescaled by growth factor),
( xi_{mathrm{mm}}(r) ) is the linear matter correlation function,
( bar{rho}_m(a) ) is the mean matter density at scale factor ( a ),
( f_{mathrm{excl}}(r, R) = 1 - expleft[-alpha_{mathrm{excl}} cdot (r / R)right] ) suppresses the profile at small radii,
( k_{mathrm{cut}}(r) = [1 + exp(2(r - r_{mathrm{cutoff}}))]^{-1} ) imposes an exponential cutoff at large radii to ensure convergence in Fourier space.
Notes
The two-halo term is valid only when the cosmology object’s matter power spectrum is linear. An assertion enforces this requirement.
If xi_mm is not provided at initialization, it is computed using pyccl.correlation_3d.
Scalar and vector inputs for mass and radius are supported and mirrored in the output shape.
See also
Sheth,https,NoneExamples
>>> profile = TwoHalo(**parameters) >>> cosmo = ... # cosmology with linear power spectrum >>> r = np.logspace(-2, 1, 100) >>> M = 1e14 >>> a = 0.5 >>> rho_2h = profile.real(cosmo, r, M, a)
- class BaryonForge.Profiles.Schneider25.SatelliteStars(self, hotgas=None, innergas=None, stars=None, darkmatter=None, r_min_int=1e-08, r_max_int=100000.0, r_steps=5000, **kwargs)[source]
Bases:
CollisionlessMatterClass representing the matter density profile of stars in satellites.
It uses the CollisionlessMatter profiles with a simple rescaling to get just the SG (satellite galaxies) term alone. See that class for more details.
- class BaryonForge.Profiles.Schneider25.Gas(self, **kwargs)[source]
Bases:
Schneider25ProfilesConvenience class for combining gas components in halos.
The Gas class provides a unified interface for modeling the total gas profile in halos. It combines contributions from the following components: - HotGas: Represents the hot gas component within halos. - InnerGas: Represents gas in the inner core of the halo. Generally not a notable fraction of the gas
This class simplifies calculations by leveraging the logic and methods of these individual gas components and combining their profiles into a single representation.
- class BaryonForge.Profiles.Schneider25.CollisionlessMatter(self, hotgas=None, innergas=None, stars=None, darkmatter=None, r_min_int=1e-08, r_max_int=100000.0, r_steps=5000, **kwargs)[source]
Bases:
Schneider25ProfilesClass representing the collisionless matter density profile after adiabatic relaxation.
This class extends Schneider25Profiles to compute the final density profile of collisionless matter (dark matter + stars) after accounting for the effects of baryonic components such as hot and inner gas. The computation is performed using a (non-iterative) relaxation method based on the formalism in Schneider et al. (2025).
The final profile reflects how baryons gravitationally reshape the collisionless component, conserving total mass and enforcing physical consistency between baryonic and dark matter distributions.
- Parameters:
hotgas (HotGas, optional) – Instance of the HotGas class. If not provided, one is created from kwargs.
innergas (InnerGas, optional) – Instance of the InnerGas class. If not provided, one is created from kwargs.
stars (Stars, optional) – Instance of the Stars class. If not provided, one is created from kwargs.
darkmatter (DarkMatter, optional) – Instance of the DarkMatter class. If not provided, one is created from kwargs.
r_min_int (float, optional) – Minimum radius for internal integrations (default: 1e-8 Mpc).
r_max_int (float, optional) – Maximum radius for internal integrations (default: 1e5 Mpc).
r_steps (int, optional) – Number of radial steps used for integration (default: 5000).
**kwargs (dict) – Additional keyword arguments passed to initialize subcomponents and the base class.
Notes
The relaxation process proceeds as follows:
Compute individual density profiles for dark matter, hot gas, inner gas, and stars.
Integrate each profile to obtain cumulative mass profiles.
Compute the collisionless matter mass profile:
\[M_{\mathrm{CLM}}(r) = f_{\mathrm{clm}} \cdot M_{\mathrm{tot}}(r')\]where ( f_{mathrm{clm}} = 1 - Omega_b / Omega_m + f_{mathrm{sga}} ) and ( r’ = r cdot zeta ) with the relaxation factor ( zeta ) defined as:
\[\zeta = Q_0 / (1 + (r/r_s)^n) + Q_1 f_{\mathrm{cga}} \left( \frac{M_{\mathrm{stars}}}{M_{\mathrm{DM}}} - 1 \right) + Q_1 f_{\mathrm{iga}} \left( \frac{M_{\mathrm{inner}}}{M_{\mathrm{DM}}} - 1 \right) + Q_2 f_{\mathrm{hga}} \left( \frac{M_{\mathrm{hot}}}{M_{\mathrm{DM}}} - 1 \right) + 1\]Differentiate the relaxed mass profile to obtain the final density:
\[\rho_{\mathrm{CLM}}(r) = \frac{1}{4\pi r^2} \frac{dM_{\mathrm{CLM}}}{dr}\]
An additional exponential cutoff is applied at large radii for numerical stability.
Warning
A warning is issued if the requested radii fall outside the integration bounds. These warnings are often benign and can be ignored if they arise from extreme FFTlog sampling.
Examples
>>> clm = CollisionlessMatter(**parameters) >>> cosmo = ... # Cosmology object >>> r = np.logspace(-2, 1, 100) >>> M = 1e14 >>> a = 0.5 >>> rho_clm = clm.real(cosmo, r, M, a)
- class BaryonForge.Profiles.Schneider25.DarkMatterOnly(self, darkmatter=None, twohalo=None, **kwargs)[source]
Bases:
Schneider25ProfilesClass representing a combined dark matter profile using the NFW profile and the two-halo term.
This class is derived from the Schneider25Profiles class and provides an implementation that combines the contributions from the Navarro-Frenk-White (NFW) profile (representing dark matter within the halo) and the two-halo term (representing the contribution of neighboring halos). This approach models the total dark matter distribution by considering both the one-halo and two-halo terms.
- Parameters:
darkmatter (DarkMatter, optional) – An instance of the DarkMatter class defining the NFW profile for dark matter within a halo. If not provided, a default DarkMatter object is created using kwargs.
twohalo (TwoHalo, optional) – An instance of the TwoHalo class defining the two-halo term profile, representing the contribution from neighboring halos. If not provided, a default TwoHalo object is created using kwargs.
**kwargs – Additional keyword arguments passed to initialize the DarkMatter and TwoHalo profiles, as well as other parameters from Schneider25Profiles.
Notes
The DarkMatterOnly class models the total dark matter density profile by summing the contributions from a one-halo term (using the NFW profile) and a two-halo term. This provides a more complete description of the dark matter distribution, accounting for both the mass within individual halos and the influence of surrounding structure.
The total dark matter density profile is calculated as:
\[\rho_{\text{DMO}}(r) = \rho_{\text{NFW}}(r) + \rho_{\text{2h}}(r)\]where:
\(\rho_{\text{NFW}}(r)\) is the NFW profile for the dark matter halo.
\(\rho_{\text{2h}}(r)\) is the two-halo term representing contributions from neighboring halos.
\(r\) is the radial distance from the center of the halo.
This class provides a way to model dark matter distribution that includes the impact of both the immediate halo and the larger-scale structure, which is important for understanding clustering and cosmic structure formation.
See the DarkMatter and TwoHalo classes for more details on the underlying profiles and their parameters.
- class BaryonForge.Profiles.Schneider25.DarkMatterBaryon(self, gas=None, stars=None, collisionlessmatter=None, darkmatter=None, twohalo=None, r_min_int=1e-05, r_max_int=100, r_steps=500, **kwargs)[source]
Bases:
Schneider25ProfilesClass representing a combined dark matter and baryonic matter profile.
This class is derived from the Schneider25Profiles class and provides an implementation that combines the contributions from dark matter, gas, stars, and collisionless matter to compute the total density profile. It includes both one-halo and two-halo terms, ensuring mass conservation and accounting for both dark matter and baryonic components.
- Parameters:
gas (Gas, optional) – An instance of the Gas class defining the gas profile. If not provided, a default Gas object is created using kwargs.
stars (Stars, optional) – An instance of the Stars class defining the stellar profile. If not provided, a default Stars object is created using kwargs.
collisionlessmatter (CollisionlessMatter, optional) – An instance of the CollisionlessMatter class defining the profile that combines dark matter, gas, and stars. If not provided, a default CollisionlessMatter object is created using kwargs.
darkmatter (DarkMatter, optional) – An instance of the DarkMatter class defining the NFW profile for dark matter. If not provided, a default DarkMatter object is created using kwargs.
twohalo (TwoHalo, optional) – An instance of the TwoHalo class defining the two-halo term profile, representing the contribution of neighboring halos. If not provided, a default TwoHalo object is created using kwargs.
**kwargs – Additional keyword arguments passed to initialize the Gas, Stars, CollisionlessMatter, DarkMatter, and TwoHalo profiles, as well as other parameters from Schneider25Profiles.
Notes
The DarkMatterBaryon class models the total matter density profile by combining contributions from collisionless matter, gas, stars, dark matter, and the two-halo term. This comprehensive approach accounts for the interaction and distribution of both dark matter and baryonic matter within halos and across neighboring halos.
Calculation Steps:
Normalization of Dark Matter: To ensure mass conservation, the one-halo term is normalized so that the dark matter-only profile matches the dark matter-baryon profile at large radii. The normalization factor is calculated as:
\[\text{Factor} = \frac{M_{\text{DMO}}}{M_{\text{DMB}}}\]where:
\(M_{\text{DMO}}\) is the total mass from the dark matter-only profile.
\(M_{\text{DMB}}\) is the total mass from the combined dark matter and baryon profile.
Total Density Profile: The total density profile is computed by summing the contributions from the collisionless matter, stars, gas, and two-halo term, scaled by the normalization factor:
\[\rho_{\text{total}}(r) = \rho_{\text{CLM}}(r) \cdot \text{Factor} + \rho_{\text{stars}}(r) \cdot \text{Factor} + \rho_{\text{gas}}(r) \cdot \text{Factor} + \rho_{\text{2h}}(r)\]where:
\(\rho_{\text{CLM}}(r)\) is the density from the collisionless matter profile.
\(\rho_{\text{stars}}(r)\) is the stellar density profile.
\(\rho_{\text{gas}}(r)\) is the gas density profile.
\(\rho_{\text{2h}}(r)\) is the two-halo term density profile.
This method ensures that both dark matter and baryonic matter are accounted for, providing a realistic representation of the total matter distribution.
See Schneider25Profiles, Gas, Stars, CollisionlessMatter, DarkMatter, and TwoHalo classes for more details on the underlying profiles and parameters.