API/Reference

Unitful

Unitful.jl works seamlessly with Cosmology.jl. In order to use its features, make sure it is installed and imported, along with UnitfulAstro.

pkg> add Unitful UnitfulAstro
julia> using Unitful, UnitfulAstro

Cosmological Models

Cosmology.cosmologyFunction
cosmology(; h = 0.69,
            Neff = 3.04,
            OmegaK = 0,
            OmegaM = 0.29,
            OmegaR = nothing,
            Tcmb = 2.7255,
            w0 = -1,
            wa = 0)

Parameters

  • h - Dimensionless Hubble constant
  • Neff - Effective number of massless neutrino species; used to compute Ω_ν
  • OmegaK - Curvature density (Ω_k)
  • OmegaM - Matter density (Ω_m)
  • OmegaR - Radiation density (Ω_r)
  • Tcmb - CMB temperature in Kelvin; used to compute Ω_γ
  • w0 - CPL dark energy equation of state; w = w0 + wa(1-a)
  • wa - CPL dark energy equation of state; w = w0 + wa(1-a)

Examples

julia> c = cosmology()
Cosmology.FlatLCDM{Float64}(0.69, 0.7099122024007928, 0.29, 8.77975992071536e-5)

julia> c = cosmology(OmegaK=0.1)
Cosmology.OpenLCDM{Float64}(0.69, 0.1, 0.6099122024007929, 0.29, 8.77975992071536e-5)

julia> c = cosmology(w0=-0.9, OmegaK=-0.1)
Cosmology.ClosedWCDM{Float64}(0.69, -0.1, 0.8099122024007929, 0.29, 8.77975992071536e-5, -0.9, 0.0)
source

Distances

Cosmology.angular_diameter_distFunction
angular_diameter_dist([u::Unitlike,] c::AbstractCosmology, [z₁,] z₂)

Ratio of the proper transverse size in Mpc of an object at redshift z₂ to its angular size in radians, as seen by an observer at z₁. Redshift z₁ defaults to 0 if omitted. Will convert to compatible unit u if provided.

source
Cosmology.comoving_radial_distFunction
comoving_radial_dist([u::Unitlike,] c::AbstractCosmology, [z₁,] z₂)

Comoving radial distance ($D_C$) in Mpc at redshift z₂ as seen by an observer at z₁. Redshift z₁ defaults to 0 if omitted. Will convert to compatible unit u if provided.

It's calculated as $D_C = D_{H0} Z$, where $D_{H0}$ is the Hubble distance at the present epoch and, $Z = \int_{z_1}^{z_2} \frac{dz}{E(z)}$.

source
Cosmology.luminosity_distFunction
luminosity_dist([u::Unitlike,] c::AbstractCosmology, z)

Bolometric luminosity distance in Mpc at redshift z. Will convert to compatible unit u if provided.

source
Cosmology.hubble_distFunction
hubble_dist(c::AbstractCosmology, z)

Hubble distance $D_H$, defined as the product of the speed of light and the Hubble time. That is, $D_H(z) = c / H(z)$.

See also

hubble_time

source

Examples

julia> c = cosmology(OmegaM=0.26)
Cosmology.FlatLCDM{Float64}(0.69, 0.7399122024007928, 0.26, 8.77975992071536e-5)

julia> angular_diameter_dist(c, 1.2)
1784.0089227105113 Mpc

julia> angular_diameter_dist(c, 0.7, 1.2)
606.6521737365097 Mpc

julia> luminosity_dist(c, 1.5)
11420.338287150073 Mpc

julia> luminosity_dist(u"Gpc", c, 1.5) # Can convert to appropriate unit
11.420338287150074 Gpc

Volumes

Cosmology.comoving_volume_elementFunction
comoving_volume_element([u::Unitlike,] c::AbstractCosmology, z)

Comoving volume element in Gpc out to redshift z. Will convert to compatible unit u if provided.

source
Cosmology.comoving_volumeFunction
comoving_volume([u::Unitlike,] c::AbstractCosmology, z)

Comoving volume in cubic Gpc out to redshift z. Will convert to compatible unit u if provided.

source

Examples

julia> c = cosmology(OmegaM=0.26)
Cosmology.FlatLCDM{Float64}(0.69, 0.7399122024007928, 0.26, 8.77975992071536e-5)

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

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

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

Times

Cosmology.ageFunction
age([u::Unitlike,] c::AbstractCosmology, z)

Age of the universe in Gyr at redshift z. Will convert to compatible unit u if provided.

source
Cosmology.lookback_timeFunction
lookback_time([u::Unitlike,] c::AbstractCosmology, z)

Difference between age at redshift 0 and age at redshift z in Gyr. Will convert to compatible unit u if provided.

source

Examples

julia> c = cosmology(OmegaM=0.26)
Cosmology.FlatLCDM{Float64}(0.69, 0.7399122024007928, 0.26, 8.77975992071536e-5)

julia> age(c, 1.2)
5.4454795007229455 Gyr

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

Miscellaneous

Cosmology.HFunction
H(c::AbstractCosmology, z)

Hubble parameter at redshift z.

source

Bibliography