當前位置: 首頁>>代碼示例>>Python>>正文


Python WLanalysis.peaks_mat方法代碼示例

本文整理匯總了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
開發者ID:apetri,項目名稱:CFHTLens_analysis,代碼行數:30,代碼來源:projectB_peakobs.py

示例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
開發者ID:apetri,項目名稱:CFHTLens_analysis,代碼行數:43,代碼來源:projectB_peakobs.py


注:本文中的WLanalysis.peaks_mat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。