Physical Relations¶
Cosmological distance functions for a flat wCDM universe.
Provides luminosity distance, redshift inversion, and derived quantities used throughout the EMRI simulation and Bayesian H₀ inference pipelines.
- master_thesis_code.physical_relations.cached_dist(redshift, h=H, Omega_m=OMEGA_M, Omega_de=OMEGA_DE, w_0=W_0, w_a=W_A, offset_for_root_finding=0.0)[source]¶
LRU-cached version of
dist().Identical semantics; results are memoized up to 1000 unique argument combinations, which eliminates redundant integration in hot paths.
- Parameters:
redshift (float) – Source redshift \(z \geq 0\).
h (float) – Dimensionless Hubble parameter.
Omega_m (float) – Matter density parameter.
Omega_de (float) – Dark energy density parameter.
w_0 (float) – Dark energy equation-of-state parameter.
w_a (float) – Dark energy equation-of-state evolution.
offset_for_root_finding (float) – Subtracted from the result; used for inversion via
scipy.optimize.fsolve.
- Returns:
Luminosity distance in Gpc.
- Return type:
- master_thesis_code.physical_relations.comoving_volume_element(z, h=H, Omega_m=OMEGA_M, Omega_de=OMEGA_DE)[source]¶
Comoving volume element per unit redshift per unit solid angle.
\[\frac{dV_c}{dz\,d\Omega} = \frac{d_{\mathrm{com}}^2(z)\,c}{H(z)}\]where \(d_{\mathrm{com}} = d_L / (1+z)\) is the comoving distance and \(H(z) = h \times 100\,\mathrm{km\,s^{-1}\,Mpc^{-1}} \times E(z)\).
The result has units of \(\mathrm{Mpc}^3\,\mathrm{sr}^{-1}\).
Dimensional analysis¶
\([Mpc]^2 \times [km/s] / [km/s/Mpc] = [Mpc]^3\) per steradian.
Limiting case (z << 1)¶
\(d_{\mathrm{com}} \approx c z / H_0\), \(H(z) \approx H_0\), so \(dV_c/dz/d\Omega \approx (c/H_0)^3 z^2\), scaling as \(z^2\).
- param z:
Redshift (scalar or array). Must be >= 0.
- param h:
Dimensionless Hubble parameter.
- param Omega_m:
Matter density parameter.
- param Omega_de:
Dark energy density parameter.
- returns:
Comoving volume element \(dV_c / dz / d\Omega\) in \(\mathrm{Mpc}^3 / \mathrm{sr}\). Same type as input z.
References¶
Hogg (1999), arXiv:astro-ph/9905116, Eq. (28). Gray et al. (2020), arXiv:1908.06050, Appendix A.2.3 (Eqs. 31-32 use this volume element as the completion term prior).
- master_thesis_code.physical_relations.convert_redshifted_mass_to_true_mass(M_z, M_z_error, z, z_error)[source]¶
- master_thesis_code.physical_relations.convert_true_mass_to_redshifted_mass(M, M_error, z, z_error)[source]¶
- master_thesis_code.physical_relations.convert_true_mass_to_redshifted_mass_with_distance(M, dist)[source]¶
- master_thesis_code.physical_relations.dist(redshift, h=H, Omega_m=OMEGA_M, Omega_de=OMEGA_DE, w_0=W_0, w_a=W_A, offset_for_root_finding=0.0)[source]¶
Luminosity distance in Gpc for a flat wCDM cosmology.
Uses the analytic hypergeometric form of the comoving distance integral:
\[d_L(z) = \frac{c\,(1+z)}{H_0} \int_0^z \frac{dz'}{E(z')}\]where \(E(z) = \sqrt{\Omega_m(1+z)^3 + \Omega_\Lambda}\) for \(w_0 = -1,\, w_a = 0\).
- Parameters:
redshift (float) – Source redshift \(z \geq 0\).
h (float) – Dimensionless Hubble parameter \(h = H_0 / (100\,\mathrm{km\,s^{-1}\,Mpc^{-1}})\).
Omega_m (float) – Matter density parameter \(\Omega_m\).
Omega_de (float) – Dark energy density parameter \(\Omega_\Lambda\).
w_0 (float) – Dark energy equation-of-state parameter \(w_0\).
w_a (float) – Dark energy equation-of-state evolution \(w_a\).
offset_for_root_finding (float) – Subtracted from the result; set to the target distance when calling this function via
scipy.optimize.fsolvefor redshift inversion.
- Returns:
Luminosity distance in Gpc.
- Return type:
References
Hogg (1999), Distance measures in cosmology, arXiv:astro-ph/9905116, Eq. (16).
Examples
>>> dist(0.0) 0.0
- master_thesis_code.physical_relations.dist_derivative(redshift, h=H, Omega_m=OMEGA_M, Omega_de=OMEGA_DE, w_0=W_0, w_a=W_A)[source]¶
Derivative of luminosity distance with respect to redshift, \(dd_L/dz\) in Gpc.
Uses the analytic expression:
\[\frac{dd_L}{dz} = \frac{c}{H_0} \left[ \frac{1+z}{E(z)} + \int_0^z \frac{dz'}{E(z')} \right]\]- Parameters:
- Returns:
\(dd_L/dz\) in Gpc.
- Return type:
- master_thesis_code.physical_relations.dist_to_redshift(distance, h=H, Omega_m=OMEGA_M, Omega_de=OMEGA_DE, w_0=W_0, w_a=W_A)[source]¶
Redshift corresponding to a given luminosity distance (inverse of
dist()).Solves \(d_L(z) = \mathrm{distance}\) via
scipy.optimize.fsolvewith initial guess \(z = 1\).- Parameters:
- Returns:
Redshift \(z\) such that \(d_L(z) = \mathrm{distance}\).
- Return type:
- master_thesis_code.physical_relations.dist_to_redshift_error_proagation(distance, distance_error, h=H, Omega_m=OMEGA_M, Omega_de=OMEGA_DE, w_0=W_0, w_a=W_A, derivative_epsilon=1e-6)[source]¶
Calculate the redshift error for a given luminosity distance error.
- master_thesis_code.physical_relations.dist_vectorized(redshift, h=H, Omega_m=OMEGA_M, Omega_de=OMEGA_DE, w_0=W_0, w_a=W_A, offset_for_root_finding=0.0)[source]¶
Vectorized luminosity distance in Gpc over a redshift array.
Applies the same formula as
dist()element-wise without Python loops, using NumPy broadcasting vialambda_cdm_analytic_distance().- Parameters:
redshift (ndarray[tuple[Any, ...], dtype[floating[Any]]]) – Array of source redshifts \(z \geq 0\).
h (float) – Dimensionless Hubble parameter.
Omega_m (float) – Matter density parameter.
Omega_de (float) – Dark energy density parameter.
w_0 (float) – Dark energy equation-of-state parameter.
w_a (float) – Dark energy equation-of-state evolution.
offset_for_root_finding (float) – Subtracted from every element of the result.
- Returns:
Array of luminosity distances in Gpc, same shape as redshift.
- Return type:
- master_thesis_code.physical_relations.get_redshift_outer_bounds(distance, distance_error, h_min=0.6, h_max=0.86, Omega_m_min=0.04, Omega_m_max=0.5, w_0=W_0, w_a=W_A, sigma_multiplier=3.0)[source]¶
Calculate the outer bounds for the redshift for a given luminosity distance and error w.r.t LamCDM model.
- master_thesis_code.physical_relations.hubble_function(redshift, h=H, Omega_m=OMEGA_M, Omega_de=OMEGA_DE, w_0=W_0, w_a=W_A)[source]¶
Dimensionless Hubble function \(E(z) = H(z) / H_0\) for a flat wCDM cosmology.
\[E(z) = \sqrt{\Omega_m (1+z)^3 + \Omega_\Lambda (1+z)^{3(1+w_0+w_a)} \exp\!\left(\frac{-3 w_a z}{1+z}\right)}\]For the fiducial ΛCDM case (\(w_0 = -1,\, w_a = 0\)) this reduces to \(E(z) = \sqrt{\Omega_m (1+z)^3 + \Omega_\Lambda}\).
- Parameters:
redshift (float | ndarray[tuple[Any, ...], dtype[floating[Any]]]) – Source redshift or array of redshifts.
h (float) – Dimensionless Hubble parameter (unused — \(E(z)\) is independent of \(h\) by definition).
Omega_m (float) – Matter density parameter \(\Omega_m\).
Omega_de (float) – Dark energy density parameter \(\Omega_\Lambda\).
w_0 (float) – Dark energy equation-of-state parameter \(w_0\).
w_a (float) – Dark energy equation-of-state evolution \(w_a\).
- Returns:
\(E(z)\) as a float when redshift is a scalar, or as an ndarray when redshift is an array.
- Return type:
- master_thesis_code.physical_relations.lambda_cdm_analytic_distance(redshift, Omega_m=OMEGA_M, Omega_de=OMEGA_DE)[source]¶
Analytic ΛCDM comoving distance integral \(\int_0^z dz'/E(z')\) in units of \(c/H_0\).
Evaluates the integral in closed form using the Gauss hypergeometric function \({}_2F_1\), valid for a flat ΛCDM cosmology (\(w_0=-1,\, w_a=0\)).