@@ -181,18 +181,22 @@ function spectrum_cmb(modes::AbstractVector, prob::CosmologyProblem, ls::Abstrac
181
181
# Integrate perturbations to calculate source function on coarse k-grid
182
182
iT = ' T' in join (modes) ? 1 : 0
183
183
iE = ' E' in join (modes) ? iT + 1 : 0
184
+ iΦ = ' Φ' in join (modes) ? iE + 1 : 0
184
185
Ss = Num[]
185
186
iT > 0 && push! (Ss, prob. M. ST0)
186
187
iE > 0 && push! (Ss, prob. M. ST2_polarization)
188
+ iΦ > 0 && push! (Ss, prob. M. SΦ)
187
189
Ss_coarse = source_grid (prob, Ss, τs, ks_coarse; bgopts, ptopts, thread, verbose) # TODO : pass kτ0 and x # TODO : pass bgsol
188
190
189
191
# Interpolate source function to finer k-grid
190
192
ks_fine = collect (kτ0s_fine ./ τ0)
191
193
ks_fine = clamp .(ks_fine, ks_coarse[begin ], ks_coarse[end ]) # TODO : ideally avoid
192
194
Ss_fine = source_grid (Ss_coarse, ks_coarse, ks_fine)
195
+ Ss_fine[:,end ,:] .= 0
193
196
194
197
ΘlTs = iT > 0 ? los_integrate (@view (Ss_fine[iT, :, :]), ls, τs, ks_fine, jl; integrator, verbose, kwargs... ) : nothing
195
198
ΘlEs = iE > 0 ? los_integrate (@view (Ss_fine[iE, :, :]), ls, τs, ks_fine, jl_x2; integrator, verbose, kwargs... ) .* transpose (@. √ ((ls+ 2 )* (ls+ 1 )* (ls+ 0 )* (ls- 1 ))) : nothing
199
+ ΘlΦs = iΦ > 0 ? los_integrate (@view (Ss_fine[iΦ, :, :]), ls, τs, ks_fine, jl; integrator, verbose, kwargs... ) : nothing
196
200
197
201
P0s = spectrum_primordial (ks_fine, sol) # more accurate
198
202
@@ -212,6 +216,8 @@ function spectrum_cmb(modes::AbstractVector, prob::CosmologyProblem, ls::Abstrac
212
216
spectrum = spectrum_cmb (ΘlEs, ΘlEs, P0s, ls, ks_fine; integrator, normalization)
213
217
elseif mode == :TE
214
218
spectrum = spectrum_cmb (ΘlTs, ΘlEs, P0s, ls, ks_fine; integrator, normalization)
219
+ elseif mode == :ΦΦ
220
+ spectrum = spectrum_cmb (ΘlΦs, ΘlΦs, P0s, ls, ks_fine; integrator, normalization)
215
221
else
216
222
error (" Unknown CMB power spectrum mode $mode " )
217
223
end
0 commit comments