## adding a derived parameter

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

### adding a derived parameter

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 = &#91;'../chains1/test', '../chains2/test'&#93;
for r in roots&#58;
p = samples.getParams&#40;&#41;
omegab = p.omegabh2/ p.H0**2 * 100**2
samples.updateBaseStatistics&#40;&#41;

labels=&#91;'chain1', 'chain2'&#93;
params = &#91;'H0','ns','omegam','omegab','tau','logA'&#93;

g = plots.getSubplotPlotter&#40;width_inch=5&#41;
g.settings.axes_fontsize = 9
g.settings.legend_fontsize = 10
g.plots_1d&#40;roots,params, nx = 3, legend_labels=labels&#41;
g.export&#40;&#41;
Thanks

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

### Re: adding a derived parameter

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

g.plots_1d&#40;&#91;samples1,samples2&#93;....&#41;