Spectra#
discocmb.spectra integrates the transfer functions over wave
modes against a primordial spectrum.
The transfer functions of discocmb.transfer and the primordial
curvature spectrum give:
C_l^{XY} = 4 pi int dln k P_R(k) X_l(k) Y_l(k),P_R = A_s (k/k_p)^{n_s - 1}
where X and Y stand for the temperature Theta_l or the E-mode
E_l, and the lensing potential’s C_l^{psi psi} by the same
integral, exact at low l and Limber above
(lensing_potential_spectrum()). cmb_power_spectrum() takes any
primordial spectrum (power_law() by default) and returns
Spectra at every multipole.
solve_cmb() runs the steps for a batch in one call: the solve, the
transfer functions and cmb_power_spectrum(). It is differentiable in
the cosmologies’ parameters.
- discocmb.solve_cmb(cosmologies, *, grid: Grid | None = None, **solve_kwargs)[source]#
Return
(ells, C_l, D_l)of a batch: the multipoles and twoSpectra.cosmologiesis one DISCO-EB cosmology or a list of one model’s,[discoeb.LCDM(omega_b=..., ...), ...].ellsis0..grid.lmaxand each spectrum(n_cosmologies, lmax + 1): TT, TE, EE and the lensing potential, unlensed.lensed_spectra()lensesC_l.The steps, each of which can run on its own:
discoeb.solve_eb()solves every wave mode of every cosmology in one launch and keeps the sources, whichLineOfSightSourcesevaluates in the kernel, witherror_weights().transfer_functions()projects the sources onto the multipoles.cmb_power_spectrum()integrates the transfer functions over the wave modes against the cosmologies’ primordial spectra.
grid(fromfrom_fiducial()) fix the wave modes, save times, multipoles and operators. Build them once and pass them to every batch. Without them the first cosmology shapes the grid, and the last of these stays cached.solve_kwargsgo to the solver (rtol,atol,max_steps, …), anderror_weightsthere go overerror_weights().Derivatives. The spectra are differentiable in every parameter of the cosmologies, in forward and reverse mode (
jax.jacfwd,jax.grad): a cosmology is a pytree, andjax.jacfwdof a function of one returns the derivatives as a cosmology. The kernel carries forward sensitivities through the hierarchy and the recombination history, and the kept conformal times carry the distance to every source.cosmology.replacealso sets a column DISCO-EB derives from the parameters, such asomega_g(discoeb.derived_parameters()), for a derivative in it. Derivatives need a grid in double precision (dtype=jnp.float64), and for many directionssplit_derivatives=Truekeeps a thread’s memory that of one column.
- discocmb.cmb_power_spectrum(transfers, cosmologies, *, primordial=None)[source]#
Return
(C_l, D_l), each aSpectraat every multipole tolmax.The integral over the wave modes,
C_l^{XY} = 4 pi int dln k P_R(k) X_l(k) Y_l(k),of the
Transferstransfers, whereXandYstand forTheta_lorE_l. The lensing potential’sC_l^{psi psi}is the same integral, exact at lowland Limber above (lensing_potential_spectrum()). The projection computes the multipolesgrid.ells, and a cubic spline inln lgives every other one. Atgrid.ellsthe values are the projection’s own.cosmologiesare the batch’s, whoseT_cmbconvertsD_ltomuK^2.primordialmaps wave numbers(n, ...)toP_R, one row per cosmology (power_law()). By default it is the power law of the cosmologies’A_s,n_sandk_p. Traceable.
- namedtuple discocmb.Spectra(tt: jax.Array, te: jax.Array, ee: jax.Array, pp: jax.Array)[source]#
Bases:
NamedTupleThe temperature, cross, E-mode and lensing potential spectra.
Each field is
(n_cosmologies, lmax + 1), indexed by the multipole froml = 0. AsC_lthe first three are in units ofT_cmb^2andpp,C_l^{psi psi}, is dimensionless. AsD_lthe first three arel(l+1) C_l / 2piinmuK^2andppis[l(l+1)]^2 C_l^{psi psi} / 2pi.