Cosmology Calculator

The cosmology calculator can be used to calculate cosmological distances and times given a set of cosmological parameters. A cosmological dataset, ds, will automatically have a cosmology calculator configured with the correct parameters associated with it as ds.cosmology. A standalone Cosmology calculator object can be created in the following way:

from yt.utilities.cosmology import Cosmology

co = Cosmology(
    hubble_constant=0.7,
    omega_matter=0.3,
    omega_lambda=0.7,
    omega_curvature=0.0,
    omega_radiation=0.0,
)

Once created, various distance calculations as well as conversions between redshift and time are available:

Warning

Cosmological distance calculations return values that are either in the comoving or proper frame, depending on the specific quantity. For simplicity, the proper and comoving frames are set equal to each other within the cosmology calculator. This means that for some distance value, x, x.to(“Mpc”) and x.to(“Mpccm”) will be the same. The user should take care to understand which reference frame is correct for the given calculation.

The helper functions, co.quan and co.arr exist to create unitful YTQuantities and YTArray with the unit registry of the cosmology calculator. For more information on the usage and meaning of each calculation, consult the reference documentation at Cosmology Calculator.