difference between CAMB and cosmomc

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
moslem zarei
Posts: 28
Joined: March 11 2008
Affiliation: Isfahan University of Technology

difference between CAMB and cosmomc

Post by moslem zarei » April 04 2008

I have some questions:
1)what is the difference between camb and cosmomc?
2)For what problems camb work beter than cosmomc and vice versa?
3)After running camb and cosmomc, do these codes provide diagrams?

Joe Zuntz
Posts: 9
Joined: October 22 2004
Affiliation: UCL

difference between CAMB and cosmomc

Post by Joe Zuntz » April 04 2008

CAMB and CosmoMC do different things, though CosmoMC uses CAMB to do its thing.

CAMB takes cosmological parameters (e.g. density values like omega_baryon, the hubble parameter H_0, and a large number of other parameters) given to it in a parameter file, and generates a CMB power spectrum based on those parameters.

CosmoMC, by calling CAMB many times and comparing those spectra to measured data, determines limits on those parameters based on another parameter file. It generates a Monte Carlo Markov Chain, jumping around the space of those parameters, and determines which combinations fit the data well.

There are more details in the readme files that come with both codes - in particular you should have a look at the references to papers they contain for more details on exactly how they do these things.

Both codes generate data thay you can use to make graphs of their results. CAMB generates files called something like "test_scalCls.dat" (you can change the name in the parameter file), that contains the power spectra. You'll need a plotting program to make graphs of that data - the simplest is probably gnuplot - in which you can just type "plot 'test_scalCls.dat' " to get a simple plot.

A companion program to cosmomc, called getdist, is used for making plots of parameter constraints. You run it on yet another parameter file and it examines the chains generated by cosmomc, and produces scripts for matlab (ending in .m) and a plotting program called supermongo, ending in .sm. You need one of those programs to generate the plots. Exactly which parameters are plotted depends on the parameter file (which is called "distparams.ini" by default.

How to modify CAMB/CosmoMC (which you were asking about in another thread) depends on exactly want to modify. The basic process is to edit camb to use some new parameters (which you seem to have done in power_tilt), making sure to include the new parameters in the CambParams type in modules.f90. You can then edit cosmomc to tell it to vary the new parameters in params_CMB.f90 (and possibly elsewhere)
You'll also need to figure out approximate widths (or better still, covariances) of the constraints on the new parameters you have to put into the parameter file - this is usually an iterative process where you run cosmomc with poor estimates and use its outputs to improve them - this can be a fiddly and aggravating process - be patient.

There's lots of information about both camb and cosmomc (and also crosswords) at http://cosmologist.info/

(who remembers being a new PhD student)

marc vonlanthen
Posts: 11
Joined: May 29 2009
Affiliation: university of geneva

difference between CAMB and cosmomc

Post by marc vonlanthen » June 09 2009

Dear Joe,

Reading your post, it seems to me that you know well how to add a new parameter in Cosmomc. Maybe you could help me.

Basically, I would like to shift the Cl's from l to S*l, where S is the new parameter. Then, cosmomc will have to find the S that fit the datas. I already introduced the new parameter in camb and cosmomc, but I do not know where I have to make this change in camb for the power spectrum to be shifted.

Thank you


Post Reply