Cosmological conversions
GadgetUnits.jl supplied some conversion functions to convert observables in given cosmologies. These functions rely on Cosmology.jl, specifically a struct of AbstractCosmology.
Cosmology
To define an AbstractCosmology from the properties of the simulation you can use the multiple dispatch function
Cosmology.cosmology — Functioncosmology(h::AbstractGadgetHeader)Defines a Cosmology.AbstractCosmology from the properties of h.
Time
To get the current age of the universe you can use age
Cosmology.age — Functionage(h::AbstractGadgetHeader, units::Bool=false)Computes the age of the universe given the properties from AbstractGadgetHeader.
If the optional parameter units is set to true it will preserve the unit property. Otherwise it will return a Real in units Gyrs.
Scale
You can convert arcminutes to kpc for an object at redshift z with arcmin_to_kpc. This can be used either with a pre-defined Cosmology.AbstractCosmology or can use a AbstractGadgetHeader struct from GadgetIO.jl which defines the AbstractCosmology on the fly. If you input θ::Real the function will return kpc, but remove the unit property. Optionally you can define θ::Unitful.AbstractQuantity which preserves the unit property.
GadgetUnits.arcmin_to_kpc — Functionarcmin_to_kpc(c::Cosmology.AbstractCosmology, θ::Unitful.AbstractQuantity, z::Real)Convert arcmin to kpc for a given redshift z and cosmology c. Conserves unit information.
arcmin_to_kpc(c::Cosmology.AbstractCosmology, θ::Real, z::Real)Convert arcmin to kpc for a given redshift z and cosmology c. Deletes unit information.
arcmin_to_kpc(θ::Real, h::AbstractGadgetHeader)Convert arcmin to kpc for a given redshift and cosmology taken from AbstractGadgetHeader.
arcmin_to_kpc(θ::Unitful.AbstractQuantity, h::AbstractGadgetHeader)Convert arcmin to kpc for a given redshift and cosmology taken from AbstractGadgetHeader.
Radiation
To convert synchrotron radiation from mJy to W/Hz you can use mJy_to_W. Like in the case of Scale you can use either a pre-defined AbstractCosmology or use an AbstractGadgetHeader.
GadgetUnits.mJy_to_W — FunctionmJy_to_W( c::Cosmology.AbstractCosmology, S::Unitful.AbstractQuantity, z::Real )Converts synchrotron flux density S in [mJy] to [W/Hz] for a given redshift z and cosmology c. Conserves unit information.
mJy_to_W( c::Cosmology.AbstractCosmology, S::Real, z::Real )Converts synchrotron flux density S in [mJy] to [W/Hz] for a given redshift z and cosmology c. Deletes unit information.
mJy_to_W(S::Union{Real, Unitful.AbstractQuantity}, h::AbstractGadgetHeader)Converts synchrotron flux density S in [mJy] to [W/Hz] for a given redshift and cosmology taken from AbstractGadgetHeader.
mJy_to_W(S::Union{Real,Unitful.AbstractQuantity}, d::Unitful.AbstractQuantity)Converts synchrotron flux density S in [mJy] to [W/Hz] for a given distance d.
mJy_to_W(S::Union{Real,Unitful.AbstractQuantity}, d::Real)Converts synchrotron flux density S in [mJy] to [W/Hz] for a given distance d in [Mpc].
mJy_to_W(S::Union{Real,Unitful.AbstractQuantity}, d::Real)Converts synchrotron flux density S in [mJy] to [W/Hz] for a given distance d in [Mpc].