wcosmo.astropy.FlatwCDM#

class wcosmo.astropy.FlatwCDM(H0: 'Parameter', Om0: 'Parameter', Tcmb0: 'Parameter' = Parameter(default=<Quantity 0. K>, derived=False, unit=Unit("K"), equivalencies=[], fvalidate='scalar', doc='Temperature of the CMB as `~astropy.units.Quantity` at z=0.'), Neff: 'Parameter' = Parameter(default=3.04, derived=False, unit=None, equivalencies=[], fvalidate='non-negative', doc='Number of effective neutrino species.'), m_nu: 'Parameter' = Parameter(default=<Quantity 0. eV>, derived=False, unit=Unit("eV"), equivalencies=[(Unit("kg"), Unit("J"), <function mass_energy.<locals>.<lambda> at 0x7f97ba544180>, <function mass_energy.<locals>.<lambda> at 0x7f97ba5440e0>), (Unit("kg / m2"), Unit("J / m2"), <function mass_energy.<locals>.<lambda> at 0x7f97ba544040>, <function mass_energy.<locals>.<lambda> at 0x7f97ba544900>), (Unit("kg / m3"), Unit("J / m3"), <function mass_energy.<locals>.<lambda> at 0x7f97ba5449a0>, <function mass_energy.<locals>.<lambda> at 0x7f97ba544a40>), (Unit("kg / s"), Unit("J / s"), <function mass_energy.<locals>.<lambda> at 0x7f97ba544ae0>, <function mass_energy.<locals>.<lambda> at 0x7f97ba544b80>)], fvalidate=<function FLRW.m_nu at 0x7f97ba544d60>, doc='Mass of neutrino species.'), Ob0: 'Parameter' = Parameter(default=None, derived=False, unit=None, equivalencies=[], fvalidate=<function FLRW.Ob0 at 0x7f97ba544cc0>, doc='Omega baryon; baryonic matter density/critical density at z=0.'), w0: astropy.cosmology.parameter._core.Parameter = Parameter(default=-1.0, derived=False, unit=None, equivalencies=[], fvalidate='float', doc='Dark energy equation of state.'), *, name: '_NameField' = None, meta: 'MetaData' = None)[source]#

Bases: WCosmoMixin, FlatwCDM

__init__(H0: Parameter, Om0: Parameter, Tcmb0: Parameter = Parameter(default=<Quantity 0. K>, derived=False, unit=Unit("K"), equivalencies=[], fvalidate='scalar', doc='Temperature of the CMB as `~astropy.units.Quantity` at z=0.'), Neff: Parameter = Parameter(default=3.04, derived=False, unit=None, equivalencies=[], fvalidate='non-negative', doc='Number of effective neutrino species.'), m_nu: Parameter = Parameter(default=<Quantity 0. eV>, derived=False, unit=Unit("eV"), equivalencies=[(Unit("kg"), Unit("J"), <function mass_energy.<locals>.<lambda>>, <function mass_energy.<locals>.<lambda>>), (Unit("kg / m2"), Unit("J / m2"), <function mass_energy.<locals>.<lambda>>, <function mass_energy.<locals>.<lambda>>), (Unit("kg / m3"), Unit("J / m3"), <function mass_energy.<locals>.<lambda>>, <function mass_energy.<locals>.<lambda>>), (Unit("kg / s"), Unit("J / s"), <function mass_energy.<locals>.<lambda>>, <function mass_energy.<locals>.<lambda>>)], fvalidate=<function FLRW.m_nu>, doc='Mass of neutrino species.'), Ob0: Parameter = Parameter(default=None, derived=False, unit=None, equivalencies=[], fvalidate=<function FLRW.Ob0>, doc='Omega baryon; baryonic matter density/critical density at z=0.'), w0: ~astropy.cosmology.parameter._core.Parameter = Parameter(default=-1.0, derived=False, unit=None, equivalencies=[], fvalidate='float', doc='Dark energy equation of state.'), *, name: _NameField = None, meta: MetaData = None) None#

Methods

H(z)

Compute the Hubble parameter \(H(z)\) for a flat wCDM cosmology.

Ob(z)

Return the density parameter for baryonic matter at redshift z.

Ode(z)

Return the density parameter for dark energy at redshift z.

Odm(z)

Return the density parameter for dark matter at redshift z.

Ogamma(z)

Return the density parameter for photons at redshift z.

Ok(z)

Return the equivalent density parameter for curvature at redshift z.

Om(z)

Return the density parameter for non-relativistic matter at redshift z.

Onu(z)

Return the density parameter for neutrinos at redshift z.

Otot(z)

The total density parameter at redshift z.

Tcmb(z)

Return the CMB temperature at redshift z.

Tnu(z)

Return the neutrino temperature at redshift z.

__init__(H0, Om0[, Tcmb0, equivalencies, ...])

abs_distance_integrand(z)

Integrand of the absorption distance (eq.

absorption_distance(z)

Compute the absorption distance using an analytic integral of the Pade approximation.

age(z[, zmax])

Compute the age of the universe at redshift z.

angular_diameter_distance(z)

Angular diameter distance in Mpc at a given redshift.

angular_diameter_distance_z1z2(z1, z2)

Angular diameter distance between objects at 2 redshifts.

arcsec_per_kpc_comoving(z)

Angular separation in arcsec equal to a comoving kpc at redshift z.

arcsec_per_kpc_proper(z)

Angular separation in arcsec corresponding to a proper kpc at redshift z.

clone(*[, meta, to_nonflat])

Returns a copy of this object with updated parameters, as specified.

comoving_distance(z)

Compute the comoving distance using an analytic integral of the Pade approximation.

comoving_transverse_distance(z)

Compute the comoving distance using an analytic integral of the Pade approximation.

comoving_volume(z)

Compute the comoving volume out to redshift z.

critical_density(z)

Critical density in grams per cubic cm at redshift z.

dDLdz(z)

The Jacobian for the conversion of redshift to luminosity distance.

dLdH(z)

Derivative of the luminosity distance w.r.t.

de_density_scale(z)

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.

differential_comoving_volume(z)

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.

is_equivalent(other, /, *[, format])

Check equivalence between Cosmologies.

kpc_comoving_per_arcmin(z)

Separation in transverse comoving kpc equal to an arcmin at redshift z.

kpc_proper_per_arcmin(z)

Separation in transverse proper kpc equal to an arcminute at redshift z.

lookback_distance(z)

The lookback distance is the light travel time distance to a given redshift.

lookback_time(z)

Compute the lookback time using an analytic integral of the Pade approximation.

lookback_time_integrand(z)

Integrand of the lookback time (equation 30 of [1]).

luminosity_distance(z)

Compute the luminosity distance using an analytic integral of the Pade approximation.

nu_relative_density(z)

Neutrino density function relative to the energy density in photons.

scale_factor(z)

Scale factor at redshift z.

source_to_detector_frame(m1, m2, z)

Convert masses and redshift from the source frame to the detector frame.

w(z)

Returns dark energy equation of state at redshift z.

Attributes

H0

Hubble constant as an ~astropy.units.Quantity at z=0.

Neff

Number of effective neutrino species.

Ob0

Omega baryon; baryonic matter density/critical density at z=0.

Ode0

Omega dark energy; dark energy density/critical density at z=0.

Odm0

Omega dark matter; dark matter density/critical density at z=0.

Ogamma0

Omega gamma; the density/critical density of photons at z=0.

Ok0

Omega curvature; the effective curvature density/critical density at z=0.

Om0

Omega matter; matter density/critical density at z=0.

Onu0

Omega nu; the density/critical density of neutrinos at z=0.

Otot0

Omega total; the total density/critical density at z=0.

Tcmb0

Temperature of the CMB as ~astropy.units.Quantity at z=0.

Tnu0

Temperature of the neutrino background as |Quantity| at z=0.

critical_density0

Critical density as ~astropy.units.Quantity at z=0.

from_format

h

Dimensionless Hubble constant: h = H_0 / 100 [km/sec/Mpc].

has_massive_nu

Does this cosmology have at least one massive neutrino species?

hubble_distance

Compute the Hubble distance \(D_H = c H_0^{-1}\) in Mpc.

hubble_time

Compute the Hubble time \(t_H = H_0^{-1}\) in Gyr.

is_flat

Return True, the cosmology is flat.

m_nu

Mass of neutrino species.

meta

name

The name of the cosmology realization, e.g. 'Planck2018' or None.

nonflat

Return the equivalent non-flat-class instance of this cosmology.

parameters

Immutable mapping of the Parameters.

read

scale_factor0

Scale factor at redshift 0.

to_format

w0

Dark energy equation of state.

write

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

H0: Parameter#

Hubble constant as an ~astropy.units.Quantity at z=0.

Neff: Parameter#

Number of effective neutrino species.

Ob(z)#

Return the density parameter for baryonic matter at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Obndarray or float

The density of baryonic matter relative to the critical density at each redshift. Returns float if the input is scalar.

Raises:
ValueError

If Ob0 is None.

Ob0: Parameter#

Omega baryon; baryonic matter density/critical density at z=0.

Ode(z)#

Return the density parameter for dark energy at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Odendarray or float

The density of non-relativistic matter relative to the critical density at each redshift. Returns float if the input is scalar.

Ode0: Parameter#

Omega dark energy; dark energy density/critical density at z=0.

Odm(z)#

Return the density parameter for dark matter at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Odmndarray or float

The density of non-relativistic dark matter relative to the critical density at each redshift. Returns float if the input is scalar.

Raises:
ValueError

If Ob0 is None.

Notes

This does not include neutrinos, even if non-relativistic at the redshift of interest.

property Odm0#

Omega dark matter; dark matter density/critical density at z=0.

Ogamma(z)#

Return the density parameter for photons at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Ogammandarray or float

The energy density of photons relative to the critical density at each redshift. Returns float if the input is scalar.

property Ogamma0#

Omega gamma; the density/critical density of photons at z=0.

Ok(z)#

Return the equivalent density parameter for curvature at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Okndarray or float

The equivalent density parameter for curvature at each redshift. Returns float if the input is scalar.

property Ok0#

Omega curvature; the effective curvature density/critical density at z=0.

Om(z)#

Return the density parameter for non-relativistic matter at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Omndarray or float

The density of non-relativistic matter relative to the critical density at each redshift. Returns float if the input is scalar.

Notes

This does not include neutrinos, even if non-relativistic at the redshift of interest; see Onu.

Om0: Parameter#

Omega matter; matter density/critical density at z=0.

Onu(z)#

Return the density parameter for neutrinos at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Onundarray or float

The energy density of neutrinos relative to the critical density at each redshift. Note that this includes their kinetic energy (if they have mass), so it is not equal to the commonly used \(\sum \frac{m_{\nu}}{94 eV}\), which does not include kinetic energy. Returns float if the input is scalar.

property Onu0#

Omega nu; the density/critical density of neutrinos at z=0.

Otot(z)#

The total density parameter at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshifts.

Returns:
Ototndarray or float

Returns float if input scalar. Value of 1.

property Otot0#

Omega total; the total density/critical density at z=0.

Tcmb(z)#

Return the CMB temperature at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Tcmb~astropy.units.Quantity [‘temperature’]

The temperature of the CMB in K.

Tcmb0: Parameter#

Temperature of the CMB as ~astropy.units.Quantity at z=0.

Tnu(z)#

Return the neutrino temperature at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Tnu~astropy.units.Quantity [‘temperature’]

The temperature of the cosmic neutrino background in K.

property Tnu0#

Temperature of the neutrino background as |Quantity| at z=0.

abs_distance_integrand(z)#

Integrand of the absorption distance (eq. 4, [1]).

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
dXfloat or array

The integrand for the absorption distance (dimensionless).

References

[1]

Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B

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

angular_diameter_distance(z)#

Angular diameter distance in Mpc at a given redshift.

This gives the proper (sometimes called ‘physical’) transverse distance corresponding to an angle of 1 radian for an object at redshift z ([1], [2], [3]).

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
d~astropy.units.Quantity [‘length’]

Angular diameter distance in Mpc at each input redshift.

References

[1]

Weinberg, 1972, pp 420-424; Weedman, 1986, pp 421-424.

[2]

Weedman, D. (1986). Quasar astronomy, pp 65-67.

[3]

Peebles, P. (1993). Principles of Physical Cosmology, pp 325-327.

angular_diameter_distance_z1z2(z1, z2)#

Angular diameter distance between objects at 2 redshifts.

Useful for gravitational lensing, for example computing the angular diameter distance between a lensed galaxy and the foreground lens.

Parameters:
z1, z2Quantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshifts. For most practical applications such as gravitational lensing, z2 should be larger than z1. The method will work for z2 < z1; however, this will return negative distances.

Returns:
d~astropy.units.Quantity

The angular diameter distance between each input redshift pair. Returns scalar if input is scalar, array else-wise.

arcsec_per_kpc_comoving(z)#

Angular separation in arcsec equal to a comoving kpc at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
theta~astropy.units.Quantity [‘angle’]

The angular separation in arcsec corresponding to a comoving kpc at each input redshift.

arcsec_per_kpc_proper(z)#

Angular separation in arcsec corresponding to a proper kpc at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
theta~astropy.units.Quantity [‘angle’]

The angular separation in arcsec corresponding to a proper kpc at each input redshift.

clone(*, meta: Mapping | None = None, to_nonflat: bool = False, **kwargs) Self#

Returns a copy of this object with updated parameters, as specified.

This cannot be used to change the type of the cosmology, except for changing to the non-flat version of this cosmology.

Parameters:
metamapping or None (optional, keyword-only)

Metadata that will update the current metadata.

to_nonflatbool, optional keyword-only

Whether to change to the non-flat version of this cosmology.

**kwargs

Cosmology parameter (and name) modifications. If any parameter is changed and a new name is not given, the name will be set to “[old name] (modified)”.

Returns:
newcosmo~astropy.cosmology.Cosmology subclass instance

A new instance of this class with updated parameters as specified. If no arguments are given, then a reference to this object is returned instead of copy.

Examples

To make a copy of the Planck13 cosmology with a different matter density (Om0), and a new name:

>>> from astropy.cosmology import Planck13
>>> Planck13.clone(name="Modified Planck 2013", Om0=0.35)
FlatLambdaCDM(name='Modified Planck 2013', H0=<Quantity 67.77 km / (Mpc s)>,
              Om0=0.35, ...

If no name is specified, the new name will note the modification.

>>> Planck13.clone(Om0=0.35).name
'Planck13 (modified)'

The keyword ‘to_nonflat’ can be used to clone on the non-flat equivalent cosmology. For FLRW cosmologies this means Ode0 can be modified:

>>> Planck13.clone(to_nonflat=True, Ode0=1)
LambdaCDM(name='Planck13 (modified)', H0=<Quantity 67.77 km / (Mpc s)>,
          Om0=0.30712, Ode0=1.0, ...
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\)

critical_density(z)#

Critical density in grams per cubic cm at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
rho~astropy.units.Quantity

Critical density in g/cm^3 at each input redshift.

property critical_density0#

Critical density as ~astropy.units.Quantity at z=0.

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 astropy cosmology 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 h#

Dimensionless Hubble constant: h = H_0 / 100 [km/sec/Mpc].

property has_massive_nu#

Does this cosmology have at least one massive neutrino species?

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

is_equivalent(other: Any, /, *, format: _FormatType = False) bool#

Check equivalence between Cosmologies.

Two cosmologies may be equivalent even if not the same class. For example, an instance of LambdaCDM might have \(\Omega_0=1\) and \(\Omega_k=0\) and therefore be flat, like FlatLambdaCDM.

Parameters:
other~astropy.cosmology.Cosmology subclass instance, positional-only

The object to which to compare.

formatbool or None or str, optional keyword-only

Whether to allow, before equivalence is checked, the object to be converted to a |Cosmology|. This allows, e.g. a |Table| to be equivalent to a Cosmology. False (default) will not allow conversion. True or None will, and will use the auto-identification to try to infer the correct format. A str is assumed to be the correct format to use when converting. format is broadcast to match the shape of other. Note that the cosmology arguments are not broadcast against format, so it cannot determine the output shape.

Returns:
bool

True if cosmologies are equivalent, False otherwise.

Examples

Two cosmologies may be equivalent even if not of the same class. In this examples the LambdaCDM has Ode0 set to the same value calculated in FlatLambdaCDM.

>>> import astropy.units as u
>>> from astropy.cosmology import LambdaCDM, FlatLambdaCDM
>>> cosmo1 = LambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, 0.7)
>>> cosmo2 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3)
>>> cosmo1.is_equivalent(cosmo2)
True

While in this example, the cosmologies are not equivalent.

>>> cosmo3 = FlatLambdaCDM(70 * (u.km/u.s/u.Mpc), 0.3, Tcmb0=3 * u.K)
>>> cosmo3.is_equivalent(cosmo2)
False

Also, using the keyword argument, the notion of equivalence is extended to any Python object that can be converted to a |Cosmology|.

>>> from astropy.cosmology import Planck18
>>> tbl = Planck18.to_format("astropy.table")
>>> Planck18.is_equivalent(tbl, format=True)
True

The list of valid formats, e.g. the |Table| in this example, may be checked with Cosmology.from_format.list_formats().

As can be seen in the list of formats, not all formats can be auto-identified by Cosmology.from_format.registry. Objects of these kinds can still be checked for equivalence, but the correct format string must be used.

>>> tbl = Planck18.to_format("yaml")
>>> Planck18.is_equivalent(tbl, format="yaml")
True
property is_flat#

Return True, the cosmology is flat.

kpc_comoving_per_arcmin(z)#

Separation in transverse comoving kpc equal to an arcmin at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
d~astropy.units.Quantity [‘length’]

The distance in comoving kpc corresponding to an arcmin at each input redshift.

kpc_proper_per_arcmin(z)#

Separation in transverse proper kpc equal to an arcminute at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
d~astropy.units.Quantity [‘length’]

The distance in proper kpc corresponding to an arcmin at each input redshift.

lookback_distance(z)#

The lookback distance is the light travel time distance to a given redshift.

It is simply c * lookback_time. It may be used to calculate the proper distance between two redshifts, e.g. for the mean free path to ionizing radiation.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
d~astropy.units.Quantity [‘length’]

Lookback distance in Mpc

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

lookback_time_integrand(z)#

Integrand of the lookback time (equation 30 of [1]).

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
Ifloat or array

The integrand for the lookback time.

References

[1] (1,2)

Hogg, D. (1999). Distance measures in cosmology, section 11. arXiv e-prints, astro-ph/9905116.

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

m_nu: Parameter#

Mass of neutrino species.

name: _NameField = None#

The name of the cosmology realization, e.g. ‘Planck2018’ or None.

property nonflat: _FLRWT#

Return the equivalent non-flat-class instance of this cosmology.

nu_relative_density(z)#

Neutrino density function relative to the energy density in photons.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
fndarray or float

The neutrino density scaling factor relative to the density in photons at each redshift. Only returns float if z is scalar.

Notes

The density in neutrinos is given by

\[\rho_{\nu} \left(a\right) = 0.2271 \, N_{eff} \, f\left(m_{\nu} a / T_{\nu 0} \right) \, \rho_{\gamma} \left( a \right)\]

where

\[f \left(y\right) = \frac{120}{7 \pi^4} \int_0^{\infty} \, dx \frac{x^2 \sqrt{x^2 + y^2}} {e^x + 1}\]

assuming that all neutrino species have the same mass. If they have different masses, a similar term is calculated for each one. Note that f has the asymptotic behavior \(f(0) = 1\). This method returns \(0.2271 f\) using an analytical fitting formula given in Komatsu et al. 2011, ApJS 192, 18.

parameters = mappingproxy({'H0': Parameter(derived=False, unit=Unit("km / (Mpc s)"), equivalencies=[], fvalidate='scalar', doc='Hubble constant as an `~astropy.units.Quantity` at z=0.'), 'Om0': Parameter(derived=False, unit=None, equivalencies=[], fvalidate='non-negative', doc='Omega matter; matter density/critical density at z=0.'), 'Tcmb0': Parameter(default=<Quantity 0. K>, derived=False, unit=Unit("K"), equivalencies=[], fvalidate='scalar', doc='Temperature of the CMB as `~astropy.units.Quantity` at z=0.'), 'Neff': Parameter(default=3.04, derived=False, unit=None, equivalencies=[], fvalidate='non-negative', doc='Number of effective neutrino species.'), 'm_nu': Parameter(default=<Quantity 0. eV>, derived=False, unit=Unit("eV"), equivalencies=[(Unit("kg"), Unit("J"), <function mass_energy.<locals>.<lambda>>, <function mass_energy.<locals>.<lambda>>), (Unit("kg / m2"), Unit("J / m2"), <function mass_energy.<locals>.<lambda>>, <function mass_energy.<locals>.<lambda>>), (Unit("kg / m3"), Unit("J / m3"), <function mass_energy.<locals>.<lambda>>, <function mass_energy.<locals>.<lambda>>), (Unit("kg / s"), Unit("J / s"), <function mass_energy.<locals>.<lambda>>, <function mass_energy.<locals>.<lambda>>)], fvalidate=<function FLRW.m_nu>, doc='Mass of neutrino species.'), 'Ob0': Parameter(default=None, derived=False, unit=None, equivalencies=[], fvalidate=<function FLRW.Ob0>, doc='Omega baryon; baryonic matter density/critical density at z=0.'), 'w0': Parameter(default=-1.0, derived=False, unit=None, equivalencies=[], fvalidate='float', doc='Dark energy equation of state.')})#

Immutable mapping of the Parameters.

If accessed from the class, this returns a mapping of the Parameter objects themselves. If accessed from an instance, this returns a mapping of the values of the Parameters.

scale_factor(z)#

Scale factor at redshift z.

The scale factor is defined as \(a = 1 / (1 + z)\).

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
andarray or float

Scale factor at each input redshift. Returns float if the input is scalar.

property scale_factor0#

Scale factor at redshift 0.

The scale factor is defined as \(a = \frac{a_0}{1 + z}\). The common convention is to set \(a_0 = 1\). However, in some cases, e.g. in some old CMB papers, \(a_0\) is used to normalize a to be a convenient number at the redshift of interest for that paper. Explicitly using \(a_0\) in both calculation and code avoids ambiguity.

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

w(z)#

Returns dark energy equation of state at redshift z.

Parameters:
zQuantity-like [‘redshift’], array-like, or ~numbers.Number

Input redshift.

Returns:
wndarray or float

The dark energy equation of state Returns float if the input is scalar.

Notes

The dark energy equation of state is defined as \(w(z) = P(z)/\rho(z)\), where \(P(z)\) is the pressure at redshift z and \(\rho(z)\) is the density at redshift z, both in units where c=1. Here this is \(w(z) = w_0\).

w0: Parameter#

Dark energy equation of state.