wcosmo.astropy.WCosmoMixin#
- class wcosmo.astropy.WCosmoMixin[source]#
Bases:
objectMixin to provide access to the
wcosmofunctionality toastropycosmology objects.We clobber all units to ensure consistent behavior across backends.
Notes
The following methods are not compatible with non-
numpybackends:kpc_comoving_per_arcminkpc_proper_per_arcminnu_relative_density
These methods internally coerce the input to
numpyarrays if the backend supports implicit conversion. Additionally, we don’t overwrite the various integrands, protected methods, and other utility methods, e.g.,clone.We include the following methods that are not present in
astropy:dLdH- derivative of the luminosity distance w.r.t. the Hubble distancedDLdz- Jacobian for the conversion of luminosity distance to redshift, seedDLdz()detector_to_source_frame- convert masses and luminosity distance from the detector frame to the source frame, also returns the jacobian, seedetector_to_source_frame()source_to_detector_frame- convert masses and redshift from the source frame to the detector frame, seesource_to_detector_frame()
- __init__(*args, **kwargs)#
Methods
H(z)Compute the Hubble parameter \(H(z)\) for a flat wCDM cosmology.
__init__(*args, **kwargs)Compute the absorption distance using an analytic integral of the Pade approximation.
age(z[, zmax])Compute the age of the universe at redshift z.
Compute the comoving distance using an analytic integral of the Pade approximation.
Compute the comoving distance using an analytic integral of the Pade approximation.
Compute the comoving volume out to redshift z.
dDLdz(z)The Jacobian for the conversion of redshift to luminosity distance.
dLdH(z)Derivative of the luminosity distance w.r.t.
Dark energy density at redshift z.
detector_to_source_frame(m1z, m2z, dL[, ...])Convert masses and luminosity distance from the detector frame to source frame masses and redshift.
Compute the differential comoving volume element.
distmod(z)Compute the distance modulus at redshift z.
efunc(z)Compute the \(E(z)\) function for a flat wCDM cosmology.
inv_efunc(z)Compute the inverse of the E(z) function for a flat wCDM cosmology.
Compute the lookback time using an analytic integral of the Pade approximation.
Compute the luminosity distance using an analytic integral of the Pade approximation.
source_to_detector_frame(m1, m2, z)Convert masses and redshift from the source frame to the detector frame.
Attributes
H0Compute the Hubble distance \(D_H = c H_0^{-1}\) in Mpc.
Compute the Hubble time \(t_H = H_0^{-1}\) in Gyr.
- H(z)[source]#
Compute the Hubble parameter \(H(z)\) for a flat wCDM cosmology.
\[H(z; H_0, \Omega_{m,0}, w_0) = \frac{d_H(H_0)}{E(z; \Omega_{m,0}, w_0)}\]- Parameters:
- z: array_like
Redshift
- Returns:
- H(z): array_like
The Hubble parameter
- absorption_distance(z)[source]#
Compute the absorption distance using an analytic integral of the Pade approximation.
\[d_{A} = \int_{0}^{z} \frac{dz' (1 + z')^2}{E(z'; \Omega_{m,0}, w_0)}\]- Parameters:
- z: array_like
Redshift
- Returns:
- absorption_distance: array_like
The absorption distance in Mpc
- age(z, zmax=100000.0)[source]#
Compute the age of the universe at redshift z.
- Parameters:
- z: array_like
- Redshift
- zmax: float, optional
The maximum redshift to consider, default is 1e5
- Returns:
- age: array_like
The age of the universe in Gyr
- comoving_distance(z)[source]#
Compute the comoving distance using an analytic integral of the Pade approximation.
\[d_{C} = d_{H} \int_{0}^{z} \frac{dz'}{E(z'; \Omega_{m,0}, w_0)}\]- Parameters:
- z: array_like
Redshift
- Returns:
- comoving_distance: array_like
The comoving distance in Mpc
- comoving_transverse_distance(z)#
Compute the comoving distance using an analytic integral of the Pade approximation.
\[d_{C} = d_{H} \int_{0}^{z} \frac{dz'}{E(z'; \Omega_{m,0}, w_0)}\]- Parameters:
- z: array_like
Redshift
- Returns:
- comoving_distance: array_like
The comoving distance in Mpc
- comoving_volume(z)[source]#
Compute the comoving volume out to redshift z.
\[V_C = \frac{4\pi}{3} d^3_C(z; H_0, \Omega_{m,0}, w_0)\]- Parameters:
- z: array_like
Redshift
- Returns:
- Vc: array_like
The comoving volume in \(\rm{Gpc}^3\)
- dDLdz(z)[source]#
The Jacobian for the conversion of redshift to luminosity distance.
\[\frac{dd_{L}}{z} = d_C(z; H_0, \Omega_{m,0}, w_0) + (1 + z) d_{H} E(z; \Omega_{m, 0}, w0)\]Here \(d_{C}\) is comoving distance and \(d_{H}\) is the Hubble distance.
- Parameters:
- z: array_like
Redshift
- Returns:
- dDLdz: array_like
The derivative of the luminosity distance with respect to redshift in Mpc
Notes
This function does not have a direct analog in the
astropycosmology objects, but is needed for accounting for expressing distributions of redshift as distributions over luminosity distance.
- dLdH(z)[source]#
Derivative of the luminosity distance w.r.t. the Hubble distance.
\[\frac{dd_L}{dd_H} = \frac{d_L}{d_H}\]- Parameters:
- z: array_like
- Redshift
- Returns:
- array_like:
The derivative of the luminosity distance w.r.t., the Hubble distance
- de_density_scale(z)[source]#
Dark energy density at redshift z.
- Parameters:
- z: array_like
- Redshift
- Returns:
- rho_de: array_like
The dark energy density at redshift z
- detector_to_source_frame(m1z, m2z, dL, zmin=0.0001, zmax=100)[source]#
Convert masses and luminosity distance from the detector frame to source frame masses and redshift.
This passes through the arguments to z_at_value to compute the redshift.
- Parameters:
- m1z: array_like
The primary mass in the detector frame
- m2z: array_like
The secondary mass in the detector frame
- dL: array_like
The luminosity distance in Mpc
- zmin: float
The minimum redshift used in the conversion from distance to redshift, default=1e-4
- zmax: float
The maximum redshift used in the conversion from distance to redshift, default=100
- Returns:
- m1, m2, z: array_like
The primary and secondary masses in the source frame and the redshift
- differential_comoving_volume(z)[source]#
Compute the differential comoving volume element.
\[\frac{dV_{C}}{dz} = d_C^2(z; H_0, \Omega_{m,0}, w_0) d_H E(z; \Omega_{m, 0}, w_0)\]- Parameters:
- z: array_like
Redshift
- Returns:
- dVc: array_like
The differential comoving volume element in \(\rm{Gpc}^3\)
- distmod(z)[source]#
Compute the distance modulus at redshift z.
- Parameters:
- z: array_like
- Redshift
- Returns:
- distmod: array_like
The distance modulus (units: mag)
- efunc(z)[source]#
Compute the \(E(z)\) function for a flat wCDM cosmology.
\[E(z; \Omega_{m,0}, w_0) = \sqrt{\Omega_{m,0} (1 + z)^3 + (1 - \Omega_{m,0}) (1 + z)^{3(1 + w_0)}}\]- Parameters:
- z: array_like
Redshift
- Returns:
- E(z): array_like
The E(z) function
- property hubble_distance#
Compute the Hubble distance \(D_H = c H_0^{-1}\) in Mpc.
- Returns:
- D_H: float
The Hubble distance in Mpc
- property hubble_time#
Compute the Hubble time \(t_H = H_0^{-1}\) in Gyr.
- Returns:
- t_H: float
The Hubble time in Gyr
- inv_efunc(z)[source]#
Compute the inverse of the E(z) function for a flat wCDM cosmology.
- Parameters:
- z: array_like
Redshift
- Returns:
- inv_efunc: array_like
The inverse of the E(z) function
- lookback_time(z)[source]#
Compute the lookback time using an analytic integral of the Pade approximation.
\[t_{L} = t_{H} \int_{0}^{z} \frac{dz'}{(1 + z')E(z'; \Omega_{m,0}, w_0)}\]- Parameters:
- z: array_like
Redshift
- Returns:
- lookback_time: array_like
The lookback time in km / s / Mpc
- luminosity_distance(z)[source]#
Compute the luminosity distance using an analytic integral of the Pade approximation.
\[d_L = (1 + z') d_{H} \int_{0}^{z} \frac{dz'}{E(z'; \Omega_{m,0}, w_0)}\]- Parameters:
- z: array_like
Redshift
- Returns:
- luminosity_distance: array_like
The luminosity distance in Mpc
- source_to_detector_frame(m1, m2, z)[source]#
Convert masses and redshift from the source frame to the detector frame.
- Parameters:
- m1: array_like
The primary mass in the source frame
- m2: array_like
The secondary mass in the source frame
- z: array_like
Redshift
- Returns:
- m1z, m2z, dL: array_like
The primary and secondary masses in the detector frame and the luminosity distance