Sources#
discocmb.sources implements the line-of-sight sources that are passed to DISCO-EB for computation on-the-fly alongside the E-B integration.
Line-of-sight integration (Seljak & Zaldarriaga 1996, discocmb.transfer)
builds today’s anisotropy from a few local sources. They combine the
perturbation state with the visibility g = kappa' exp(-kappa):
S: the monopole (Sachs-Wolfe) and polarization correction timesg, plus the integrated Sachs-Wolfe term2 Phi' exp(-kappa).
S_j1: the Doppler termg (k alpha + theta_b / k).
S_j2: the quadrupole and polarization term.
They multiply j_l(x), j_l'(x) and j_l''(x) with x = k (tau_0 -
tau). The E-mode transfer function reuses S_j2 against j_l(x) / x^2
(CAMB’s sources(2)).
The solve. LineOfSightSources is a DISCO-EB component, which
discoeb.solve_eb() compiles into its kernel when passed as extra.
With keep=[LineOfSightSources.keep] the kernel returns seven numbers per
save and trajectory instead of the full state, so a batch fits in one
launch:
values = discoeb.solve_eb(
cosmologies, grid.k_values, grid.a_save,
extra=[LineOfSightSources],
keep=[LineOfSightSources.keep],
error_weights=error_weights(type(cosmologies[0])),
)
error_weights() resolves the small polarization sources at low k.
Without it the low multipoles of EE and TE come out 10 to 40 percent low.
The weighting. weighted_channels() multiplies the kept sources by
the visibility, and cmb_sources() adds the ISW term as a centered
difference of the saved potential. visibility() splines a tabulated
opacity for the grid’s summary of the fiducial. A trapezoid on the save grid
overshot kappa' by 0.2 percent through recombination and lowered
C_l by 0.5 percent.
- class discocmb.LineOfSightSources(**overrides)[source]#
Bases:
ComponentCAMB-form temperature and polarization sources as a model component.
It provides the Weyl potential
k^2 phi = -4 pi G a^2 (delta_rho + 3 aH (rho + p) theta / k^2 + 3/2 (rho + p) sigma)and the unweighted parts of the three sources, without the ISW term:monopole + 5/8 Pi,k alpha + theta_b / kand15/8 Pi, withPithe scattering source. Every species the model includes contributes through the sumsdelta_rho,momentumandstress.Pass it to
discoeb.solve_eb()asextra=[LineOfSightSources]withkeep=[LineOfSightSources.keep]. DISCO-EB compiles it into the kernel, which evaluates the sources at every save.
- LineOfSightSources.keep = ('m0', 'm1', 'm2', 'phi', 'opacity', 'kappa', 'tau')#
What
discoeb.solve_eb()keeps at every save, in the channel order the transfer functions read.The three unweighted sources and the Weyl potential, which this component provides, and the opacity
kappa', the optical depthkappaand the conformal timetau, which the model’s recombination history has: the solve integrates in the scale factor, andtauis a state whose value today is the conformal age. The list leaves outphi'on purpose. Late-timephi'is a small residual of large terms that cancel, so the analytic derivative amplifies the solver’s state error tenfold atl = 2. Differencing saved potentials cancels that error, whichcmb_sources()does.
- discocmb.error_weights(model, overrides: dict | None = None) dict[source]#
Return
{state name: weight}fordiscoeb.solve_eb()’serror_weights.Polarization. The E-mode source is
g PiwithPi = sigma_g / 5 + 3/5 E_2. Well below the acoustic scale both moments stay near the solve’satol = 1e-4through recombination, so step-size control ignores them and the low multipoles of EE and TE come out 10 to 40 percent low. The weightclip(POLARIZATION_WEIGHT_K / k, 1, POLARIZATION_WEIGHT_MAX)divides the tolerance of the photon quadrupoleF_2andE_2(E_0). It slows only the low-ktrajectories, which take the fewest steps: a batch of 128 costs 10 percent more, and EE matches CLASS to 0.35 percent froml = 2. A scalar tolerance of 1e-5 reaches the same accuracy at 1.8 times the cost.Massive neutrinos. The bins
psiget weight zero, which takes them out of step-size control. They stream freely to today, and resolving them cost a massive-neutrino batch most of its steps. With the photon quadrupole andE_2weighted, the spectra stay as close to CLASS without them.Lensing modes. Above
K_MAX_CMBevery photon and neutrino state takesLENSING_RADIATION_WEIGHT.overrides,{state name: weight}, go over the first two and the lensing modes’ weight over all. A weight is a number or a function of the wave numbers, as DISCO-EB takes it.