wcosmo.astropy.FlatwCDM#
- class wcosmo.astropy.FlatwCDM(H0, Om0, w0=-1, Tcmb0=None, Neff=None, m_nu=None, Ob0=None, *, zmin=0.0001, zmax=100, method='pade', name=None, meta=None)[source]#
Bases:
WCosmoMixin- __init__(H0, Om0, w0=-1, Tcmb0=None, Neff=None, m_nu=None, Ob0=None, *, zmin=0.0001, zmax=100, method='pade', name=None, meta=None)[source]#
FLRW cosmology with a constant dark energy EoS and no spatial curvature.
This has one additional attribute beyond those of FLRW.
Docstring copied from
astropy.cosmology.flrw.wcdm.FlatwCDM- Parameters:
- H0float or scalar quantity-like [‘frequency’]
Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].
- Om0float
Omega matter: density of non-relativistic matter in units of the critical density at z=0.
- w0float, optional
Dark energy equation of state at all redshifts. This is pressure/density for dark energy in units where c=1. A cosmological constant has w0=-1.0.
- Tcmb0float or scalar quantity-like [‘temperature’], optional
Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K]. Setting this to zero will turn off both photons and neutrinos (even massive ones).
- Nefffloat, optional
Effective number of Neutrino species. Default 3.04.
- m_nuquantity-like [‘energy’, ‘mass’] or array-like, optional
Mass of each neutrino species in [eV] (mass-energy equivalency enabled). If this is a scalar Quantity, then all neutrino species are assumed to have that mass. Otherwise, the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Typically this means you should provide three neutrino masses unless you are considering something like a sterile neutrino.
- Ob0float or None, optional
Omega baryons: density of baryonic matter in units of the critical density at z=0. If this is set to None (the default), any computation that requires its value will raise an exception.
- method: str (optional, keyword-only)
The integration method, should be one of
padeoranalyticfor the pade approximation or analytic hypergeometric methods respectively.- namestr or None (optional, keyword-only)
Name for this cosmological object.
- metamapping or None (optional, keyword-only)
Metadata for the cosmology, e.g., a reference.
Examples
>>> from astropy.cosmology import FlatwCDM >>> cosmo = FlatwCDM(H0=70, Om0=0.3, w0=-0.9)
The comoving distance in Mpc at redshift z:
>>> z = 0.5 >>> dc = cosmo.comoving_distance(z)
Methods
H(z)Compute the Hubble parameter \(H(z)\) for a flat wCDM cosmology.
__init__(H0, Om0[, w0, Tcmb0, Neff, m_nu, ...])FLRW cosmology with a constant dark energy EoS and no spatial curvature.
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)#
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)#
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)#
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)#
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)#
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)#
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)#
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)#
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)#
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)#
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)#
Compute the distance modulus at redshift z.
- Parameters:
- z: array_like
- Redshift
- Returns:
- distmod: array_like
The distance modulus (units: mag)
- efunc(z)#
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)#
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)#
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)#
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)#
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