CosmoMC and Plotting with Planck Likelihood and Chains

The Planck likelihood code (PLC/clik) and parameter chains are available from the Planck Legacy Archive. The Planck lensing and Bicep-Keck-Planck likelihoods are included with the cosmomc installation and do not need to be installed separately.

Using the Planck likelihood with CosmoMC

Note you need to use ifort 14 or higher to build CosmoMC, or gfortran (gcc) 6 latest (easily available for testing in virtual environments) so make sure you have that configured before you start. A set of .ini files are supplied in ./batch2 which set up standards for Planck runs. You can try
mpirun -np 1 ./cosmomc test_planck.ini
to see if things are being loaded and calculate a test likelihood OK.

Using Planck Chains

Planck provide a set of parameter chains produced by CosmoMC, available for download here or the US site (which is easier to use).

You can use CosmoMC's python scripts and getdist to analyse and make plots from them. Check you have set the PYTHONPATH as described at the top of the Python readme.

Then download and extract all the chain data. Make a symbolic link from ./cosmomc/PLA to the location of the chains, e.g.

ln -s PLA..PATH ./PLA
so that ./PLA/base is for example the head directory with the baseline model chains. For the program to know about the structure of the grid you first need to initialize it for the location you have installed in. Do
python python/ PLA
(this step is also done automatically if you open the grid directory in the GetDist GUI). You can now use python, grid and plotting scripts on the PLA directory, and they will know about the available data. Grid configuration settings for the Planck parameter grid are in PLA/config/.

If you download multiple Planck 2015 chain bundles, extract them to the same location so new folders are just merged over the existing ones and run again, then plotting scripts etc will find all the results. If you want to use the +BKP tensor chains, download and add them last, so the config folder matches that in the BKP download.

You can also configure the plotting scripts to use the PLA location as the default_grid_root (esp. if you want to run or adapt sample plot scripts under batch2/outputs/). Make a text file called python/getdist/config.ini (or set the environment variable GETDIST_CONFIG to point to a config.ini file somewhere else) and add setting lines to the config.ini file as required,e.g.

default_grid_root =  PLA..PATH
cache_dir = PLA..PATH/cache
The cache_dir is used to cache python-format chains, which makes loading them much faster after the first time. By default, plots go into ./outputs directory under cosmomc. You can se the output_base_dir to another location is where plot output (e.g. pdf) files are put by default (in output_base_dir/outputs).


You can use the GetDist GUI to load the PLA folder location and then open and plot chains as you wish. Or you can write your own python scripts to plot things of interest; many examples are in batch2/outputs/. Make sure you have set up your python/getdist/config.ini as described above with default file location.

For example, to run the sample scripts, you can do

python batch2/outputs/
to reproduce the figure above. (assuming you downloaded and installed the full PLA chain grid; default output location is ./outputs).

For instructions on writing plotting scripts, or how to calculate new derived parameters, see the plotting and analysis scripts readme.