adding a derived parameter

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Ali Narimani
Posts: 3
Joined: July 18 2015
Affiliation: University of British Columbia

adding a derived parameter

Post by Ali Narimani » September 13 2015

I am trying to add "omegab" as a parameter to the chains and then use it in my plots, but it doesn't work. I have attached my script, which I think follows the guidelines very closely. Here is the code:

Code: Select all

roots = ['../chains1/test', '../chains2/test']
for r in roots:
	samples = getdist.loadMCSamples(r) 
	p = samples.getParams()
	omegab = p.omegabh2/ p.H0**2 * 100**2
	samples.addDerived(omegab, name='omegab', label=r'\Omega_b')

labels=['chain1', 'chain2']
params = ['H0','ns','omegam','omegab','tau','logA']

g = plots.getSubplotPlotter(width_inch=5)
g.settings.axes_fontsize = 9
g.settings.legend_fontsize = 10
g.plots_1d(roots,params, nx = 3, legend_labels=labels)

Antony Lewis
Posts: 1547
Joined: September 23 2004
Affiliation: University of Sussex

Re: adding a derived parameter

Post by Antony Lewis » September 14 2015

The first bit of code is only adding the parameter to the "samples" instance in memory. You aren't using this for plotting, but instead loading again from the files on disk (which don't have the new parameter).

Make samples1, samples2 with the new parameter added, and then

Code: Select all


Post Reply