本文整理汇总了Python中WLanalysis.findlevel方法的典型用法代码示例。如果您正苦于以下问题:Python WLanalysis.findlevel方法的具体用法?Python WLanalysis.findlevel怎么用?Python WLanalysis.findlevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WLanalysis
的用法示例。
在下文中一共展示了WLanalysis.findlevel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: official_contour
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import findlevel [as 别名]
def official_contour (cube_arr, labels, nlev, fn, colors, lws, lss, include_w = 0):
f = figure(figsize=(8,8))
ax=f.add_subplot(111)
lines=[]
X, Y = np.meshgrid(om_arr, si8_arr)
for i in arange(len(cube_arr)):
cube = cube_arr[i]
if include_w:
ix,iy = 1, 0
P=cube2P(cube, axis=2)
X, Y = np.meshgrid(w_arr, om_arr)
else:
P=cube2P(cube)
V=WLanalysis.findlevel(P)
print fn,'include_w %s\t 1sigma: %.5f\t 2sigma: %.5f'%(bool(include_w), 100*len(where(P>V[0])[0])/512.**2, 100*len(where(P>V[1])[0])/512.**2)
if include_w and i ==2:
CS = ax.contourf(X, Y, P.T, levels=[V[0],V[1]], origin='lower', extent=extents, colors=colors[i], linewidths=lws[i], linestyles=lss[i],alpha=0.85)
else:
CS = ax.contour(X, Y, P.T, levels=[V[0],], origin='lower', extent=extents, colors=colors[i], linewidths=lws[i], linestyles=lss[i])
lines.append(CS.collections[0])
if nlev == 2:
CS2 = ax.contour(X, Y, P.T, levels=[V[1],], alpha=0.7, origin='lower', extent=extents, colors=colors[i], linewidths=lws[i], linestyles=lss[i])
if include_w:
ax.set_ylabel(r'$\rm{\Omega_m}$',fontsize=20)
ax.set_xlabel(r'$\rm{w}$',fontsize=20)
else:
leg=ax.legend(lines, labels, ncol=1, labelspacing=0.3, prop={'size':20},loc=0)
leg.get_frame().set_visible(False)
ax.tick_params(labelsize=16)
ax.set_xlabel(r'$\rm{\Omega_m}$',fontsize=20)
ax.set_ylabel(r'$\rm{\sigma_8}$',fontsize=20)
savefig(plot_dir+fn+'.pdf')
close()
示例2: range
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import findlevel [as 别名]
if plot_contours:
#for x0 in range(0,50,5):
#x1 = x0+5
x0, x1 = 5, 25
for z in (0, 50, 100):
print z
idx = range(x0+z,x1+z)
ms = linspace(0,1,40)
ss = linspace(0.2,1.0,41)
iobs = obs_MF[idx]
#iobs = fidu_avg_MF[idx]
icov_mat = cov(fidu_MF[:,idx], rowvar=0)
ispline_interps = array(spline_interps)[idx]
P = probMap(iobs, icov_mat, ispline_interps, ms, ss)
V = WLanalysis.findlevel(P)
drawcontour2D(P, V, ms, ss, 'MF%i_obs_bin%02d-%02d'%(z/50, x0,x1))
def plotcov (Cov, ititle):
X, Y = meshgrid(diag(Cov),diag(Cov))
Corr = Cov/sqrt(X*Y)
J, K = meshgrid(fidu_avg_MF,fidu_avg_MF)
Cov_rel = Cov.copy()
Cov_rel[:150,:150]/=sqrt(abs(J*K))
figure()
plot(Corr[:-1,-1])
title(ititle)
savefig(plot_dir+'Corr_1D'+ititle+'.jpg')
close()
示例3: linspace
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import findlevel [as 别名]
b_arr = linspace(0.0, 3.0, 1001)#[80:500]
m_arr = linspace(0.0, 3.0, 1000)#[100:600]
X, Y = np.meshgrid(m_arr, b_arr)
iextent=[0,b_arr[-1],0,b_arr[-1]]
labels = ["$18<i<%i$"%(cut) for cut in (22,23,24)]
from pylab import *
lines=[]
f=figure(figsize=(8,6))
ax=f.add_subplot(111)
for cut in (22,23,24):
##### referee
prob=load(main_dir+'referee/prob%s_cut%i_%s_40bins.npy'%(prefix,cut,fn))#[80:500,100:600]
P_b = sum(prob,axis=1)
P_m = sum(prob,axis=0)
V=WLanalysis.findlevel(prob)
V_b = WLanalysis.findlevel(P_b)
V_m = WLanalysis.findlevel(P_m)
#string = '''cut i<%i
#68CL: b = $%.2f\substack{+%.2f \\\\ -%.2f}$ &$%.2f\substack{+%.2f \\\\ -%.2f}$'''%(cut,
#b_arr[argmax(P_b)], b_arr[P_b>V_b[0]][-1]-b_arr[argmax(P_b)], b_arr[argmax(P_b)]-b_arr[P_b>V_b[0]][0],
#m_arr[argmax(P_m)], m_arr[P_m>V_m[0]][-1]-m_arr[argmax(P_m)], m_arr[argmax(P_m)]-m_arr[P_m>V_m[0]][0],
##b_arr[argmax(P_b)], b_arr[P_b>V_b[1]][-1]-b_arr[argmax(P_b)], b_arr[argmax(P_b)]-b_arr[P_b>V_b[1]][0],
##m_arr[argmax(P_m)], m_arr[P_m>V_m[1]][-1]-m_arr[argmax(P_m)], m_arr[argmax(P_m)]-m_arr[P_m>V_m[1]][0],
##b_arr[argmax(P_b)], b_arr[P_b>V_b[2]][-1]-b_arr[argmax(P_b)], b_arr[argmax(P_b)]-b_arr[P_b>V_b[2]][0],
##m_arr[argmax(P_m)], m_arr[P_m>V_m[2]][-1]-m_arr[argmax(P_m)], m_arr[argmax(P_m)]-m_arr[P_m>V_m[2]][0]
#)
string = '''cut i<%i
68 percent CL: b = %.2f -%.2f +%.2f, m = %.2f -%.2f +%.2f
95 percent CL: b = %.2f -%.2f +%.2f, m = %.2f -%.2f +%.2f
99 percent CL: b = %.2f -%.2f +%.2f, m = %.2f -%.2f +%.2f
示例4: mean
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import findlevel [as 别名]
#plot(x_arr[i][1:], mean(iPDF_kappa, axis=0),'k-',lw=1,label=r'$\kappa\,\rm{maps}$')
plot([-0.5,0.5],[0,0],'k--',lw=2)
ax.errorbar(x_arr[i][1:], mean(iPDF_kappa, axis=0)/mean(iPDF_GRF, axis=0)-1, std(iPDF_kappa, axis=0)/sqrt(2e4/12)/mean(iPDF_GRF, axis=0), capsize=0,color='k')
ax.locator_params(axis = 'x', nbins = 6)
locator_params(axis = 'y', nbins = 5)
ax.annotate(r"$\theta_G=%.1f'$"%(sigmaG_arr[i]), xy=(0.025, 0.8), xycoords='axes fraction',fontsize=16)
meanPDF = mean(iPDF_kappa, axis=0)
if j==2:#peaks
ax.set_ylim(amin(meanPDF), amax(meanPDF)*2)
idx=where(meanPDF>0)[0]
#ax.set_xlim(x_arr[i][1:][amin(idx)], x_arr[i][1:][amax(idx)])
ax.set_xlim(x_arr[i][1:][0],x_arr[i][1:][-1])
else:
#ax.set_ylim(amax([amin(meanPDF), 1e-6])*1.5, amax(meanPDF)*2.5)
x0=1.5*abs(x_arr[i][1:][where(meanPDF==WLanalysis.findlevel(meanPDF)[-1])[0]])
ax.set_xlim(-x0,x0)#(-0.1,0.1)#
if i == 4:
ax.set_xlabel('$\kappa$',fontsize=22)
ax.tick_params(labelsize=16)
ax.set_ylim(-0.6,0.6)
plt.tight_layout()
plt.subplots_adjust(hspace=0.2,wspace=0, left=0.18, right=0.95)
show()
#savefig(CMBNG_dir+'plot/plot_noiseless_%s.jpg'%(['PDF','peaks'][j-1]))
#savefig(CMBNG_dir+'plot_official/plot_noiseless_%s_diff.pdf'%(['PDF','peaks'][j-1]))
#close()