CosmoMC : add a new likelihood function

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Stéphane Ilic
Posts: 17
Joined: February 11 2014
Affiliation: IRAP Toulouse

CosmoMC : add a new likelihood function

Post by Stéphane Ilic » February 11 2014

Dear all,

I apologise in advance for the "potentially naive" questions that I may ask. As the title of my post says, I would like to add a new likelihood function to CosmoMC, similarly to the existing ones such as the one for BAO data or HST.

I understand that I need to add a function in DataLikelihoods.f90, in the form of "XXXXXLikelihood_Add(DataLikelihoods, Ini)", and that I need then to create an additional module XXXXX that define this new function. When I look at the existing modules (such as HST or BAO), I have to admit I do not completely understand how this function works.... Some pointer named "like" seems to be involved every time, as well as an "Add" function from a "LikeList" class ?

Another problem is that for my new likelihood function, I will need to access the tabulated values of the transfer function as it is computed and outputted if I were to use CAMB in its stand-alone version.

To combine my to question into one, let's just say for the sake of example that I want to add a new likelihood that is just the sum of these computed values of the transfer function, over its whole range of k. What would be the minimal way to do so ?

Thanks a lot in advance !

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: CosmoMC : add a new likelihood function

Post by Antony Lewis » February 12 2014

Yes, to make a new likelihood you need to define a new subclass of CosmologyLikelihood, then add an instance of it (made allocating the pointer, called "like" in the samples, of your new class) to the global likelihood list. You can just follow the structure of the provided routines. The likelihood needs to override one of the likelihood LogLike functions (see definitions in likelihood.F90).

Accessing transfer function information is harder however. See the cliklike.f90 likelihood for an example of how to use the TheoryPredictions data. However that is by default just CMB and matter power spectra. If you really need underlying transfer functions rather than the power spectra you'd need to make modifications, e.g. by extending the TheoryPredictions or otherwise pulling the information from CAMB. The wiggles likelihood gives an example of how to use matter power data.

Stéphane Ilic
Posts: 17
Joined: February 11 2014
Affiliation: IRAP Toulouse

CosmoMC : add a new likelihood function

Post by Stéphane Ilic » February 12 2014

Thank you for your answers Antony, I will try to follow your suggestions !

As far as retrieving the transfer function is concerned, I can actually settle for the matter power spectrum, so I should be able to use the other modules as examples.

Thanks again !

Post Reply