https://github.com/hersle/class.jl
A simple Julia wrapper for the cosmological Boltzmann solver CLASS that reads its output as DataFrames.
https://github.com/hersle/class.jl
Last synced: 3 months ago
JSON representation
A simple Julia wrapper for the cosmological Boltzmann solver CLASS that reads its output as DataFrames.
- Host: GitHub
- URL: https://github.com/hersle/class.jl
- Owner: hersle
- License: mit
- Created: 2025-06-26T16:53:20.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-06-30T21:46:21.000Z (11 months ago)
- Last Synced: 2025-10-04T22:31:47.995Z (8 months ago)
- Language: Julia
- Homepage: http://class-code.net/
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CLASS.jl
A simple Julia wrapper for the cosmological Boltzmann solver [CLASS](http://class-code.net/) that reads its output as [DataFrames](https://github.com/JuliaData/DataFrames.jl).
## Installation
```julia-repl
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](https://github.com/lesgourg/class_public/blob/master/explanatory.ini), then solve it (you can pass `exec = "/path/to/custom/CLASS/executable"` to `solve`):
```julia-repl
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
```