Pragmatic helpers for cosmology that wrap Cosmology.jl and expose default conversions, rich distance/time value types, and typed helpers for common Planck-like models.
CosmologicalModelkeeps planck-compatible defaults, cached interpolation tables (distance/time ↔ redshift), and guards for optional parameters (e.g., baryons).- Distance/time wrappers such as
DistanceComoving,DistanceLightTravel,TimeLookback, andTimeConformalwork withRedshift/ScaleFactorconversions out of the box. - Typed conversion tables (
NamedTuples) keep lookups fast and avoid repeatedDictallocations. CosmologyPlanck()seeds the default cosmology, so you can build conversions without wiring up parameters manually.
using Cosmos
cosmo = CosmologyPlanck()
d = DistanceComoving(cosmo, 600u"Mpc")
redshift = d |> Redshift
scale = redshift |> ScaleFactor
luminosity = convert(DistanceLuminosity, d)All distance/time conversions honour the cosmology stored in the value, so chained conversions stay consistent without re-specifying the model.
Along with the conversion wrappers shown above, you can create a distance from two redshifts or scale factors:
z1 = Redshift(2.0)
z0 = Redshift(0.1)
dt = DistanceLightTravel(cosmo, z1, z0)This package pre-builds monotonic interpolations between redshift and any supported measure to keep repeated lookups fast, so repeated DistanceXXX constructors reuse cached tables rather than recomputing cosmology integrals.
- Run the bundled test suite with
julia --project -e 'using Pkg; Pkg.test()'. - Documentation is built with Documenter and lives at https://rafaelab.github.io/Cosmos.jl (see
docs/srcfor the source). - Example scripts live in
examples/; each script is runnable viajulia examples/name.jlto demonstrate common conversions.
Fixes and extensions are welcome. Please keep tests green, prefer descriptive doc strings, and run Pkg.test() before opening a PR.
MIT © Rafael Abreu