BaryonForge.Profiles.misc module
- class BaryonForge.Profiles.misc.Truncation(self, epsilon_trunc, mass_def=<function MassDef200c>, **kwargs)[source]
Bases:
BaseBFGProfilesClass for truncating profiles conveniently.
The Truncation profile imposes a cutoff on any profile beyond a specified fraction of the halo’s virial radius. The profile is used by modify existing halo profiles, ensuring that contributions are zeroed out beyond the truncation radius.
- Parameters:
epsilon (float) – The truncation parameter, representing the fraction of the virial radius ( R_{200c} ) at which the profile is truncated. For example, an epsilon of 1 implies truncation at the virial radius, while a value < 1 truncates at a smaller radius.
mass_def (ccl.halos.massdef.MassDef, optional) – The mass definition for the halo. By default, this is set to MassDef200c, which defines the virial radius ( R_{200c} ) as the radius where the average density is 200 times the critical density.
Notes
The truncation condition is defined as:
\[\begin{split}\rho_{\text{trunc}}(r) = \begin{cases} 1, & r < \epsilon \cdot R_{200c} \\ 0, & r \geq \epsilon \cdot R_{200c} \end{cases}\end{split}\]where: - ( epsilon ) is the truncation fraction. - ( R_{200c} ) is the virial radius for the given mass definition.
Examples
Create a truncation profile and apply it to a given halo:
>>> truncation_profile = Truncation(epsilon=0.8) >>> other_bfg_profile = Profile(...) >>> truncated_profiled = other_bfg_profile * Truncation >>> r = np.logspace(-2, 1, 50) # Radii in comoving Mpc >>> M = 1e14 # Halo mass in solar masses >>> a = 0.8 # Scale factor >>> truncated = other_bfg_profile.real(cosmo, r, M, a)
- hyper_param_names = ['mass_def', 'c_M_relation', 'use_fftlog_projection', 'padding_hi_proj', 'padding_hi_proj', 'n_per_decade_proj', 'r_min_int', 'r_max_int', 'r_steps', 'xi_mm', 'epsilon_trunc']
- class BaryonForge.Profiles.misc.Identity(self, mass_def=<function MassDef200c>, **kwargs)[source]
Bases:
BaseBFGProfilesClass for the identity profile.
The Identity profile is a simple profile that returns 1 for all radii, masses, and cosmologies. It is useful just for testing.
- Parameters:
mass_def (ccl.halos.massdef.MassDef, optional) – The mass definition for the halo. By default, this is set to MassDef200c, which defines the virial radius ( R_{200c} ) as the radius where the average density is 200 times the critical density.
- class BaryonForge.Profiles.misc.Zeros(self, mass_def=<function MassDef200c>, **kwargs)[source]
Bases:
BaseBFGProfilesClass for the zeros profile.
The Zeros profile is a ccl profile class that returns 0 for all radii, masses, and cosmologies. It is useful just for testing, or evaluating inherited classes with certain components nulled out (eg. evaluating DMB profiles with no 2-halo)
- Parameters:
mass_def (ccl.halos.massdef.MassDef, optional) – The mass definition for the halo. By default, this is set to MassDef200c, which defines the virial radius ( R_{200c} ) as the radius where the average density is 200 times the critical density.
- class BaryonForge.Profiles.misc.ComovingToPhysical(self, profile, factor, **kwargs)[source]
Bases:
BaseBFGProfilesConverts a given profile from comoving to physical units by applying a user-specified scale factor (a) correction. The projected profile is rescaled by one less power of a.
- Parameters:
profile (ccl.halo.HaloProfile object) – A CCL profile object (of any kind)
factor (float) – The power of the scale factor a applied to convert the profile from comoving to physical units. Should use -3 for density profiles AND for pressure profiles in BaryonForge.
- Returns:
A halo profile class with _real and projected routines that have been rescaled by scale factor a to the appropriate power.
- Return type:
ccl.halo.HaloProfile object
- hyper_param_names = ['mass_def', 'c_M_relation', 'use_fftlog_projection', 'padding_hi_proj', 'padding_hi_proj', 'n_per_decade_proj', 'r_min_int', 'r_max_int', 'r_steps', 'xi_mm', 'profile', 'factor']
- real(cosmo, r, M, a)[source]
Returns the 3D real-space value of the profile as a function of cosmology, radius, halo mass and scale factor.
- Parameters:
- Returns:
halo 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)
- 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)
- class BaryonForge.Profiles.misc.Mdelta_to_Mtot(profile, r_min=0.001, r_max=100.0, N_int=1000)[source]
Bases:
objectComputes the total mass of a halo by integrating its density profile over a specified radial range.
- Parameters:
profile (object) – A density profile object that provides the real(cosmo, r, M, a) method, returning the density at a given radius r for mass M and scale factor a.
r_min (float, optional) – The minimum radius for integration, in the same units as r. Default is 1e-3.
r_max (float, optional) – The maximum radius for integration, in the same units as r. Default is 1e2.
N_int (int, optional) – The number of integration points between r_min and r_max. Default is 1000.
- __call__(cosmo, M, a)[source]
Computes the total mass by integrating the density profile over the radial range.
- Returns:
M_tot – The total mass of the halo, computed as the integral of the density profile. If M is a scalar, returns a scalar; if M is an array, returns an array of the same shape.
- Return type:
float or array-like