Skip to content

Instantly share code, notes, and snippets.

@surhudm
Last active April 24, 2017 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surhudm/e99f059b51a35bcd5acf4d8b41b17090 to your computer and use it in GitHub Desktop.
Save surhudm/e99f059b51a35bcd5acf4d8b41b17090 to your computer and use it in GitHub Desktop.
GetDist setup procedure

Installing blind version of getdist

Here is the procedure to install the blind version of getdist from my fork to your computer.

On your command line type:

pip install --user git+https://github.com/surhudm/getdist.git@53aa798b228

This should install getdist to your $HOME/.local/lib/python2.7/site-packages directory or some other directory on mac osx depending upon your configuration. If you are going to use getdist from python then this is all you need.

The above command also installs the GUI, but to get it working on linux (for Mac see below), the simplest thing is to install the package pyside.

On ubuntu:

pip install python-pyside

On fedora

dnf install python-pyside

Or if you have qt4 packages on linux installed already then just :

pip install --user pyside

should also work. On linux, the path to GetDistGui.py should already be added correctly. So just typing:

GetDistGui.py

should work. After that it is mostly clicking around to get different kinds of plots. The default value of blind is True, so you will always get blinded plots. The documentation about the format of the chain files is the same as the original getdist and can be found in the README at https://github.com/surhudm/getdist

For Mac OSX: You need a specific version of Qt and pyside. I have tested that with the latest OS, the instructions here work:

https://wiki.qt.io/PySide_Binaries_MacOSX

Install both the QT 4.8.5 package as well as pyside from the Mac installers on the above page. To find out the location of GetDistGUI.py just type:

mdfind GetDistGUI.py

The format for the chain is simple (say names chainfile.txt and listed by column number):

wt lnlikelihood p1 p2 .. pN

There should be a corresponding file with chainfile.paramnames and it should list a variable name followed by its latex rendering in each row for the N parameters. For example,

ombh2   \Omega_b h^2
omch2   \Omega_c h^2
theta   \theta
tau     \tau
omk     \Omega_k
nufrac  f_\nu
w       w
ns      n_s
nt      n_t
nrun    n_{run}
As      log[10^{10} A_s]
r       amp_{ratio}
ASZ     A_{SZ}
Omegal  \Omega_\Lambda
Age     Age/GYr
Omegam  \Omega_m
sigma8  \sigma_8
zre     z_{re}
r10     r_{10}
H0      H_0

Simple plots with getdist (does not require Gui)

To make simple parameter histograms with getdist, here is a sample code:

import getdist.plots as gplot
import os

g=gplot.getSubplotPlotter(chain_dir=r'./chains/flat_HSC_S16B')
roots = ['flat_HSC_S16B']
params=[u'Omegam', u'sigma8']
g.plots_1d(roots, params=params)
g.export("testHistogram.pdf")

This is for making triangle plots:

import getdist.plots as gplot
import os

g=gplot.getSubplotPlotter(chain_dir=r'./chains/flat_HSC_S16B')
roots = ['flat_HSC_S16B']
params = [u'Age', u'Omegam', u'sigma8']
param_3d = None
g.triangle_plot(roots, params, plot_3d_with_param=param_3d, filled=True, shaded=False)
g.export("testTriangle.pdf")

To unblind, pass the parameter blind=False to gplot.getSubPlotter. More examples of using getdist can be found here:

https://getdist.readthedocs.io/en/latest/plot_gallery.html

Any problems or issues, please send me an email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment