Cosmology
The Cosmology module controls the cosmological parameters and various derived quantities. We can initialize a cosmology using init_cosmology. For examples on how to use this module and various functions within it, see Example - 1.
Initialization
LensFactory.Cosmology.init_cosmology — Type
init_cosmology(H0::RV=70.0, w::RV=-1.0, Omega_m0::RV=0.3, Omega_r0::RV=0.0, Omega_w0::RV=0.7)An Abstract type to initialize a cosmology with given parameters.
Arguments
H0::RV: Hubble constant in ${\rm \mathbf{km/s/Mpc}}$.w::RV: Dark energy equation of state parameter.Omega_m0::RV: Matter density parameter.Omega_r0::RV: Radiation density parameter.Omega_w0::RV: Dark energy density parameter.
Returns
Omega_k0: Curvature density parameter.
Basics
LensFactory.Cosmology.scale_factor — Function
scale_factor(z::RV) --> RVCalculate scale factor $(a)$ at redshift $z$,
\[a = \frac{1}{1+z}.\]
Arguments
z::RV: Redshift.
Returns
a::RV: Scale factor.
LensFactory.Cosmology.Ez — Function
Ez(cosmology::AbstractCosmology, z::RV) --> RVCalculate dimensionless Hubble parameter $(E)$ at redshift, $z$,
\[E(z) = \sqrt{ Ω_{m0} (1+z)^2 + Ω_{r0} (1+z)^4 + Ω_{k0} (1+z)^2 + Ω_{w0} (1+z)^{3(1+w)} }.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
Ez::RV: Dimensionless Hubble parameter.
LensFactory.Cosmology.hubble_parameter — Function
hubble_parameter(cosmology::AbstractCosmology, z::RV) --> RVCalculate Hubble parameter $(H)$ at redshift $z$ in ${\rm \mathbf{km/s/Mpc}}$,
\[H(z) = H_0 \: E(z).\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
H::RV: Hubble parameter.
Time
LensFactory.Cosmology.hubble_time — Function
hubble_time(H0::RV) --> RVCalculate Hubble time $(t_H)$ in ${\rm \mathbf{Gyr}}$,
\[t_H = \frac{1}{H_0}.\]
Arguments
H0::RV: Hubble constant in ${\rm \mathbf{km/s/Mpc}}$.
Returns
tH::RV: Hubble time in ${\rm \mathbf{Gyr}}$.
LensFactory.Cosmology.age — Function
age(cosmology::AbstractCosmology, z::RV) --> RVCalculate age $(t_{\rm age})$ of the Universe at redshift $z$ in ${\rm \mathbf{Gyr}}$,
\[t_{\rm age}(z) = \int_z^\infty \frac{1}{(1+z')H(z')} dz'.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
age::RV: Age of the Universe in ${\rm \mathbf{Gyr}}$.
LensFactory.Cosmology.lookback_time — Function
lookback_time(cosmology::AbstractCosmology, z::RV) --> RVCalculate lookbak time $(t_L)$ to a given redshift $z$ in ${\rm \mathbf{Gyr}}$,
\[t_L(z) = \int_0^z \frac{1}{(1+z')H(z')} dz'.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
tL::RV: Lookback time in ${\rm \mathbf{Gyr}}$.
Density parameters
LensFactory.Cosmology.rho_cz — Function
rho_cz(cosmology::AbstractCosmology, z::RV) --> RVCalculate the critical density $(\rho_c)$ of the Universe at redshift $z$ in ${\rm \mathbf{kg/m^3}}$,
\[\rho_c(z) = \frac{3 H^2(z)}{8 π {\rm G} }.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
rho_c::RV: Critical density in ${\rm \mathbf{kg/m^3}}$.
LensFactory.Cosmology.Omega_mz — Function
Omega_mz(cosmology::AbstractCosmology, z::RV) --> RVCalculate the dimensionless matter density parameter $(\Omega_{m})$ at redshift $z$,
\[Ω_{m}(z) = Ω_{m}(0) \: (1+z)^3 \left( \frac{H0}{H(z)} \right)^2.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
Omega_m::RV: Dimensionless matter density parameter.
LensFactory.Cosmology.Omega_rz — Function
Omega_rz(cosmology::AbstractCosmology, z::RV) --> RVCalculate the dimensionless radiation density parameter $(\Omega_{r})$ at redshift $z$,
\[Ω_{r}(z) = Ω_{r}(0) \: (1+z)^4 \left( \frac{H_0}{H(z)} \right)^2.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
Omega_r::RV: Dimensionless radiation density parameter.
LensFactory.Cosmology.Omega_wz — Function
Omega_wz(cosmology::AbstractCosmology, z::RV) --> RVCalculate the dimensionless dark energy density parameter $(\Omega_{w})$ at redshift $z$,
\[Ω_{w}(z) = Ω_{w0} (1+z)^{3(1+w)} \left( \frac{H_0}{H(z)} \right)^2.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
Omega_w::RV: Dimensionless dark energy density parameter.
LensFactory.Cosmology.Omega_kz — Function
Omega_kz(cosmology::AbstractCosmology, z::RV) --> RVCalculate the dimensionless curvature density parameter $(\Omega_{k})$ at redshift $z$,
\[Ω_{k}(z) = Ω_{k0} (1+z)^2 \left( \frac{H_0}{H(z)} \right)^2.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
Omega_k::RV: Dimensionless curvature density parameter.
Distances
LensFactory.Cosmology.hubble_distance — Function
hubble_distance(H0::RV) --> RVCalculate the Hubble distance (i.e., size of the observable Universe) $(D_H)$ in ${\rm \mathbf{meters}}$,
\[D_H = \frac{\rm c}{\rm H_0}.\]
Arguments
H0::RV: Hubble constant in ${\rm \mathbf{km/s/Mpc}}$.
Returns
D_H::RV: Hubble distance in ${\rm \mathbf{meters}}$.
LensFactory.Cosmology.comoving_distance_radial — Function
comoving_distance_radial(cosmo::AbstractCosmology, z1::RV, z2::RV) --> RVCalculate the comoving radial distance $(D_C)$ between $z_1$ and $z_2$ in ${\rm \mathbf{meters}}$. The formula is,
\[D_C = D_H \int_{z_1}^{z_2} \frac{dz'}{E(z')}.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z1::RV: Redshift.z2::RV: Redshift.
Returns
D_C::RV: Comoving radial distance in ${\rm \mathbf{meters}}$.
LensFactory.Cosmology.comoving_distance_transverse — Function
comoving_distance_transverse(cosmo::AbstractCosmology, z1::RV, z2::RV) --> RVCalculate the comoving radial distance $(D_M)$ between, $z_1$ and $z_2$ in ${\rm \mathbf{meters}}$,
\[D_M = \begin{cases} D_H \frac{1}{\sqrt{\Omega_k}} \sinh \left[ \sqrt{\Omega_k} \: D_C / D_H \right], & \text{if } \Omega_k > 0, \\ D_C, & \text{if } \Omega_k = 0, \\ D_H \frac{1}{\sqrt{|\Omega_k|}} \sin \left[ \sqrt{|\Omega_k|} \: D_C / D_H \right], & \text{if } \Omega_k < 0. \\ \end{cases}\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z1::RV: Redshift.z2::RV: Redshift.
Returns
D_M::RV: Comoving radial distance in ${\rm \mathbf{meters}}$.
LensFactory.Cosmology.luminosity_distance — Function
luminosity_distance(cosmology::AbstractCosmology, z::RV) --> RVCalculate the luminosity distance $(D_L)$ to redshift $z$ in ${\rm \mathbf{meters}}$,
\[D_L(z) = (1+z) D_M(z).\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
D_L::RV: Luminosity distance in ${\rm \mathbf{meters}}$.
LensFactory.Cosmology.angular_diameter_distance — Function
angular_diameter_distance(cosmology::AbstractCosmology, z1::RV, z2::RV) --> RVCalculate the angular diameter distance $(D_A)$ between redshifts $z_1$ and $z_2$ in ${\rm \mathbf{meters}}$,
\[D_A(z_1, z_2) = \frac{D_M(z_1, z_2)}{1+z_2}.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z1::RV: Redshift.z2::RV: Redshift.
Returns
D_A::RV: Angular diameter distance in ${\rm \mathbf{meters}}$.
LensFactory.Cosmology.distance_modulus — Function
distance_modulus(cosmo::AbstractCosmology, z::RV) --> RVCalculate the distance modulus $(\mu)$ to a given redshift $z$,
\[\mu = 5 \log\left( \frac{D_L}{\rm pc} \right) - 5.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
mu::RV: Distance modulus.
LensFactory.Cosmology.angular_scale — Function
angular_scale(cosmology::AbstractCosmology, z::RV) --> RVCalculate the angular size in ${\rm \mathbf{Kpc}}$ for $1''$ on sky at redhsift, $z$,
\[d = 1'' \times \left( \frac{D_A}{\rm{kpc}} \right).\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
d::RV: Angular size in ${\rm \mathbf{Kpc}}$.
LensFactory.Cosmology.adis2zs — Function
adis2zs(cosmology::AbstractCosmology, z_d::RV, adis::RV; max_iter::Int64=10000, tol::Float64=1e-6) --> RVCalculate the source redshift ($z_s$) from the distance ratio ($a_{\rm dis}$), using Bi-section method.
Arguments
cosmology::AbstractCosmology: Cosmology object.z_d::RV: Lens redshift.adis::RV: Distance ratio, $a_{\rm dis}$.max_iter::Int64=10000: Maximum number of iterations.tol::Float64=1e-6: Tolerance for the root finding algorithm.
Returns
z_s::RV: Redshift of the source.
Volumes
LensFactory.Cosmology.comoving_volume_element — Function
comoving_volume_element(cosmology::AbstractCosmology, z::RV) --> RVCalculate the comving volume element $(dV_C)$ at redshift $z$ in ${\rm \mathbf{Gpc^3}}$,
\[dV_C = D_H \frac{D_M^2(z)}{E(z)}.\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
dV_C::RV: Comving volume element in ${\rm \mathbf{Gpc^3}}$.
LensFactory.Cosmology.comoving_volume — Function
comoving_volume(cosmology::AbstractCosmology, z::RV) --> RVCalculate the total comving volume up to redshift $z$ in ${\rm \mathbf{Gpc^3}}$,
\[V_C = \begin{cases} \frac{4π}{2} \frac{D_H^3}{Ω_k} \left[ \frac{D_M}{D_H} \sqrt{1+Ω_k \left(\frac{D_M}{D_H}\right)^2} - \frac{1}{\sqrt{|Ω_k|}} {\rm arcsinh}\left( \sqrt{|Ω_k|} \frac{D_M}{D_H} \right) \right], & \text{if } Ω_k > 0, \\ \frac{4π}{3} D_M^3, & \text{if } Ω_k = 0, \\ \frac{4π}{2} \frac{D_H^3}{|Ω_k|} \left[ \frac{D_M}{D_H} \sqrt{1+Ω_k \left(\frac{D_M}{D_H}\right)^2} - \frac{1}{\sqrt{|Ω_k|}} \arcsin\left( \sqrt{|Ω_k|} \frac{D_M}{D_H} \right) \right], & \text{if } Ω_k < 0. \\ \end{cases}\]
Arguments
cosmology::AbstractCosmology: Cosmology object.z::RV: Redshift.
Returns
com_vol::RV: Comving volume up to redshift $z$ in ${\rm \mathbf{Gpc^3}}$.