Likelihood Code#
The likelihood is a function that takes a set of CMB spectra and parameter values returns a log-likelihood value. For the default functional form the likelihood is a multivariate Gaussian:
where \(\hat{D}\) is the data vector, \(\mathcal{T}\) is the data model, \(D^{\mathrm{CMB}}(\theta)\) is the model CMB power spectrum, \(\mathcal{C}\) is the covariance matrix, and \(\theta\) are the parameters. The data model is comprised of a series of successively applied transformations:
These transformations adjust the power spectrum supplied by the theory code to account for foregrounds, calibration, super-sample lensing or any other effect. The transformations are applied in the order specified in the data set info file. Programmatically, the data band powers model spectrum are long vectors of concatenated spectra according to the order defined in the data set info file.
Note
The likelihood operates in \(D_\ell\) space, i.e. on \(C_\ell \ell (\ell + 1) / (2 \pi)\), in units of \(\mu K_{\mathrm{CMB}}^2\). Theory spectra start at \(\ell=2\).
Primary CMB Likelihood#
The likelihood for primary CMB data proceeds in the following steps:
Get model spectra:
Construct a long vector of CMB-only spectra (matching the order of the data vector).
Loop over the transformations in the data model and apply them one by one to the model vector.
Bin the model spectra using the window functions.
Take the difference between data and model band powers and calculate the log likelihood value.
Calculate and add the prior contribution.
Lensing CMB Likelihood#
For the lensing likelihood, the model spectra are binned prior to applying the transformations. Due to the nature of transformations that are typically applied to lensing spectra (e.g., matrix multiplications for response function corrections), is more efficient. The order is:
Construct a long vector of CMB-only spectra (matching the order of the data vector).
Bin the CMB-only spectra using the window functions.
Loop over the transformations in the data model and apply them one by one to the model vector.
Take the difference between data and model band powers and calculate the log likelihood value.
Calculate and add the prior contribution.