dsf.utils.converters module¶
Useful unit and cosmology conversions.
- dsf.utils.converters.arcmin2_per_steradian()[source]¶
Return the number of square arcminutes in one steradian.
- Returns:
Number of square arcminutes in one steradian.
- Return type:
float
- dsf.utils.converters.comoving_delta_sigma_to_proper(func)[source]¶
Convert a comoving Delta Sigma function to a proper Delta Sigma function.
The wrapped function should accept comoving projected radius
rand scale factora. The returned wrapper accepts proper projected radiusrand returns proper \(\Delta\Sigma\).- Parameters:
func (Callable[[...], ndarray[tuple[Any, ...], dtype[float64]]]) – Function computing comoving \(\Delta\Sigma\).
- Returns:
Function computing proper \(\Delta\Sigma\).
- Return type:
Callable[[…], ndarray[tuple[Any, …], dtype[float64]]]
- dsf.utils.converters.comoving_distance_h(cosmo, z, *, h)[source]¶
Return the comoving radial distance in Mpc/h.
- Parameters:
cosmo (Cosmology) – Cosmology used to evaluate the distance.
z (ndarray[tuple[Any, ...], dtype[float64]]) – Redshift value or array of redshift values.
h (float) – Dimensionless Hubble parameter.
- Returns:
Comoving radial distance in Mpc/h.
- Return type:
float | ndarray[tuple[Any, …], dtype[float64]]
- dsf.utils.converters.deg2_to_arcmin2(area_deg2)[source]¶
Convert square degrees to square arcminutes.
- Parameters:
area_deg2 (float) – Area in square degrees.
- Returns:
Area in square arcminutes.
- Return type:
float
- dsf.utils.converters.hubble_constant_per_s_per_mpc(h)[source]¶
Return the Hubble constant as an Astropy quantity.
- Parameters:
h (float) – Reduced Hubble parameter.
- Returns:
Hubble constant in km/s/Mpc.
- Return type:
Quantity
- dsf.utils.converters.hubble_over_c_cubed(h)[source]¶
Return \((H_0 / c)^3\) in inverse cubic Mpc.
- Parameters:
h (float) – Reduced Hubble parameter.
- Returns:
Value of \((H_0 / c)^3\) in \(Mpc^{-3}\).
- Return type:
float
- dsf.utils.converters.power_spectrum_to_correlation(power_spectrum, a, k=None)[source]¶
Convert a power spectrum to a correlation function using FFTLog.
- Parameters:
power_spectrum (Callable[[...], ndarray[tuple[Any, ...], dtype[float64]]]) – Power spectrum function with arguments
kanda.a (float) – Scale factor.
k (ndarray[tuple[Any, ...], dtype[float64]] | None) – Wavenumber array. If not provided, a default logarithmic grid is used.
- Returns:
Function returning \(\xi(r)\) evaluated at the requested radii.
- Return type:
Callable[[ndarray[tuple[Any, …], dtype[float64]]], ndarray[tuple[Any, …], dtype[float64]]]
- dsf.utils.converters.redshift_to_scale_factor(z)[source]¶
Convert redshift to scale factor.
- Parameters:
z (float | ndarray[tuple[Any, ...], dtype[float64]]) – Redshift or array of redshifts.
- Returns:
Scale factor or array of scale factors.
- Return type:
float | ndarray[tuple[Any, …], dtype[float64]]
- dsf.utils.converters.resolve_h(cosmo, h)[source]¶
Return the supplied Hubble parameter or read it from the CCL cosmology.
- Parameters:
cosmo (Cosmology) – CCL cosmology object.
h (float | None) – Dimensionless Hubble parameter.
- Returns:
Hubble parameter or read it from the CCL cosmology.
- Return type:
float
- dsf.utils.converters.resolve_omega_m(cosmo, omega_m)[source]¶
Return supplied Omega_m or read it from the CCL cosmology.
- Parameters:
cosmo (Cosmology)
omega_m (float | None)
- Return type:
float
- dsf.utils.converters.rho_critical_comoving_msun_mpc3(cosmo, *, h=None)[source]¶
Return critical density in comoving Msun / Mpc^3.
- Parameters:
cosmo (Cosmology) – CCL cosmology object.
h (float | None) – Optional dimensionless Hubble parameter. If omitted, it is read from
cosmo.
- Returns:
Critical density in
Msun / Mpc^3.- Return type:
float
- dsf.utils.converters.rho_critical_projected_msun_pc2_per_mpc(cosmo, *, h=None)[source]¶
Return critical density in projected DeltaSigma units.
- Parameters:
cosmo (Cosmology) – CCL cosmology object.
h (float | None) – Optional dimensionless Hubble parameter. If omitted, it is read from
cosmo.
- Returns:
Critical density in
Msun / pc^2 / Mpc.- Return type:
float
- dsf.utils.converters.scale_factor_to_redshift(a)[source]¶
Convert scale factor to redshift.
- Parameters:
a (float | ndarray[tuple[Any, ...], dtype[float64]]) – Scale factor or array of scale factors.
- Returns:
Redshift or array of redshifts.
- Return type:
float | ndarray[tuple[Any, …], dtype[float64]]
- dsf.utils.converters.sigma_crit_prefactor_msun_h_pc2()[source]¶
Return the Sigma_crit prefactor for comoving distances in Mpc / h.
This is the inverse of the prefactor used to compute comoving Sigma_crit^{-1} in units of pc^2 / (Msol h). It is intended for calculations where distances are supplied in Mpc / h and DeltaSigma-like quantities are expressed in Msol h / pc^2.
- Return type:
float