# Theory codes¶

Synopsis: Prototype theory class and theory loader Jesus Torrado

If you are using a experimental likelihood, chances are the you will need a theoretical code to compute the observables needed to compute the likelihood.

This module contains the prototype of the theory code and the loader for the requested code.

Note

At this moment, of all modules of cobaya, this is the one with the least fixed structure. Don’t pay much attention to it for now. Just go on to the documentation of CAMB and CLASS.

## Theory class¶

class theory.Theory(info_theory, modules=None, timing=None)

Prototype of the theory class.

initialize()

Initializes the theory code: imports the theory code, if it is an external one, and makes any necessary preparations.

needs(arguments)

Function to be called by the likelihoods at their initialization, to specify their requests. Its specific behaviour for a code must be defined.

compute(**parameter_values_and_derived_dict)

Takes a dictionary of parameter values and computes the products needed by the likelihood. If passed a keyword derived with an empty dictionary, it populates it with the value of the derived parameters for the present set of sampled and fixed parameter values.

close()

Finalizes the theory code, if something needs to be done (releasing memory, etc.)

d()

Dimension of the input vector.

NB: Different from dimensionality of the sampling problem, e.g. this may include fixed input parameters.