Skip to content

LaGuer/Cosmology.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cosmology calculator for Julia

Coverage Status Build status codecov Travis MyBinder

Installation

To install the package:

julia> Pkg.add("Cosmology")

Then, to load into your session:

julia> using Cosmology

Cosmological Models

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

h = 0.7079 Dimensionless Hubble constant
OmegaK = 0 Curvature density, Ωk
OmegaM = 0.29 Matter density, Ωm
OmegaR = Ωγ + Ων Radiation density, Ωr
Tcmb = 2.725820831 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()
Cosmology.FlatLCDM{Float64}(0.7079, 0.6999165470916852, 0.3, 8.345290831484895e-5)

julia> C = cosmology(OmegaK=0.1)
Cosmology.OpenLCDM{Float64}(0.7079, 0.1, 0.5999165470916853, 0.3, 8.345290831484895e-5)

julia> c = cosmology(w0=-0.9, OmegaK=-0.1)
Cosmology.ClosedWCDM{Float64}(0.7079, -0.1, 0.7999165470916852, 0.3, 8.345290831484895e-5, -0.9, 0.0)

Distances

angular_diameter_dist_mpc(cosmo, z) Ratio of an object's proper transverse size (in Mpc) to its angular size (in radians)
comoving_radial_dist_mpc(cosmo, z) Comoving radial distance to redshift z, in Mpc
comoving_volume_gpc3(cosmo, z) Comoving volume out to redshift z, in Gpc3
luminosity_dist_mpc(cosmo, z) Bolometric luminosity distance, in Mpc
distmod(cosmo, z) Distance modulus, in units of magnitude
julia> using Cosmology

julia> C = cosmology(OmegaM=0.27)
Cosmology.FlatLCDM{Float64}(0.7079, 0.6999165470916852, 0.27, 8.345290831484895e-5)

julia> luminosity_dist(C, 1)
6653.8655390874155 Mpc

julia> angular_diameter_dist_mpc(C, 1)
1663.4663847718539 Mpc

julia> comoving_radial_dist(C, 1)
3326.9327695437078 Mpc

Times

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

julia> C = cosmology(OmegaM=0.27)
Cosmology.FlatLCDM{Float64}(0.7079, 0.7299165470916852, 0.27, 8.345290831484895e-5)

julia> age(C, 0)
13.705983172937254 Gyr

julia> age(C, 1)
5.952350017688919 Gyr

Cite

Back to cosmos

About

Cosmology library for Julia

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jupyter Notebook 92.2%
  • Julia 7.8%