Theory Codes#

Theory codes perform the calculation of the CMB spectrum given cosmological parameter values. For the purpose of interfacing with them, we reduce them to a single function call, taking as an input a dictionary of parameter names and values and producing as an output a dictionary of CMB spectra. We supply tools for a series of theory codes to be used in this way.

Tip

For a differentiable pipeline from parameters to the log likelihood value, use CosmoPower-JAX.

CAMB#

Github:

CAMB

Description:

Classic Boltzmann solver

Paper:

camb

candl.interface.get_CAMB_pars_to_theory_specs_func(CAMB_pars)#

Helper that returns a simple python function that moves from parameters to spectra using CAMB.

Parameters:
CAMB_parscamb.model.CAMBparams

CAMBparams for the model. Defines accuracy, ell range, etc.

Returns:
func

Function that takes a dictionary of parameter values, ell_max, and ell_min (optional) as input and returns a dictionary of CMB spectra (Dl).

CLASS#

Github:

CLASS

Description:

Classic Boltzmann solver

Paper:

class

candl.interface.get_CLASS_pars_to_theory_specs_func(CLASS_cosmo)#

Helper that returns a simple python function that moves from parameters to spectra using CLASS.

Parameters:
CLASS_cosmoclassy.Class

Class for the model to be evaluated. Need to set desired output options, accuracy settings, ell range, etc.

Returns:
func

Function that takes a dictionary of parameter values, ell_max, and ell_min (optional) as input and returns a dictionary of CMB spectra (Dl).

CosmoPower#

Github:

CosmoPower

Description:

Neural-network based emulator, TensorFlow implementation

Paper:

cosmopower

Note

You can find trained CosmoPower models at:

  • Original \(\Lambda\mathrm{CDM}\) models released with the CosmoPower paper (here)

  • \(\Lambda\mathrm{CDM}\), \(N_\mathrm{eff}\), \(A_L\) models trained on high-accuracy CAMB spectra used in the SPT-3G 2018 TT/TE/EE analysis (here)

  • \(\Lambda\mathrm{CDM}\), \(N_\mathrm{eff}\), \(\Sigma m_\nu\), \(\mathrm{wCDM}\) models trained on high-accuracy CLASS spectra from Bolliet et al. 2023 (here)

candl.interface.get_CosmoPower_pars_to_theory_specs_func(emulator_filenames)#

Helper that returns a simple python function that moves from parameters to spectra using CosmoPower. See A. Spurio Mancini et al. 2021 for more (https://arxiv.org/abs/2106.03846).

Parameters:
emulator_filenamesdict

Dictionary of spectrum types and emulator file names.

Returns:
func

Function that takes a dictionary of parameter values, ell_max, and ell_min (optional) as input and returns a dictionary of CMB spectra (Dl).

CosmoPower-JAX#

Github:

CosmoPower-JAX

Description:

Neural-network based emulator, JAX implementation

Paper:

cosmopower_jax

Tip

Vanilla CosmoPower models can be loaded into CosmoPower-JAX.

candl.interface.get_CosmoPowerJAX_pars_to_theory_specs_func(emulator_filenames)#

Helper that returns a simple python function that moves from parameters to spectra using CosmoPower. See D. Piras, A. Spurio Mancini 2023 and A. Spurio Mancini et al. 2021 for more (https://arxiv.org/abs/2305.06347, https://arxiv.org/abs/2106.03846). Assumes that all emulators have the same input parameters in the same order.

Parameters:
emulator_filenamesdict

Dictionary of spectrum types and emulator file names (if they are placed in cosmopower-jax’s trained_models/ folder), or the full path of the files, including in either case the file ending ‘.pkl’ or ‘.npz’.

Returns:
func

Function that takes a dictionary of parameter values, ell_max, and ell_min (optional) as input and returns a dictionary of CMB spectra (Dl).

Capse.jl#

Github:

Capse.jl

Description:

Neural-network based emulator, Julia implementation with pycapse wrapper.

Paper:

capse

candl.interface.get_PyCapse_pars_to_theory_specs_func(capse_base_path, specs=['TT', 'TE', 'EE'])#

Helper that returns a simple python function that moves from parameters to spectra using PyCapse. See Bonici, Bianchini, Ruiz-Zapatero 2023 for more (https://arxiv.org/abs/2307.14339).

Parameters:
capse_base_pathstr

Path where the PyCapse is located.

specslist (optional)

Which spectra (TT, TE, EE, BB) to try to load.

Returns:
func

Function that takes a dictionary of parameter values, ell_max, and ell_min (optional) as input and returns a dictionary of CMB spectra (Dl).

Cobaya Theory Classes#

Any cobaya.theory.Theory class (see the Cobaya documentation for details) can be used.

candl.interface.get_CobayaTheory_pars_to_theory_specs_func(theory_calc)#

Helper that returns a simple python function that moves from parameters to spectra using a cobaya.theory.Theory instances.

Parameters:
theory_calccobaya.theory.Theory

Theory code to calculate theory Dls.

Returns:
func

Function that takes a dictionary of parameter values, ell_max, and ell_min (optional) as input and returns a dictionary of CMB spectra (Dl).