Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recfast splines complain if final redshift is not zero #50

Open
jmsull opened this issue Jun 26, 2021 · 2 comments
Open

Recfast splines complain if final redshift is not zero #50

jmsull opened this issue Jun 26, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@jmsull
Copy link
Collaborator

jmsull commented Jun 26, 2021

If I run the following

饾暋 = CosmoParams()
xstart,xend = -15.0,-1.0
bg = Background(饾暋; x_grid=xstart:0.1:xend)
饾暎 = Bolt.RECFAST(bg=bg, Yp=饾暋.Y_p, OmegaB=饾暋.惟_b)
ih = IonizationHistory(饾暎, 饾暋, bg)

when I get to the last line I get the following error:

"ERROR: BoundsError: attempt to access 141-element scale(interpolate(OffsetArray(::Array{Float64,1}, 0:142), BSpline(Cubic(Line(OnGrid())))), (-15.0:0.1:-1.0,)) with element type Float64 at index [-0.9980221350275645]"

which is coming from around here since zfinal=0.0 appears hardcoded.

Can be persuaded otherwise but it would be nice if we allowed arbitrary final redshift for the perturbations? I will continue using 0 for now since this is not a priority, but this is something to maybe come back to later.

@xzackli
Copy link
Owner

xzackli commented Sep 3, 2021

@jmsull, I can fix this! I wrote the current RECFAST to replicate the original version as closely as possible, in a way that is not very flexible. This is also related to fixing the differentiability of the RECFAST implementation. The steps would be

  1. Crank up the precision, lower the stepsize, and try to find a high-accuracy representation of the solution that the RECFAST code is trying to solve for (it makes various different approximations in different epochs)
  2. Rewrite the stepping that is currently done in the dynamic-step-size method that OrdinaryDiffEq.jl uses
  3. Make sure that they converge to the same solutions
  4. Lower the precision parameters to reach the same level of accuracy as RECFAST, but with the different method

@jmsull
Copy link
Collaborator Author

jmsull commented Sep 14, 2021

This all sounds good! One quick thing to mention is that I bumped up Nz to 100000 (this is also the default value in CLASS)

@jmsull jmsull added the bug Something isn't working label Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants