dummy-link

Cosmology

Cosmology library for Julia

Readme

Cosmology calculator for Julia

Build Status Coverage Status

Installation

To install the package:

pkg> add Cosmology

Then, to load into your session:

julia> using Cosmology

Cosmology.jl uses Unitful.jl and UnitfulAstro.jl to handle units.

Cosmological Models

First, pick a cosmological model using the cosmology function, which takes the following options:

h = 0.69 Dimensionless Hubble constant
OmegaK = 0 Curvature density, Ωk
OmegaM = 0.29 Matter density, Ωm
OmegaR = Ωγ + Ων Radiation density, Ωr
Tcmb = 2.7255 CMB temperature (K), used to compute Ωγ
Neff = 3.04 Effective number of massless neutrino species, used to compute Ων
w0 = -1 CPL dark energy equation of state, w = w0 + wa*(1-a)
wa = 0 CPL dark energy equation of state, w = w0 + wa*(1-a)
julia> using Cosmology

julia> c = cosmology()
FlatLCDM(0.69,0.7099122024007928,0.29,8.779759920715362e-5)

julia> c = cosmology(OmegaK=0.1)
OpenLCDM(0.69,0.1,0.6099122024007929,0.29,8.779759920715362e-5)

julia> c = cosmology(w0=-0.9, OmegaK=-0.1)
ClosedWCDM(0.69,-0.1,0.8099122024007929,0.29,8.779759920715362e-5,-0.9,0.0)

Distances

angular_diameter_dist(cosmo, z) Ratio of an object's proper transverse size (in Mpc) to its angular size (in radians)
comoving_radial_dist(cosmo, z) Comoving radial distance to redshift z, in Mpc
luminosity_dist(cosmo, z) Bolometric luminosity distance, in Mpc
distmod(cosmo, z) Distance modulus, in units of magnitude
julia> using Cosmology

julia> c = cosmology(OmegaM=0.26)
FlatLCDM(0.69,0.7399122024007928,0.26,8.779759920715362e-5)

julia> angular_diameter_dist(c, 1.2)
1784.0089227105113 Mpc

For each function returning a unitful number, you can specify a different unit for the result as first argument to the function:

julia> luminosity_dist(c, 1.5)
11420.338287150073 Mpc

julia> luminosity_dist(u"Gpc", c, 1.5)
11.420338287150074 Gpc

Volumes

comoving_volume_element(cosmo, z) Comoving volume element out to redshift z, in Gpc3
comoving_volume(cosmo, z) Comoving volume out to redshift z, in Gpc3
julia> using Cosmology

julia> c = cosmology(OmegaM=0.26)
FlatLCDM(0.69,0.7399122024007928,0.26,8.779759920715362e-5)

julia> comoving_volume_element(c, 2.1)
46.74459228888612 Gpc^3

julia> comoving_volume(c, 0.6)
49.3633436631307 Gpc^3

julia> comoving_volume(u"ly^3", c, 0.6)
1.7127035381752994e30 ly^3

Times

age(cosmo, z) Age of the universe at redshift z, in Gyr
lookback_time(cosmo, z) Difference between age at redshift 0 and age at redshift z, in Gyr
julia> using Cosmology

julia> c = cosmology(OmegaM=0.26)
FlatLCDM(0.69,0.7399122024007928,0.26,8.779759920715362e-5)

julia> age(c, 1.2)
5.445600787626434 Gyr

julia> lookback_time(u"yr", c, 1.2)
8.761660748088268e9 yr

First Commit

09/29/2013

Last Touched

2 days ago

Commits

49 commits

Used By: