本文整理汇总了Python中WLanalysis.peaks_mat方法的典型用法代码示例。如果您正苦于以下问题:Python WLanalysis.peaks_mat方法的具体用法?Python WLanalysis.peaks_mat怎么用?Python WLanalysis.peaks_mat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WLanalysis
的用法示例。
在下文中一共展示了WLanalysis.peaks_mat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PeakPos
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import peaks_mat [as 别名]
def PeakPos (Wx, z_lo=0.6, z_hi='0.6_lo',noise=False, Bmode=False):
'''For a map(kappa or bmode), find peaks, and its(RA, DEC)
return 3 columns: [kappa, RA, DEC]
'''
#print 'noise', noise, Wx
if Bmode:
kmap = bmodeGen(Wx, z=z_hi)
else:
kmap = kmapGen(Wx, z=z_hi)
ipeak_mat = WLanalysis.peaks_mat(kmap)
imask = maskGen (Wx, z=z_lo)
ipeak_mat[where(imask==0)]=nan #get ipeak_mat, masked region = nan
if noise: #find the index for peaks in noise map
idx_all = where((imask==1)&isnan(ipeak_mat))
sample = randint(0,len(idx_all[0])-1,sum(~isnan(ipeak_mat)))
idx = array([idx_all[0][sample],idx_all[1][sample]])
else:#find the index for peaks in kappa map
idx = where(~isnan(ipeak_mat)==True)
kappaPos_arr = zeros(shape=(len(idx[0]),3))#prepare array for output
for i in range(len(idx[0])):
x, y = idx[0][i], idx[1][i]#x, y
kappaPos_arr[i,0] = kmap[x, y]
x = int(x-sizes[Wx-1]/2)+1
y = int(y-sizes[Wx-1]/2)+1
x /= PPR512# convert from pixel to radians
y /= PPR512
kappaPos_arr[i,1:] = WLanalysis.gnom_inv((y, x), centers[Wx-1])
return kappaPos_arr.T
示例2: return_kappa_arr
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import peaks_mat [as 别名]
def return_kappa_arr (Wx, sigmaG=sigmaG):
mask = maskGen(Wx, 0.5, sigmaG)
kmap_predict = kmap_predict_Gen(Wx, sigmaG)
kmap_predict -= mean(kmap_predict)
kmap_lensing = kmap_lensing_Gen(Wx, sigmaG)
bmode = bmode_lensing_Gen(Wx, sigmaG)
kproj_peak_mat = WLanalysis.peaks_mat(kmap_predict)
#kproj_peak_mat = WLanalysis.peaks_mat(kmap_lensing)
#kproj_peak_mat = WLanalysis.peaks_mat(bmode)
idx_pos = (kproj_peak_mat!=0)&(~isnan(kproj_peak_mat))&(mask>0)
kappa_proj = kmap_predict[idx_pos]
kappa_lensing = kmap_lensing[idx_pos]
kappa_bmode = bmode[idx_pos]
######## do an overlay of peaks on top of convergence #######
if sigmaG == 8.9:
kmap_predict2 = kmap_predict_Gen(Wx, 5.3)
mask2 = maskGen(Wx, 0.5, 5.3)
kproj_peak_mat = WLanalysis.peaks_mat(kmap_predict2)
kproj_peak_mat[mask2==0] = nan
kproj_peak_mat[isnan(kproj_peak_mat)]=0
peaksmooth = WLanalysis.smooth(kproj_peak_mat,10)
kstd=std(kmap_lensing)
#pstd=std(kmap_predict2)
kmap_lensing[peaksmooth>2*std(peaksmooth)]=nan
kmap_lensing[mask2==0]=-99
kmap_predict2[peaksmooth>2*std(peaksmooth)]=nan
f2=figure(figsize=(20,12))
axx=f2.add_subplot(121)
axy=f2.add_subplot(122)
axx.imshow(kmap_lensing,origin='lower',vmin=-2*kstd,vmax=3*kstd,interpolation='nearest')
#f2.colorbar()
axx.set_title('lensing')
axy.imshow(kmap_predict2,origin='lower',interpolation='nearest')
#plt.colorbar(cax=axy)
axy.set_title('predict')
savefig(plot_dir+'peaks_location_W%s.jpg'%(Wx))
close()
return kappa_proj, kappa_lensing, kappa_bmode