Cosmology#
This page lists the high-level cosmology protocol. This is a fully-featured interface to describe the cosmological background of a physical universe.
At a lower level of abstraction, a cosmology consists of individual components.
- class Cosmology#
Bases:
Protocol[Array,InputT]Cosmology API Protocol.
Attributes
The constants namespace for this cosmology object.
The name of the cosmology instance.
- property __cosmology_namespace__: CosmologyNamespace#
The cosmology namespace for this cosmology object.
- property constants: CosmologyConstantsNamespace#
The constants namespace for this cosmology object.
- property name: str | None#
The name of the cosmology instance.
This is a human-friendly label for the cosmology instance. It is optional, and may be None. If set, it should be a string. The name is useful for identifying the cosmology instance, for example logging the name in an analysis pipeline, presenting helpful error messages, and for plotting.
- class StandardCosmology#
Bases:
NeutrinoComponent[Array,InputT],BaryonComponent[Array,InputT],PhotonComponent[Array,InputT],DarkMatterComponent[Array,InputT],MatterComponent[Array,InputT],DarkEnergyComponent[Array,InputT],CurvatureComponent[Array,InputT],TotalComponent[Array,InputT],HubbleParameter[Array,InputT],CriticalDensity[Array,InputT],DistanceMeasures[Array,InputT],Cosmology[Array,InputT],ProtocolAPI Protocol for the standard cosmology and expected set of components.
This is a protocol class that defines the standard API for the standard (FLRW-like) cosmology cosmology. It is not intended to be instantiaed. Instead, it should be used for
isinstancechecks or as an ABC for libraries that wish to define a compatible cosmology class.Attributes
Hubble parameter at redshift 0 in km s-1 Mpc-1.
Effective number of neutrino species.
Omega baryon; the baryon density/critical density at z=0.
Omega dark energy; the dark energy density/critical density at z=0.
Omega dark matter; the dark matter density/critical density at z=0.
Omega gamma; the photon density/critical density at z=0.
Omega curvature; the effective curvature density/critical density at z=0.
Omega matter; the matter density/critical density at z=0.
Omega neutrino; the neutrino density/critical density at z=0.
Omega total; the total density/critical density at z=0.
CMB temperature in K at z=0.
The constants namespace for this cosmology object.
Critical density at z = 0 in Msol Mpc-3.
Hubble distance in Mpc.
Hubble time in Gyr.
Neutrino mass(es) in eV.
The name of the cosmology instance.
Scale factor at z=0.
Methods
H(z, /)Hubble parameter \(H(z)\) in km s-1 Mpc-1.
H_over_H0(z, /)Standardised Hubble function \(E(z) = H(z)/H_0\).
Omega_b(z, /)Redshift-dependent baryon density parameter.
Omega_de(z, /)Redshift-dependent dark energy density parameter.
Omega_dm(z, /)Redshift-dependent dark matter density parameter.
Omega_gamma(z, /)Redshift-dependent photon density parameter.
Omega_k(z, /)Redshift-dependent curvature density parameter.
Omega_m(z, /)Redshift-dependent matter density parameter.
Omega_nu(z, /)Redshift-dependent neutrino density parameter.
Omega_tot(z, /)Redshift-dependent total density parameter.
T_cmb(z, /)CMB temperature in K at redshift z.
age(z, /)Age of the universe at redshift
zin Gyr.Angular diameter distance \(d_A\) in Mpc.
comoving_distance(...)Comoving line-of-sight distance \(d_c\) in Mpc.
comoving_volume(...)Comoving volume \(V_c\) in Mpc3.
critical_density(z, /)Redshift-dependent critical density in Msol Mpc-3.
Differential comoving volume in Mpc3 per steradian.
lookback_distance(...)Lookback distance \(d_T\) in Mpc.
lookback_time(-> ~cosmology.api._array_api.Array)Lookback time in Gyr.
luminosity_distance(...)Redshift-dependent luminosity distance \(d_L\) in Mpc.
proper_distance(...)Proper distance \(d\) in Mpc.
proper_time(-> ~cosmology.api._array_api.Array)Proper time \(t\) in Gyr.
scale_factor(z, /)Redshift-dependenct scale factor.
Transverse comoving distance \(d_M\) in Mpc.
- property __cosmology_namespace__: CosmologyNamespace#
The cosmology namespace for this cosmology object.
- property constants: CosmologyConstantsNamespace#
The constants namespace for this cosmology object.
- property name: str | None#
The name of the cosmology instance.
This is a human-friendly label for the cosmology instance. It is optional, and may be None. If set, it should be a string. The name is useful for identifying the cosmology instance, for example logging the name in an analysis pipeline, presenting helpful error messages, and for plotting.
Wrappers#
In order to provide a consistent interface, existing cosmology libraries can be wrapped to conform to the Cosmology API. The form of these wrappers is specified here.
Details of using these wrappers is upcoming. You can see the development of the Astropy and CAMB wrappers in the cosmology.api GitHub repo.
For details of how to write your own wrapper, see the developer documentation.
- class CosmologyWrapper#
Bases:
Cosmology[Array,InputT],ProtocolThe standard for
Cosmologycompatability wrappers.This is a protocol class that defines an API standard. It is not intended to be used directly, and should not be instantiated. Instead, it should be used as a Protocol or ABC for libraries that wish to define a wrapper for the standard API.
- Parameters:
- cosmo: object
The object to wrap.
Attributes
constantsThe constants namespace for this cosmology object.
nameThe name of the cosmology instance.
- class StandardCosmologyWrapper#
Bases:
CosmologyWrapper[Array,InputT],StandardCosmology[Array,InputT],ProtocolThe standard for
StandardCosmologycompatability wrappers.This is a protocol class that defines an API standard. It is not intended to be used directly, and should not be instantiated. Instead, it should be used as a Protocol or ABC for libraries that wish to define a wrapper for the standard API.
- Parameters:
- cosmo: object
The object to wrap.
Attributes
H0Hubble parameter at redshift 0 in km s-1 Mpc-1.
NeffEffective number of neutrino species.
Omega_b0Omega baryon; the baryon density/critical density at z=0.
Omega_de0Omega dark energy; the dark energy density/critical density at z=0.
Omega_dm0Omega dark matter; the dark matter density/critical density at z=0.
Omega_gamma0Omega gamma; the photon density/critical density at z=0.
Omega_k0Omega curvature; the effective curvature density/critical density at z=0.
Omega_m0Omega matter; the matter density/critical density at z=0.
Omega_nu0Omega neutrino; the neutrino density/critical density at z=0.
Omega_tot0Omega total; the total density/critical density at z=0.
T_cmb0CMB temperature in K at z=0.
constantsThe constants namespace for this cosmology object.
critical_density0Critical density at z = 0 in Msol Mpc-3.
hubble_distanceHubble distance in Mpc.
hubble_timeHubble time in Gyr.
m_nuNeutrino mass(es) in eV.
nameThe name of the cosmology instance.
scale_factor0Scale factor at z=0.
Methods
H(z, /)Hubble parameter \(H(z)\) in km s-1 Mpc-1.
H_over_H0(z, /)Standardised Hubble function \(E(z) = H(z)/H_0\).
Omega_b(z, /)Redshift-dependent baryon density parameter.
Omega_de(z, /)Redshift-dependent dark energy density parameter.
Omega_dm(z, /)Redshift-dependent dark matter density parameter.
Omega_gamma(z, /)Redshift-dependent photon density parameter.
Omega_k(z, /)Redshift-dependent curvature density parameter.
Omega_m(z, /)Redshift-dependent matter density parameter.
Omega_nu(z, /)Redshift-dependent neutrino density parameter.
Omega_tot(z, /)Redshift-dependent total density parameter.
T_cmb(z, /)CMB temperature in K at redshift z.
age(z, /)Age of the universe at redshift
zin Gyr.angular_diameter_distance(...)Angular diameter distance \(d_A\) in Mpc.
comoving_distance(...)Comoving line-of-sight distance \(d_c\) in Mpc.
comoving_volume(...)Comoving volume \(V_c\) in Mpc3.
critical_density(z, /)Redshift-dependent critical density in Msol Mpc-3.
differential_comoving_volume(z, /)Differential comoving volume in Mpc3 per steradian.
lookback_distance(...)Lookback distance \(d_T\) in Mpc.
lookback_time(-> ~cosmology.api._array_api.Array)Lookback time in Gyr.
luminosity_distance(...)Redshift-dependent luminosity distance \(d_L\) in Mpc.
proper_distance(...)Proper distance \(d\) in Mpc.
proper_time(-> ~cosmology.api._array_api.Array)Proper time \(t\) in Gyr.
scale_factor(z, /)Redshift-dependenct scale factor.
transverse_comoving_distance(...)Transverse comoving distance \(d_M\) in Mpc.