Skip to content

Commit dce1721

Browse files
committed
Tune CLASS comparison tolerances
1 parent 82aee9a commit dce1721

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/src/comparison.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,13 @@ plot_compare(a1, a2, [Φ1, Ψ1], [Φ2, Ψ2], "a", ["Ψ", "Φ"]; lgx=true, tol =
300300
```@example class
301301
δ1 = map(s -> sol1["perturbations_k0_s"][:,"delta_$s"], ["b", "cdm", "g", "ur", "ncdm[0]"])
302302
δ2 = map(s -> sol2[1, s.δ], [M.b, M.c, M.γ, M.ν, M.h])
303-
plot_compare(a1, a2, δ1, δ2, "a", ["δb", "δc", "δγ", "δν", "δh"]; lgx=true, lgy=true)
303+
plot_compare(a1, a2, δ1, δ2, "a", ["δb", "δc", "δγ", "δν", "δh"]; lgx=true, lgy=true, tol = 3e2)
304304
```
305305
### Momenta
306306
```@example class
307307
θ1 = map(s -> sol1["perturbations_k0_s"][:,"theta_$s"], ["b", "cdm", "g", "ur", "ncdm[0]"])
308308
θ2 = map(s -> sol2[1, s.θ] * (h*SymBoltz.k0), [M.b, M.c, M.γ, M.ν, M.h])
309-
plot_compare(a1, a2, θ1, θ2, "a", ["θb", "θc", "θγ", "θν", "θh"]; lgx=true, lgy=true, tol = 3e-2)
309+
plot_compare(a1, a2, θ1, θ2, "a", ["θb", "θc", "θγ", "θν", "θh"]; lgx=true, lgy=true, tol = 6e-2)
310310
```
311311
### Dark energy overdensity
312312
```@example class
@@ -324,7 +324,7 @@ plot_compare(a1, a2, pX1, pX2, "a", "pX"; lgx=true, lgy=true, tol = 3e-7)
324324
```@example class
325325
σ1 = [sol1["perturbations_k0_s"][:,"shear_g"], sol1["perturbations_k0_s"][:,"shear_ur"]]
326326
σ2 = [sol2[1, M.γ.σ], sol2[1, M.ν.F[2]/2]]
327-
plot_compare(a1, a2, σ1, σ2, "a", ["σγ", "σν"]; lgx=true, tol = 7e-4)
327+
plot_compare(a1, a2, σ1, σ2, "a", ["σγ", "σν"]; lgx=true, tol = 3e-3)
328328
```
329329
### Polarization
330330
```@example class
@@ -354,7 +354,7 @@ function P_symboltz(k, pars)
354354
end
355355
k, P1 = P_class(pars)
356356
P2 = P_symboltz(k, pars)
357-
plot_compare(k, k, P1, P2, "k/Mpc⁻¹", "P/Mpc³"; lgx = true, lgy = true, tol = 5e1)
357+
plot_compare(k, k, P1, P2, "k/Mpc⁻¹", "P/Mpc³"; lgx = true, lgy = true, tol = 6e0)
358358
```
359359
```@example class
360360
using ForwardDiff, FiniteDiff
@@ -378,13 +378,13 @@ end
378378
#∂logP2_∂θ = ForwardDiff.jacobian(θ -> log.(P_symboltz(k, Dict(diffpars .=> θ))[2]), θ) # hide
379379
#plot_compare(k, k, eachcol(∂logP1_∂θ), eachcol(∂logP2_∂θ), "k", ["∂(lg(P))/∂($par)" for par in ["Ωc0", "Ωb0", "h"]]; lgx = true) # hide
380380
381-
plot_compare_P_diff(M.c.Ω₀, pars[M.c.Ω₀]; relstep = 1e-3, tol = 1e-1) # smaller relstep is noisier
381+
plot_compare_P_diff(M.c.Ω₀, pars[M.c.Ω₀]; relstep = 1e-3, tol = 4e-2) # smaller relstep is noisier
382382
```
383383
```@example class
384-
plot_compare_P_diff(M.b.Ω₀, pars[M.b.Ω₀]; relstep = 1e-3, tol = 1e-1) # smaller relstep is noisier
384+
plot_compare_P_diff(M.b.Ω₀, pars[M.b.Ω₀]; relstep = 1e-3, tol = 2e-2) # smaller relstep is noisier
385385
```
386386
```@example class
387-
plot_compare_P_diff(M.g.h, pars[M.g.h]; relstep = 1e-3, tol = 1e-1) # smaller relstep is noisier
387+
plot_compare_P_diff(M.g.h, pars[M.g.h]; relstep = 1e-3, tol = 5e-2) # smaller relstep is noisier
388388
```
389389

390390
## CMB power spectrum
@@ -405,13 +405,13 @@ end
405405
l = 20:20:2000 # CLASS default is lmax = 2500
406406
Dl1 = Dl_class([:TT, :TE, :EE], l, pars)
407407
Dl2 = Dl_symboltz([:TT, :TE, :EE], l, pars)
408-
plot_compare(l, l, Dl1[:, 1], Dl2[:, 1], "l", "Dₗ(TT)"; tol = 8e-13)
408+
plot_compare(l, l, Dl1[:, 1], Dl2[:, 1], "l", "Dₗ(TT)"; tol = 6e-13)
409409
```
410410
```@example class
411-
plot_compare(l, l, Dl1[:, 2], Dl2[:, 2], "l", "Dₗ(TE)"; tol = 7e-14)
411+
plot_compare(l, l, Dl1[:, 2], Dl2[:, 2], "l", "Dₗ(TE)"; tol = 2e-14)
412412
```
413413
```@example class
414-
plot_compare(l, l, Dl1[:, 3], Dl2[:, 3], "l", "Dₗ(EE)"; tol = 2e-14)
414+
plot_compare(l, l, Dl1[:, 3], Dl2[:, 3], "l", "Dₗ(EE)"; tol = 6e-15)
415415
```
416416
```@example class
417417
diffpars = [M.c.Ω₀, M.b.Ω₀, M.g.h]
@@ -427,12 +427,12 @@ println("Computed SymBoltz derivatives in $Δt2 seconds")
427427
∂Dl1_∂θ_3d = reshape(∂Dl1_∂θ, (length(l), length(modes), length(diffpars)))
428428
∂Dl2_∂θ_3d = reshape(∂Dl2_∂θ, (length(l), length(modes), length(diffpars)))
429429
430-
plot_compare(l, l, eachcol(∂Dl1_∂θ_3d[:,1,:]), eachcol(∂Dl2_∂θ_3d[:,1,:]), "l", ["∂(Dₗ)/∂($(replace(string(par), "₊" => "."))) (TT)" for par in diffpars]; tol = 1e-10)
430+
plot_compare(l, l, eachcol(∂Dl1_∂θ_3d[:,1,:]), eachcol(∂Dl2_∂θ_3d[:,1,:]), "l", ["∂(Dₗ)/∂($(replace(string(par), "₊" => "."))) (TT)" for par in diffpars]; tol = 3e-11)
431431
```
432432
```@example class
433-
plot_compare(l, l, eachcol(∂Dl1_∂θ_3d[:,2,:]), eachcol(∂Dl2_∂θ_3d[:,2,:]), "l", ["∂(Dₗ)/∂($(replace(string(par), "₊" => "."))) (TE)" for par in diffpars]; tol = 1e-11)
433+
plot_compare(l, l, eachcol(∂Dl1_∂θ_3d[:,2,:]), eachcol(∂Dl2_∂θ_3d[:,2,:]), "l", ["∂(Dₗ)/∂($(replace(string(par), "₊" => "."))) (TE)" for par in diffpars]; tol = 5e-12)
434434
```
435435
```@example class
436-
plot_compare(l, l, eachcol(∂Dl1_∂θ_3d[:,3,:]), eachcol(∂Dl2_∂θ_3d[:,3,:]), "l", ["∂(Dₗ)/∂($(replace(string(par), "₊" => "."))) (EE)" for par in diffpars]; tol = 1e-12)
436+
plot_compare(l, l, eachcol(∂Dl1_∂θ_3d[:,3,:]), eachcol(∂Dl2_∂θ_3d[:,3,:]), "l", ["∂(Dₗ)/∂($(replace(string(par), "₊" => "."))) (EE)" for par in diffpars]; tol = 9e-13)
437437
```
438438

0 commit comments

Comments
 (0)