Getting started with GetDist on Python (and the GUI)
Posted: May 17 2017
Hi all, I'm a new student in cosmology. I'll be using CosmoMC [on a cluster, later on] to sample the Planck likelihood (from PR2 in 2015), and in turn will be using the results to compute Bayesian evidence and necessary parameter estimates.
For now, I am just starting off on a 'tutorial' [on a MacBook Pro 2015, OS X El Capitan, 10.11.6], learning to get GetDist to make plots (e.g. contour plots seen in cosmology papers). I have encountered a couple of problems regarding the plotting. First of all, I should note that I obtained the chain files from http://irsa.ipac.caltech.edu/data/Planc ... lary-data/ (using the Full Grid).
I am trying to use this Python code (Python 2.7.13, from the Anaconda distribution, so Spyder IDE):
where I have edited from the 2nd picture here http://cosmologist.info/cosmomc/readme_gui.html [I do have issues with the GUI, but I will touch on that afterwards]
but I get a "chain not found" error from GetDistPlot
and I am quite sure I have given the right path to the chain files, unless I am mistaken somewhere in the principles. It would be great if someone could please guide me on this.
Regarding the GUI, I tried running GetDistGUI.py itself from the python folder of cosmomc (July 2015 version) but:
Qt (package) wasn’t working it seems; in particular, even though PySide was imported without problem, PySide.QtCore had an issue:
Tried this too: https://forum.qt.io/topic/8814/solved-p ... -qtcore-so
It turns out that I did not have Qt4/PyQt4 in my system, but conda can’t find this even though knows of such a package. I also could only download PySide 1.2.2 – PySide 1.2.4 is not usable. Additionally, PySide is not supported by Qt 5.x, but I also cannot get Qt 4.x (need Qt 4.6 or better).
They are long questions - please feel free to answer in separately if appropriate. Additionally, any input is valuable. Thanks in advance!
For now, I am just starting off on a 'tutorial' [on a MacBook Pro 2015, OS X El Capitan, 10.11.6], learning to get GetDist to make plots (e.g. contour plots seen in cosmology papers). I have encountered a couple of problems regarding the plotting. First of all, I should note that I obtained the chain files from http://irsa.ipac.caltech.edu/data/Planc ... lary-data/ (using the Full Grid).
I am trying to use this Python code (Python 2.7.13, from the Anaconda distribution, so Spyder IDE):
Code: Select all
g = plots.getSubplotPlotter(chain_dir='/Users/masonng/Documents/Honours Project/Chains/base_nnu_mnu/plikHM_TT_lowTEB/')
roots = ['plikHM_TT_lowTEB']
params = ['omegabh2', 'omegach2', 'theta']
param_3d = None
g.triangle_plot(roots, params, plot_3d_with_param=param_3d, filled_compare=True, shaded=True)
g.export()
but I get a "chain not found" error from GetDistPlot
Code: Select all
runfile('/Users/masonng/.spyder/temp.py', wdir='/Users/masonng/.spyder')
Traceback (most recent call last):
File "<ipython-input-42-fb250905188c>", line 1, in <module>
runfile('/Users/masonng/.spyder/temp.py', wdir='/Users/masonng/.spyder')
File "/Users/masonng/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 880, in runfile
execfile(filename, namespace)
File "/Users/masonng/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
builtins.execfile(filename, *where)
File "/Users/masonng/.spyder/temp.py", line 11, in <module>
g.triangle_plot(roots, params, plot_3d_with_param=param_3d, filled_compare=True, shaded=True)
File "/Users/masonng/anaconda2/lib/python2.7/site-packages/getdist/plots.py", line 1784, in triangle_plot
params = self.get_param_array(roots[0], params)
File "/Users/masonng/anaconda2/lib/python2.7/site-packages/getdist/plots.py", line 1380, in get_param_array
return self.paramNamesForRoot(root).parsWithNames(params, error=True, renames=renames)
File "/Users/masonng/anaconda2/lib/python2.7/site-packages/getdist/plots.py", line 763, in paramNamesForRoot
labelParams=self.settings.param_names_for_labels)
File "/Users/masonng/anaconda2/lib/python2.7/site-packages/getdist/plots.py", line 576, in paramsForRoot
samples = self.samplesForRoot(root)
File "/Users/masonng/anaconda2/lib/python2.7/site-packages/getdist/plots.py", line 462, in samplesForRoot
raise GetDistPlotError('chain not found: ' + root)
[b]GetDistPlotError: chain not found: plikHM_TT_lowTEB[/b]
Regarding the GUI, I tried running GetDistGUI.py itself from the python folder of cosmomc (July 2015 version) but:
Qt (package) wasn’t working it seems; in particular, even though PySide was imported without problem, PySide.QtCore had an issue:
Code: Select all
ImportError: dlopen(/Users/masonng/anaconda2/lib/python2.7/site-packages/PySide/QtCore.so, 2): Library not loaded: /usr/local/lib/QtCore.framework/Versions/4/QtCore
Referenced from: /Users/masonng/anaconda2/lib/python2.7/site-packages/PySide/QtCore.so
Reason: image not found
It turns out that I did not have Qt4/PyQt4 in my system, but conda can’t find this even though
Code: Select all
pip search qt
They are long questions - please feel free to answer in separately if appropriate. Additionally, any input is valuable. Thanks in advance!