Skip to content

Commit cdcaf9f

Browse files
committed
Document lensing in CMB power spectra
1 parent f793edb commit cdcaf9f

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

docs/src/observables.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,17 @@ SymBoltz.spectrum_cmb
5555

5656
```@example
5757
# TODO: more generic, source functions, ... # hide
58-
using SymBoltz, Unitful, UnitfulAstro, Plots
58+
using SymBoltz, Plots
5959
M = SymBoltz.ΛCDM()
6060
pars = SymBoltz.parameters_Planck18(M)
6161
prob = CosmologyProblem(M, pars)
62-
ls = 10:5:1500
6362
63+
ls = 25:25:3000 # 25, 50, ..., 3000
6464
jl = SphericalBesselCache(ls)
65-
Dls = spectrum_cmb([:TT, :EE, :TE], prob, jl; normalization = :Dl, unit = u"μK")
66-
pTT = plot(ls, Dls[:, 1]; ylabel = "Dₗᵀᵀ")
67-
pEE = plot(ls, Dls[:, 2]; ylabel = "Dₗᴱᴱ")
68-
pTE = plot(ls, Dls[:, 3]; ylabel = "Dₗᵀᴱ", xlabel = "l")
69-
plot(pTT, pEE, pTE, layout = (3, 1), size = (600, 700), legend = nothing)
65+
modes = [:TT, :EE, :TE, :ψψ, :ψT, :ψE]
66+
Dls = spectrum_cmb(modes, prob, jl; normalization = :Dl)
67+
68+
Plots.plot(ls, log10.(abs.(Dls)); xlabel = "l", ylabel = "lg(Dₗ)", label = permutedims(String.(modes)))
7069
```
7170

7271
## Two-point correlation function

src/observables/angular.jl

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,30 @@ function spectrum_cmb(ΘlAs::AbstractMatrix, ΘlBs::AbstractMatrix, P0s::Abstrac
205205
end
206206

207207
"""
208-
spectrum_cmb(modes::AbstractVector, prob::CosmologyProblem, jl::SphericalBesselCache; normalization = :Cl, unit = nothing, kτ0s = 0.1*jl.l[begin]:2π/2:10*jl.l[end], xs = 0.0:0.0008:1.0, l_limber = 50, integrator = TrapezoidalRule(), bgopts = (alg = Rodas4P(), reltol = 1e-9, abstol = 1e-9), ptopts = (alg = KenCarp4(), reltol = 1e-8, abstol = 1e-8), sourceopts = (rtol = 1e-3, atol = 0.9), verbose = false, kwargs...)
208+
spectrum_cmb(modes::AbstractVector{<:Symbol}, prob::CosmologyProblem, jl::SphericalBesselCache; normalization = :Cl, unit = nothing, kτ0s = 0.1*jl.l[begin]:2π/2:10*jl.l[end], xs = 0.0:0.0008:1.0, l_limber = 50, integrator = TrapezoidalRule(), bgopts = (alg = Rodas4P(), reltol = 1e-9, abstol = 1e-9), ptopts = (alg = KenCarp4(), reltol = 1e-8, abstol = 1e-8), sourceopts = (rtol = 1e-3, atol = 0.9), verbose = false, kwargs...)
209209
210-
Compute the CMB power spectra `modes` (`:TT`, `:EE`, `:TE` or an array thereof) ``C_l^{AB}``'s at angular wavenumbers `ls` from the cosmological solution `sol`.
210+
Compute angular CMB power spectra ``Cₗᴬᴮ`` at angular wavenumbers `ls` from the cosmological problem `prob`.
211+
The requested `modes` are specified as a vector of symbols in the form `:AB`, where `A` and `B` are `T` (temperature), `E` (E-mode polarization) or `ψ` (lensing).
211212
If `unit` is `nothing` the spectra are of dimensionless temperature fluctuations relative to the present photon temperature; while if `unit` is a temperature unit the spectra are of dimensionful temperature fluctuations.
213+
Returns a matrix of ``Cₗ`` if `normalization` is `:Cl`, or ``Dₗ = l(l+1)/2π`` if `normalization` is `:Dl`.
212214
213215
The lensing line-of-sight integral uses the Limber approximation for `l ≥ l_limber`.
216+
217+
# Examples
218+
219+
```julia
220+
using SymBoltz, Unitful
221+
M = ΛCDM()
222+
pars = parameters_Planck18(M)
223+
prob = CosmologyProblem(M, pars)
224+
225+
ls = 10:10:1000
226+
jl = SphericalBesselCache(ls)
227+
modes = [:TT, :TE, :ψψ, :ψT]
228+
Dls = spectrum_cmb(modes, prob, jl; normalization = :Dl, unit = u"μK")
229+
```
214230
"""
215-
function spectrum_cmb(modes::AbstractVector, prob::CosmologyProblem, jl::SphericalBesselCache; normalization = :Cl, unit = nothing, kτ0s = 0.1*jl.l[begin]:2π/2:10*jl.l[end], xs = 0.0:0.0008:1.0, l_limber = 50, integrator = TrapezoidalRule(), bgopts = (alg = Rodas4P(), reltol = 1e-9, abstol = 1e-9), ptopts = (alg = KenCarp4(), reltol = 1e-8, abstol = 1e-8), sourceopts = (rtol = 1e-3, atol = 0.9), verbose = false, kwargs...)
231+
function spectrum_cmb(modes::AbstractVector{<:Symbol}, prob::CosmologyProblem, jl::SphericalBesselCache; normalization = :Cl, unit = nothing, kτ0s = 0.1*jl.l[begin]:2π/2:10*jl.l[end], xs = 0.0:0.0008:1.0, l_limber = 50, integrator = TrapezoidalRule(), bgopts = (alg = Rodas4P(), reltol = 1e-9, abstol = 1e-9), ptopts = (alg = KenCarp4(), reltol = 1e-8, abstol = 1e-8), sourceopts = (rtol = 1e-3, atol = 0.9), verbose = false, kwargs...)
216232
ls = jl.l
217233
sol = solve(prob; bgopts, verbose)
218234
τ0 = getsym(sol, prob.M.τ0)(sol)

0 commit comments

Comments
 (0)