How to create a new model

Unfortunately, to use a model that is not included in SimpleMC we cannot use the ini file, however it is still very easy. There are two options:

Simple model independent of any cosmology

You can propose any function that you want. Define your parameters with Parameter class and use the DriverMC class to an easy-use manager.

from simplemc.cosmo.Parameter import Parameter
from simplemc.DriverMC import DriverMC

The Parameter class have the structure:

Parameter(name string, value intermediate, step size, (bound_inf, bound_sup), LaTeX name)

The name of the variables must to be the same at the name of the Parameter. Then gather your parameter objects in a list:

m = Parameter("m", 0, 0.05, (0, 0.1), "m_0")
b = Parameter("b", 3, 0.05, (0, 5), "b_0")

# create a list with your parameters objects
parameterlist = [m, b]

Define a method that reads a list of parameters,

def my_model(parameterlist, x):
    m, b = parameterlist
    return m*x+b

Use SimpleMC as usually, but with model = simple

analyzer = DriverMC(model='simple', datasets='dline', analyzername='mcmc',
                    custom_parameters=parameterlist, custom_function=my_model)

analyzer.executer(nsamp=1000)

Simple cosmological model based on LCDM

Now we use model = simple_cosmo and we can use the LCDM parameters in the expresion of the model such as Omrad, Om, Ombh2, h, Ocb, mnu and NuContrib (see paramDefs.py for the default values) and add extra parameters. This expression must be in terms of a (scale factor) and definied in a string. For example:

from simplemc.cosmo.Parameter import Parameter
from simplemc.DriverMC import DriverMC

Oextra = Parameter('Oextra', 0.1, 0.001, (0, 0.2), '\Omega_{extra}')

cosmo_model = 'Om/a**3+Omrad/a**4+(1.0-Om-Oextra)'

analyzer = DriverMC(model='simple_cosmo', datasets='SN', analyzername='mcmc',
                    custom_parameters=parameterlist, custom_function=cosmo_model)

It is important to note that the name of the Parameter instances must be the same as the string names of the Parameter class (first argument of the Parameter class).