BaryonForge.Profiles.Arico20 module
- class BaryonForge.Profiles.Arico20.AricoProfiles(self, r_max_int=10, **kwargs)[source]
Bases:
BaseBFGProfilesBase class for defining halo density profiles based on Arico et al. models.
This class extends the ccl.halos.profiles.HaloProfile class and provides additional functionality for handling different halo density profiles. It allows for custom real-space projection methods, control over parameter initialization, and adjustments to the Fourier transform settings to minimize artifacts.
- Parameters:
use_fftlog_projection (bool, optional) – If True, the default FFTLog projection method is used for the projected method. If False, a custom real-space projection is employed. Default is False.
padding_lo_proj (float, optional) – The lower padding factor for the projection integral in real-space. Default is 0.1.
padding_hi_proj (float, optional) – The upper padding factor for the projection integral in real-space. Default is 10.
n_per_decade_proj (int, optional) – Number of integration points per decade in the real-space projection integral. Default is 10.
xi_mm (callable, optional) – A function that returns the matter-matter correlation function at different radii. Default is None, in which case we use the CCL inbuilt model.
**kwargs – Additional keyword arguments for setting specific parameters of the profile. If a parameter is not specified, defaults are assigned based on its type (e.g., mass/redshift/conc-dependence).
- precision_fftlog
Dictionary with precision settings for the FFTLog convolution. Can be modified directly or using the update_precision_fftlog() method.
- Type:
- real(cosmo, r, M, a)
Computes the real-space density profile.
- projected(cosmo, r, M, a)
Computes the projected density profile.
- model_param_names = ['cdelta', 'a', 'n', 'q', 'p', 'cutoff', 'proj_cutoff', 'theta_out', 'theta_inn', 'M_inn', 'M_c', 'mu', 'beta', 'M_r', 'beta_r', 'eta', 'theta_rg', 'sigma_rg', 'epsilon_hydro', 'M1_0', 'alpha_g', 'epsilon_h', 'M1_fsat', 'eps_fsat', 'alpha_fsat', 'delta_fsat', 'gamma_fsat', 'A_nt', 'alpha_nt', 'mean_molecular_weight']
- class BaryonForge.Profiles.Arico20.DarkMatter(self, r_max_int=10, **kwargs)[source]
Bases:
AricoProfilesClass for modeling the dark matter density profile using the NFW (Navarro-Frenk-White) framework.
This class extends AricoProfiles to compute the dark matter density profile, incorporating flexible concentration-mass relations and a truncated profile at large radii.
Notes
The dark matter profile is calculated using the NFW formula, which depends on the halo’s mass and concentration. The normalization is determined analytically to ensure that the total mass within the virial radius matches the input halo mass.
The density profile is given by:
\[\begin{split}\rho(r) = \begin{cases} \frac{\rho_c}{(r/r_s)(1 + r/r_s)^2}, & r \leq R \\ 0, & r > R \end{cases}\end{split}\]where: - ( rho_c ) is the characteristic density, computed using the halo mass. - ( r_s ) is the scale radius, defined as ( R/c ), where ( R ) is the virial radius and ( c ) is the concentration parameter.
- class BaryonForge.Profiles.Arico20.TwoHalo(self, r_max_int=10, **kwargs)[source]
Bases:
TwoHalo,AricoProfilesClass representing the two-halo term profile.
This class is derived from the AricoProfiles 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 AricoProfiles 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.Arico20.Stars(self, r_min_int=1e-06, r_max_int=5, **kwargs)[source]
Bases:
AricoProfilesClass for modeling the stellar density profile in halos.
This class extends AricoProfiles to compute the density profile of stars within halos. The profile accounts for the stellar fraction, redshift evolution, and a normalized radial distribution.
Notes
The radial profile is modeled with a power-law dependence and an exponential cutoff, normalized to integrate to the stellar mass within the halo.
The stellar fraction is computed using the _get_star_frac method, which depends on halo mass and redshift.
The stellar density profile is given by:
\[\rho_{\star}(r) = \frac{f_{\text{cga}} M}{R_h r^{\alpha_g}} \cdot \exp\left(-\frac{r^2}{4 R_h^2}\right) \cdot \frac{1}{N}\]where: - ( f_{text{cga}} ) is the stellar fraction at a given halo mass and redshift. - ( M ) is the halo mass. - ( R_h ) is the scale radius, proportional to the halo virial radius. - ( alpha_g ) is the power-law slope parameter. - ( N ) is the numerically computed normalization factor, computed to ensure mass conservation.
- class BaryonForge.Profiles.Arico20.Gas(self, **kwargs)[source]
Bases:
AricoProfilesConvenience 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: - BoundGas: Represents the bound gas component within halos. - EjectedGas: Represents gas that has been ejected from halos due to feedback processes. - ReaccretedGas: Represents gas that has been reaccreted onto halos after ejection.
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.Arico20.BoundGas(self, r_max_int=10, **kwargs)[source]
Bases:
BoundGasUntruncatedClass for modeling the bound gas density profile in halos. Simply the BoundGasUntruncated class but with a truncation at R200c.
This class extends AricoProfiles to compute the density profile of bound gas within halos. This follows the updated model from https://arxiv.org/pdf/2009.14225 rather than the original model.
Notes
- Radial dependence is modeled using two scale radii:
( R_{text{co}} ): Core radius, controlling the central density slope.
( R_{text{ej}} ): Outer radius, controlling the cutoff.
The bound gas fraction (( f_{text{bg}} )) is derived by subtracting the contributions of stellar and ejected gas fractions from the total baryon fraction.
The density profile is given by:
\[\begin{split}\rho_{\text{bg}}(r) = \begin{cases} \frac{f_{\text{bg}} M}{N} \cdot \frac{1}{(1 + u)^{\beta}} \cdot \frac{1}{(1 + v^2)^2}, & r \leq R \\ 0, & r > R \end{cases}\end{split}\]where: - ( u = r / R_{text{co}} ), ( v = r / R_{text{ej}} ) - ( R_{text{co}} = theta_{text{inn}} R ), ( R_{text{ej}} = theta_{text{out}} R ) - ( beta ) is the slope parameter, and ( N ) is the normalization factor. - R is the spherical overdensity radius of the halo
- class BaryonForge.Profiles.Arico20.EjectedGas(self, r_max_int=10, **kwargs)[source]
Bases:
AricoProfilesClass for modeling the ejected gas density profile in halos.
This class extends AricoProfiles to compute the density profile of gas that has been ejected from halos due to feedback processes, such as supernovae or AGN activity. The profile is a simple Gaussian, with a scale set by the escape radius.
Notes
The ejected gas fraction (( f_{text{eg}} )) is calculated as the remainder of the baryonic fraction after subtracting the stellar and bound gas components.
The ejection radius (( R_{text{ej}} )) is derived from the escape radius, scaled by a parameter ( eta ).
The radial density profile follows a Gaussian distribution, normalized to integrate to the total ejected gas mass.
The density profile is given by:
\[\rho_{\text{eg}}(r) = \frac{f_{\text{eg}} M}{(2 \pi R_{\text{ej}}^2)^{3/2}} \cdot \exp\left(-\frac{r^2}{2 R_{\text{ej}}^2}\right)\]where: - ( f_{text{eg}} ) is the ejected gas fraction. - ( M ) is the halo mass. - ( R_{text{ej}} = eta cdot R_{text{esc}} ), where ( R_{text{esc}} ) is
the escape radius calculated from the halo’s escape velocity.
- class BaryonForge.Profiles.Arico20.ReaccretedGas(self, r_max_int=10, **kwargs)[source]
Bases:
AricoProfilesClass for modeling the reaccreted gas density profile in halos.
This class extends AricoProfiles to compute the density profile of gas that has been reaccreted onto halos after being ejected, incorporating redshift evolution and mass dependence.
Notes
The reaccreted gas fraction (( f_{text{rg}} )) is derived by subtracting the contributions of stellar, ejected, and bound gas fractions from the total baryon fraction.
The radial profile is modeled as a Gaussian distribution with a peak radius (( R_{text{rg}} )) and width (( sigma_{text{rg}} )).
The profile is normalized analytically to ensure that the total reaccreted gas mass integrates correctly.
The density profile is given by:
\[\rho_{\text{rg}}(r) = \frac{f_{\text{rg}} M}{N} \cdot \frac{1}{\sqrt{2 \pi \sigma_{\text{rg}}^2}} \cdot \exp\left(-\frac{(r - R_{\text{rg}})^2}{2 \sigma_{\text{rg}}^2}\right)\]where: - ( f_{text{rg}} ) is the reaccreted gas fraction. - ( M ) is the halo mass. - ( R_{text{rg}} = theta_{text{rg}} R ) is the characteristic radius for reaccreted gas. - ( sigma_{text{rg}} = sigma_{text{rg}} R ) is the standard deviation of the Gaussian profile. - ( N ) is the normalization factor, computed analytically to ensure mass conservation.
- class BaryonForge.Profiles.Arico20.CollisionlessMatter(self, gas=None, stars=None, darkmatter=None, max_iter=10, reltol=0.01, r_min_int=1e-08, r_max_int=10.0, r_steps=5000, **kwargs)[source]
Bases:
AricoProfilesClass representing the collisionless matter density profile.
This class is derived from the AricoProfiles class and provides an implementation for the collisionless matter density profile. It combines contributions from gas, stars, and dark matter to compute the total density profile, using an iterative method to solve for the collisionless matter (dark matter and galaxies) after adiabatic relaxation.
- 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.
darkmatter (DarkMatter, optional) – An instance of the DarkMatter class defining the dark matter profile. If not provided, a default DarkMatter object is created using kwargs.
max_iter (int, optional) – Maximum number of iterations for the relaxation method. Default is 10.
reltol (float, optional) – Relative tolerance for convergence in the relaxation method. Default is 1e-2.
r_min_int (float, optional) – Minimum radius for integration during the iterative relaxation. Default is 1e-8.
r_max_int (float, optional) – Maximum radius for integration during the iterative relaxation. Default is 1e5.
r_steps (int, optional) – Number of steps in the radius for integration. Default is 5000.
**kwargs – Additional keyword arguments passed to initialize the Gas, Stars, and DarkMatter profiles, as well as other parameters from AricoProfiles.
Notes
The CollisionlessMatter class computes the total density profile by combining the contributions from gas, stars, and dark matter profiles. The relaxation method iteratively adjusts these profiles to achieve equilibrium, ensuring mass conservation. This approach accounts for different physical components and their interactions within the halo.
Calculation Steps:
Initial Profiles: The class starts by calculating the individual density profiles for dark matter, gas, and stars:
\[\rho_{\text{DM}}(r), \; \rho_{\text{gas}}(r), \; \rho_{\text{stars}}(r)\]Cumulative Mass Profiles: The cumulative mass profiles are calculated by integrating the density profiles:
\[M_{\text{DM}}(r) = 4\pi \int_0^r \rho_{\text{DM}}(r') r'^2 dr'\]\[M_{\text{gas}}(r) = 4\pi \int_0^r \rho_{\text{gas}}(r') r'^2 dr'\]\[M_{\text{stars}}(r) = 4\pi \int_0^r \rho_{\text{stars}}(r') r'^2 dr'\]Relaxation Iteration: The relaxation method iteratively adjusts the mass profile to achieve equilibrium. The adjusted mass profile is calculated as:
\[M_{\text{CLM}}(r) = f_{\text{clm}}(M_{\text{DM}} + M_{\text{gas}} + M_{\text{stars}})\]where \(f_{\text{clm}}\) is calculated using:
\[f_{\text{clm}} = 1 - \frac{\Omega_b}{\Omega_m} + f_{\text{sga}}\]Here, \(f_{\text{sga}}\) is the satellite galaxy mass fraction
Relaxation Factor Update: During each iteration, the relaxation factor ( zeta ) is updated using:
\[\zeta_{\text{new}} = a \left( \left(\frac{M_{\text{DM}}}{M_{\text{CLM}}}\right)^n - 1 \right) + 1\]This equation ensures that the mass distribution relaxes towards equilibrium over successive iterations, where ( a ) and ( n ) are parameters controlling the relaxation process.
Density Profile Calculation: The final collisionless matter density profile is derived from the adjusted cumulative mass:
\[\rho_{\text{CLM}}(r) = \frac{1}{4\pi r^2} \frac{d}{dr} M_{\text{CLM}}(r)\]
Integration Range and Convergence: The relaxation method uses a logarithmic integration range defined by r_min_int, r_max_int, and r_steps. The method iterates until the relative difference falls below reltol or the maximum number of iterations (max_iter) is reached.
See AricoProfiles and associated classes (Gas, Stars, DarkMatter) for more details on the underlying profiles and parameters.
Warning
The method checks if the provided radius values fall within the integration limits. Warnings are issued if adjustments to r_min_int or r_max_int are recommended to cover the full range of the input radii. Note that sometimes warnings occur because the FFTlog asks for a ridiculously high/low radius, and the profile calculation will just return 0s there. In this case the warning is benign and can be safely ignored
- class BaryonForge.Profiles.Arico20.DarkMatterOnly(self, r_max_int=10, **kwargs)[source]
Bases:
DarkMatterFor Arico20, the DarkMatterOnly model includes just an NFW profile. There is no two-halo term. This class is simply a copy of the DarkMatter class. See that class for more details
- class BaryonForge.Profiles.Arico20.DarkMatterBaryon(self, gas=None, stars=None, collisionlessmatter=None, **kwargs)[source]
Bases:
GasClass representing a combined dark matter and baryonic matter profile.
This class is derived from the AricoProfiles 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 AricoProfiles.
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 AricoProfiles, Gas, Stars, CollisionlessMatter, DarkMatter, and TwoHalo classes for more details on the underlying profiles and parameters.
- class BaryonForge.Profiles.Arico20.Pressure(self, bound_gas_untruncated=None, gas=None, **kwargs)[source]
Bases:
AricoProfilesComputes the pressure profile of gas in halos using a polytropic equation of state.
This class extends AricoProfiles to model the pressure distribution of gas bound to dark matter halos. The pressure is computed from the density of the bound gas and its effective equation of state. The final profile is in units of comoving volume. Use a factor of 1/a^3 (not 1/a^4) to convert to physical pressure.
- Parameters:
bound_gas_untruncated (BoundGasUntruncated, optional) – The Bound gas profile. It must extend beyond R200c so that we can assign realistic temperatures to the ejected gas as well. This is used only for computing the gas temperature
gas (Gas, optional) – The actual gas profile; a sum of all different subcomponents relevant for the analysis
**kwargs (dict) – Additional parameters passed to the parent class.
Notes
This model calculates pressure from the bound gas density profile and an effective polytropic equation of state.
We first use the bound gas to compute the temperature across all scales. Then this temperature is assigned to all the gas (not just bound gas). It is therefore important that the bound gas profile for this step is not truncated (even though the fiducial profile IS truncated at R200c)
The pressure profile is given by:
\[P(r) = P_0 \cdot \rho_{\text{BG}}^{\Gamma_{\text{eff}}}\]where: - ( P_0 ) is the pressure normalization, defined as:
\[P_0 = 4\pi G \cdot \frac{\rho_c r_s^2}{\rho_0^{\Gamma_{\text{eff}} - 1}} \cdot \left(1 - \frac{1}{\Gamma_{\text{eff}}}\right)\]where: - ( rho_c ) is the characteristic density of the halo. - ( r_s ) is the scale radius. - ( rho_0 ) is the gas density at the halo center. - ( Gamma_{text{eff}} ) is the effective polytropic index.
( rho_{text{BG}}(r) ) represents the bound gas density profile.
This implementation ensures consistency with large-scale gas behavior and provides a physically motivated description of halo gas pressure.
- class BaryonForge.Profiles.Arico20.NonThermalFrac(self, r_max_int=10, **kwargs)[source]
Bases:
AricoProfilesClass for modeling the non-thermal pressure fraction profile in halos.
This class extends AricoProfiles to compute the fraction of pressure in halos that arises from non-thermal sources, such as turbulence and bulk motions. The profile is based on a parametric model calibrated to simulations from Green+20, with two degrees of freedom.
Notes
The non-thermal pressure fraction (( f_{text{nt}} )) is modeled as a function of radius and halo mass, with redshift-dependent scaling.
The model is defined using the radius ( R_{200m} ), corresponding to the halo boundary defined with respect to the matter overdensity.
The parameters of the model are calibrated to simulation results (e.g., Green et al. 2020).
The non-thermal pressure fraction is given by:
\[f_{\text{nt}}(r) = 1 - A_{\text{nt}} (1 + \exp(-(x/b)^c)) \cdot \left(\frac{\nu_M}{4.1}\right)^{d / (1 + (x/e)^f)}\]where: - ( x = r / R_{200m} ) - ( A_{text{nt}} ) is a normalization factor that scales with redshift:
( A_{text{nt}} = a (1 + z)^{alpha_{text{nt}}} )
( nu_M = 1.686 / sigma(M_{200m}) ) is the peak height of the halo.
( b, c, d, e, f ) are model constants derived in Green et al. (2020).
- class BaryonForge.Profiles.Arico20.Temperature(self, pressure=None, gas=None, **kwargs)[source]
Bases:
AricoProfilesClass for modeling the temperature profile of gas in halos.
This class extends AricoProfiles to compute the temperature profile of gas, based on the ideal gas law, using the pressure and gas density profiles. The output is a physical temperature (not in any comoving unit)
- Parameters:
pressure (Pressure, optional) – Instance of the Pressure class representing the gas pressure profile. If not provided, a default Pressure object is created, accounting for non-thermal pressure using NonThermalFrac.
gas (BoundGas, optional) – Instance of the BoundGas class representing the gas density profile. If not provided, a default BoundGas object is created.
**kwargs – Additional arguments passed to initialize the parent AricoProfiles class and associated components.
Notes
The real-space temperature profile is calculated using the ideal gas law:
\[T(r) = \frac{P(r)}{n(r) \cdot k_B}\]where: - ( P(r) ) is the gas pressure profile. - ( n(r) ) is the gas number density, derived from the mass density and mean molecular weight. - ( k_B ) is the Boltzmann constant.
The projected temperature profile computes the average temperature along the line of sight, normalizing by the number density. Thus, the projected result is still in units of temperature and not in units of temperature * distance.
- projected(cosmo, r_t, M, a)[source]
Returns the 2D projected profile as a function of cosmology, radius, halo mass and scale factor.
\[\Sigma(R)= \int dr_\parallel\, \rho(\sqrt{r_\parallel^2 + R^2})\]- Parameters:
- Returns:
projected profile. The shape of the output will be (N_M, N_r) where N_r and N_m are the sizes of r and M respectively. If r or M are scalars, the corresponding dimension will be squeezed out on output.
- Return type:
(
floator array)