Compatibility with `getdist` - s-ilic/ECLAIR GitHub Wiki

Using the following option:

  -og, --output-getdist
                        Outputs a getdist-formatted version of the chains with
                        same root file names.

creates three files (ROOT_gdist.txt, ROOT_gdist.ranges and ROOT_gdist.paramnames) with the same ROOT as the original chain fed to the script. Those files are in a format that is compatible with the popular getdist Python package, allowing to perform standard posterior analysis (such as computing credibility intervals or generating contour plots). Note that all the analysis settings passed by the user to the ECLAIR plotting script -- such as the burn-in and thinning --- are applied to the chain before the getdist-compatible files are created. Note that the getdist python package needs to be installed beforehand, which can be done with a simple pip command:

pip install getdist

Example

Here is a minimal example for producing a triangle plot of all parameters of a chain. First run in your terminal:

python ECLAIR_plots.py /path/to/chain/ROOT.txt -og

which will creates the three files ROOT_gdist.txt, ROOT_gdist.ranges, ROOT_gdist.paramnames. Then, create and run the following short Python script:

from getdist.mcsamples import loadMCSamples
from getdist.plots import getPlotter

MC = loadMCSamples('/path/to/chain/ROOT_gdist') # NOTE: if you use a relative path, it has to start with "./"

g = getPlotter()
g.triangle_plot(MC)
g.export('triangle_plot.pdf')