lims = [ [0.04, 0.44], [0.019, 0.027], ] out1 = bring_together_samples(dir_name1, chain1, burnins) out2 = bring_together_samples(dir_name2, chain2, burnins) #print out1.shape samples1 = MCSamples(samples=out1, names=names, labels=labels) samples2 = MCSamples(samples=out2, names=names, labels=labels) #print out1[-1:,:] print(samples2.getTable(limit=1).tableTex()) plt.figure() g = plots.getSubplotPlotter() g.triangle_plot([samples1, samples2], params=['massbias', 'yslope', 'scat', 's8', 'om'], filled=True) plt.savefig(outdir + "v10_and_v11_testv2.png") print(samples2.getTable(limit=1).tableTex()) if not args.s8test: print(samples1.getTable(limit=1).tableTex()) constraints = [(v[1], v[2] - v[1], v[1] - v[0]) for v in zip(*np.percentile(out1, [16, 50, 84], axis=0))]
# print the autocorrelation time tau = sampler.get_autocorr_time() print(tau) # remove the first 100 steps and use only every 15 steps from the chain flat_samples = sampler.get_chain(discard=100, thin=15, flat=True) print(flat_samples.shape) # transform the data into a getdist readable format samples = MCSamples(samples=flat_samples, names=["1", "2", "3"], labels=["m", "b", "log(f)"]) # print the 95% limits for all parameters in LaTex with getdist print("Print 95% limits using getdist") print(samples.getTable().tableTex()) # print the 95% limits for all parameters in LaTex with numpy print("Print 95% limits using numpy") for i in range(ndim): mcmc = np.percentile(flat_samples[:, i], [2.5, 50, 97.5]) q = np.diff(mcmc) txt = "\mathrm{{{3}}} = {0:.3f}_{{-{1:.3f}}}^{{{2:.3f}}}" txt = txt.format(mcmc[1], q[0], q[1], labels[i]) print(txt) # plot and show results with getdist g = plots.get_subplot_plotter() g.triangle_plot(samples, filled=True, markers={