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

constants

The constants namespace for this cosmology object.

name

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], Protocol

API 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 isinstance checks or as an ABC for libraries that wish to define a compatible cosmology class.

Attributes

H0

Hubble parameter at redshift 0 in km s-1 Mpc-1.

Neff

Effective number of neutrino species.

Omega_b0

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

Omega_de0

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

Omega_dm0

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

Omega_gamma0

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

Omega_k0

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

Omega_m0

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

Omega_nu0

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

Omega_tot0

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

T_cmb0

CMB temperature in K at z=0.

constants

The constants namespace for this cosmology object.

critical_density0

Critical density at z = 0 in Msol Mpc-3.

hubble_distance

Hubble distance in Mpc.

hubble_time

Hubble time in Gyr.

m_nu

Neutrino mass(es) in eV.

name

The name of the cosmology instance.

scale_factor0

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 z in 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.

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], Protocol

The standard for Cosmology compatability 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

constants

The constants namespace for this cosmology object.

name

The name of the cosmology instance.

class StandardCosmologyWrapper#

Bases: CosmologyWrapper[Array, InputT], StandardCosmology[Array, InputT], Protocol

The standard for StandardCosmology compatability 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

H0

Hubble parameter at redshift 0 in km s-1 Mpc-1.

Neff

Effective number of neutrino species.

Omega_b0

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

Omega_de0

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

Omega_dm0

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

Omega_gamma0

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

Omega_k0

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

Omega_m0

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

Omega_nu0

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

Omega_tot0

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

T_cmb0

CMB temperature in K at z=0.

constants

The constants namespace for this cosmology object.

critical_density0

Critical density at z = 0 in Msol Mpc-3.

hubble_distance

Hubble distance in Mpc.

hubble_time

Hubble time in Gyr.

m_nu

Neutrino mass(es) in eV.

name

The name of the cosmology instance.

scale_factor0

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 z in 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.