JuliaAstro / Cosmology.jl

Cosmology library for Julia
https://juliaastro.github.io/Cosmology.jl/dev
MIT License
56 stars 25 forks source link

Default cosmology #4

Open SzymonPrajs opened 8 years ago

SzymonPrajs commented 8 years ago

Just wondering if the default cosmology shouldn't be updated to the Planck '15 values?

Also, is there some way of passing a name of the result, similar to Astropy, which would set all defaults. Something along the lines of Cosmology(results="WMAP9") rather than having to set the values manually?

kbarbary commented 8 years ago

Would probably be better to define constants corresponding to various results. e.g.,

const WMAP9 = cosmology(h=0.69, Neff=3.04, ...)
const Planck15 = cosmology(h=..., Neff=..., ...)

The only issue is that experiments report multiple sets of parameters, depending on assumptions. e.g., the best fit parameters assuming Lambda CDM, the best fit assuming wCDM, assuming flat, assuming w0-wa, etc. What does astropy do here?

One solution would be to define a type for each result and use dispatch. This would be an alternative to the const approach above.

abstract CosmologyResult
type WMAP9 <: CosmologyResult end

FlatLCDM(::Type{WMAP9}) = FlatLCDM(...[best fit parameters]...)
FlatWCDM(::Type{WMAP9}) = FlatWCDM(...[best fit parameters]...)
...