# cosmocalc¶

Calculate useful values for a given cosmology. This module uses code adapted from CC.py (James Schombert) which is a Python version of the Cosmology Calculator (Ned Wright).

The following values are calculated:

Name Value Units
z Input redshift
H0 Hubble constant
WK Omega curvaturve = 1-Omega(total)
WM Omega matter
WV Omega vacuum
DTT Time from z to now Gyr
age Age of Universe Gyr
zage Age of Universe at redshift z Gyr
DCMR Comoving radial distance Gyr Mpc cm
VCM Comoving volume within redshift Gpc3
DA Angular size distance Gyr Mpc cm
DL Luminosity distance Gyr Mpc cm
PS Plate scale - distance per arcsec kpc cm

## Functions¶

cosmocalc.cosmocalc(z, H0=71, WM=0.27, WV=None)

Calculate useful values for the supplied cosmology.

This routine returns a dictionary of values in the form <name>: <value>, where the values are supplied in “natural” units for cosmology, e.g. 1/H0. In addition various useful unit conversions are done and stored in the dictionary as <name>_<unit>: <value>. E.g. angular size distance:

'DA': 0.38250549415474988,
'DA_Gyr': 5.2678010166833023,
'DA_Mpc': 1615.1022857909447,
'DA_cm': 4.9836849147807571e+27

Example:

>>> from cosmocalc import cosmocalc
>>> from pprint import pprint
>>> pprint(cosmocalc(3, H0=75, WM=.25))
{'DA': 0.39103776375786625,
'DA_Gyr': 5.0980896720325548,
'DA_Mpc': 1563.0689649039205,
'DA_cm': 4.8231268630387788e+27,
'DCMR': 1.564151055031465,
'DCMR_Gyr': 20.392358688130219,
'DCMR_Mpc': 6252.2758596156818,
'DCMR_cm': 1.9292507452155115e+28,
'DL': 6.25660422012586,
'DL_Gyr': 81.569434752520877,
'DL_Mpc': 25009.103438462727,
'DL_cm': 7.717002980862046e+28,
'DTT': 0.84826379084317027,
'DTT_Gyr': 11.059097795819358,
'H0': 75,
'PS_cm': 2.3383178917293232e+22,
'PS_kpc': 7.5779721961095019,
'VCM': 1.2756009121294902,
'VCM_Gpc3': 1023.7714254161302,
'WK': 0.0,
'WM': 0.25,
'WR': 7.4044444444444448e-05,
'WV': 0.74992595555555552,
'age': 1.0133755371756261,
'age_Gyr': 13.211714670004362,
'z': 3,
'zage': 0.16511174633245579,
'zage_Gyr': 2.1526168741850036}
Parameters: z – redshift H0 – Hubble constant (default = 71) WM – Omega matter (default = 0.27) WV – Omega vacuum (default = 1.0 - WM - 0.4165/(H0*H0)) dictionary of cosmology values (name_unit = value)
cosmocalc.get_options()

cosmocalc.py [options] redshift [name_unit [name_unit2 ...]]

Allowed name_unit values:

DA DA_Gyr DA_Mpc DA_cm
DL DL_Gyr DL_Mpc DL_cm
DCMR DCMR_Gyr DCMR_Mpc DCMR_cm
PS_kpc PS_cm
DTT DTT_Gyr
VCM VCM_Gpc3
age age_Gyr
zage zage_Gyr
H0 WM WV WK WR z

If no name_unit values are supplied then all the above will be printed.

cosmocalc.main()