Tutorials and Use

Contents

Tutorials and Use#

Below, you can find an example of how to quickly get started with candl. Be sure to check out the tutorials for helpful examples and look at the usage tips for some important information on how to use candl.

Quickstart#

To initialise the likelihood, point it to the data set yaml file. Short cuts exist for data sets released through the candl_data repository. Simply clone the repo to get the data and run pip install . to install the shortcuts. More details can be found in the candl_data readme.

Let’s say we want to work with the SPT-3G 2018 TT/TE/EE data set.

import candl
import candl_data

candl_like = candl.Like(candl_data.SPT3G_2018_TTTEEE)

and that’s it! You can now access aspects of the data, for example the band powers candl_like.data_bandpowers and the covariance matrix candl_like.covariance.

Tip

Want to use only a part of the data? You can pass e.g. data_selection = "TT only" when initialising the likelihood. See Data Selection for more information.

If you have a dictionary of parameter values and CMB spectra you can then go ahead and calculate the \(\chi^2\):

params = {"Dl": {"TT": .., "EE": .., "TE": ..}, ...}# followed by nuisance parameters
chi2 = candl_like.chi_square(params)

Note

The likelihood operates in \(D_\ell\) space, i.e. on \(\ell (\ell + 1) C_\ell / (2 \pi)\), in units of \(\mu K_{\mathrm{CMB}}^2\). Theory spectra start at \(\ell=2\).