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


Python WLanalysis.buildInterpolator方法代碼示例

本文整理匯總了Python中WLanalysis.buildInterpolator方法的典型用法代碼示例。如果您正苦於以下問題:Python WLanalysis.buildInterpolator方法的具體用法?Python WLanalysis.buildInterpolator怎麽用?Python WLanalysis.buildInterpolator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WLanalysis的用法示例。


在下文中一共展示了WLanalysis.buildInterpolator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sumMF

# 需要導入模塊: import WLanalysis [as 別名]
# 或者: from WLanalysis import buildInterpolator [as 別名]
### to local for further analysis

#isumMF_cov = sumMF((0,0,0),loadcov=1)
#np.save('/home1/02977/jialiu/KSsim/MF_sum/MF_sum_cov',isumMF_cov)

#all_MF = array(map(sumMF, params))#shape=(91,1000,150)
#np.save('/home1/02977/jialiu/KSsim/MF_sum/MF_sum_91cosmo',all_MF.reshape(91,-1))
##########################################################

Mat_MF = np.load('/Users/jia/CFHTLenS/emulator/MF/MF_sum_91cosmo.npy').reshape(91,1000,-1)
avg_MF = mean(Mat_MF,axis=1)
obs_MF = np.load('/Users/jia/CFHTLenS/emulator/MF/obs.npy')
fidu_MF = np.load('/Users/jia/CFHTLenS/emulator/MF/MF_sum_cov.npy')
fidu_avg_MF = mean(fidu_MF,axis=0)

spline_interps = WLanalysis.buildInterpolator(avg_MF,params)

def interp_cosmo (params, spline_interps = spline_interps):
	'''Interpolate the MF for certain param.
	Params: list of 3 parameters = (om, w, si8)
	'''	
	im, wm, sm = params
	gen_MF = lambda ibin: spline_interps[ibin](im, wm, sm)
	MF_interp = array(map(gen_MF, range(len(spline_interps))))
	MF_interp = MF_interp.reshape(-1,1).squeeze()
	return MF_interp

cov_mat = cov(fidu_MF, rowvar=0)

def probMap (obs, cov_mat, spline_interps, ms, ss):
	'''return a probability map for observation'''
開發者ID:apetri,項目名稱:CFHTLens_analysis,代碼行數:33,代碼來源:MFtest.py


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