Skip to content

A simple Julia wrapper for the cosmological Boltzmann solver CLASS that reads its output as DataFrames.

License

Notifications You must be signed in to change notification settings

hersle/CLASS.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CLASS.jl

A simple Julia wrapper for the cosmological Boltzmann solver CLASS that reads its output as DataFrames.

Installation

julia> using Pkg; Pkg.add("CLASS")

This installs the wrapper, but not the CLASS code itself. Install whichever version of CLASS you want to run yourself!

Usage

Create a CLASSProblem matching the CLASS .ini format, then solve it (you can pass exec = "/path/to/custom/CLASS/executable" to solve):

julia> using CLASS

julia> prob = CLASSProblem(
           "h" => 0.70,
           "output" => [:mPk, "tCl", "pCl"],
           "write_background" => true,
       );

julia> sol = solve(prob)
CLASS solution with tables:
  pk: unread (lazily loaded)
  cl: unread (lazily loaded)
  background: unread (lazily loaded)

julia> sol["background"]
40000ร—19 DataFrame
   Row โ”‚ z           proper time [Gyr]  conf. time [Mpc]  H [1/Mpc]   โ‹ฏ
       โ”‚ Float64     Float64            Float64           Float64     โ‹ฏ
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
     1 โ”‚ 1.0e14            7.55952e-26        4.63479e-9  2.15726e22  โ‹ฏ
     2 โ”‚ 9.99194e13        7.57171e-26        4.63842e-9  2.15378e22
     3 โ”‚ 9.98389e13        7.58393e-26        4.64388e-9  2.15031e22
     4 โ”‚ 9.97585e13        7.59616e-26        4.64752e-9  2.14685e22
     5 โ”‚ 9.96781e13        7.60842e-26        4.65116e-9  2.14339e22  โ‹ฏ
     6 โ”‚ 9.95978e13        7.62069e-26        4.65479e-9  2.13994e22
   โ‹ฎ   โ”‚     โ‹ฎ               โ‹ฎ                 โ‹ฎ               โ‹ฎ      โ‹ฑ
 39996 โ”‚ 0.0032289        13.2951         13703.4         0.000233846
 39997 โ”‚ 0.0024207        13.3063         13706.8         0.000233758
 39998 โ”‚ 0.00161315       13.3176         13710.3         0.00023367  โ‹ฏ
 39999 โ”‚ 0.00080625       13.3288         13713.7         0.000233582
 40000 โ”‚ 0.0              13.3401         13717.2         0.000233495
                                      15 columns and 39989 rows omitted

About

A simple Julia wrapper for the cosmological Boltzmann solver CLASS that reads its output as DataFrames.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages