xzackli / Bolt.jl

differentiable boltzmann code
MIT License
42 stars 5 forks source link

our very own RECFAST #31

Closed xzackli closed 3 years ago

xzackli commented 3 years ago

We need a differentiable RECFAST. This PR will eventually do it. Fixes #29.

xzackli commented 3 years ago

Wow, this code is older than I am.

codecov-io commented 3 years ago

Codecov Report

Merging #31 (ef3a9d2) into main (06fa8b2) will increase coverage by 34.91%. The diff coverage is 79.79%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main      #31       +/-   ##
===========================================
+ Coverage   14.16%   49.07%   +34.91%     
===========================================
  Files           6        7        +1     
  Lines         346      485      +139     
===========================================
+ Hits           49      238      +189     
+ Misses        297      247       -50     
Impacted Files Coverage Δ
src/Bolt.jl 100.00% <ø> (ø)
src/ionization/ionization.jl 0.00% <0.00%> (ø)
src/spectra.jl 0.00% <0.00%> (ø)
src/ionization/recfast.jl 84.53% <84.53%> (ø)
src/background.jl 88.57% <100.00%> (+88.57%) :arrow_up:
src/util.jl 85.48% <100.00%> (+8.06%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 06fa8b2...ef3a9d2. Read the comment docs.

xzackli commented 3 years ago

RECFAST has a pretty big common block! I didn't realize Fortran doesn't have globals.

xzackli commented 3 years ago
xzackli commented 3 years ago
xzackli commented 3 years ago

To use the new ionization history, you need to do this:

using Bolt
𝕡 = CosmoParams()
bg = Background(𝕡)
𝕣 = Bolt.RECFAST(bg=bg, Yp=𝕡.Y_p, OmegaB=𝕡.Ω_b)  #  𝕣 = Bolt.Peebles()
ih = IonizationHistory(𝕣, 𝕡, bg);

Note that RECFAST depends on a few parameters. In principle, Bolt.RECFAST shouldn't require any parameters. I plan to eventually refactor the internals of the reionization module, so I'll leave it a bit messy for now.