Commit 0e9600ab authored by Matthieu Tristram's avatar Matthieu Tristram
Browse files

Correct ctr_level

parent a76cedeb
......@@ -481,7 +481,7 @@ def posterior2d( chain, par1, par2, *args, **kwargs):
fill = kwargs.get("fill", True)
datapoints = kwargs.get("datapoints", False)
contours = kwargs.get("contours", False)
levels = kwargs.get("levels", [0.65,0.95])
levels = kwargs.get("levels", [0.68,0.95])
cmap = kwargs.get("cmap", None)
# cmap = cm.get_cmap(kwargs.get("cmap", None))
......@@ -507,8 +507,7 @@ def posterior2d( chain, par1, par2, *args, **kwargs):
x2,y2 = np.mgrid[extent[0][0]:extent[0][1]:dx, extent[1][0]:extent[1][1]:dy]
z = np.array(gkde.evaluate([x2.flatten(),y2.flatten()])).reshape(x2.shape)
W = ctr_level( z, levels)
W = np.append(W[::-1],z.max())
W = np.append(ctr_level( z, levels),z.max())
if fill:
plt.contourf(x2, y2, z, W, alpha=alpha, cmap=cm.get_cmap(cmap), antialiased=True, colors=colors)
......@@ -645,7 +644,7 @@ def triangle( chains, params, nbin=50, parnames=None, names=[], colors=[], lines
Y,X = np.meshgrid((binX[1:]+binX[:-1])/2.,(binY[1:]+binY[:-1])/2.)
hmap = nd.gaussian_filter( hmap.T, 2)
if fill[c]:
plt.contourf( X,Y, hmap, levels=np.append(list(ctr_level( hmap, [0.68,0.95])[::-1]),hmap.max()),
plt.contourf( X,Y, hmap, levels=ctr_level( hmap, [1e-2,0.68,0.95]),
colors=None, extent=tuple(rge[par]+rge[par2]), cmap=plt.cm.get_cmap(cmaps[c]))
if contour[c]:
plt.contour( X,Y, hmap, levels=ctr_level( hmap, [0.68,0.95]),
......@@ -744,7 +743,7 @@ def ctr_level(histo2d, lvl):
alvl = np.searchsorted(cum_h, lvl)
clist = h[-alvl]
return clist
return clist[::-1]
def FeldmanCousins( xmin, sigma, CL=95):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment