本文整理汇总了Python中WLanalysis.gnom_fun方法的典型用法代码示例。如果您正苦于以下问题:Python WLanalysis.gnom_fun方法的具体用法?Python WLanalysis.gnom_fun怎么用?Python WLanalysis.gnom_fun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WLanalysis
的用法示例。
在下文中一共展示了WLanalysis.gnom_fun方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list2coords
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import gnom_fun [as 别名]
def list2coords(radeclist, Wx):
'''Input: radeclist = (Wfield, ra, dec), a 3xN matrix, (ra, dec) in degrees
Return: (subfield, x, y), a 3xN matrix, (x, y) in radians
'''
xy = zeros(shape = radeclist.shape) #create xy list
center = centers[Wx-1] #find the center for Wx field
f_Wx = WLanalysis.gnom_fun(center)
xy = degrees(array(map(f_Wx,radeclist)))
return xy
示例2: list2coords
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import gnom_fun [as 别名]
def list2coords(radeclist, Wx, offset=False):
size=sizes[Wx-1]
xy = zeros(shape = radeclist.shape)
if offset:
center = 0.5*(amin(radeclist,axis=0)+amax(radeclist, axis=0))
else:
center = centers[Wx-1]
f_Wx = WLanalysis.gnom_fun(center)
#xy = degrees(array(map(f_Wx,radeclist)))
xy = array(map(f_Wx,radeclist))
xy_pix = rad2pix(xy, size)
return xy_pix
示例3: int
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import gnom_fun [as 别名]
#############################################################
if make_kappa_predict:
from scipy.spatial import cKDTree
zcut = 0.2 #this is the lowest redshift for backgorund galaxies. use 0.2 to count for all galaxies.
r = 0.006 # 0.002 rad = 7arcmin,
#within which I search for contributing halos
Wx = int(sys.argv[1])
center = centers[Wx-1]
icat = cat_gen(Wx).T
ra, dec, redshift, weight, MAGi, Mhalo, Rvir, DC_arr = icat
## varying DL
#Mhalo[Mhalo>2e15] = 2e15#prevent halos to get crazy mass
f_Wx = WLanalysis.gnom_fun(center)#turns to radians
xy = array(f_Wx(icat[:2])).T
idx_back = where(redshift>zcut)[0]
xy_back = xy[idx_back]
kdt = cKDTree(xy)
#nearestneighbors = kdt.query_ball_point(xy_back[:100], 0.002)
def kappa_individual_gal (i):
'''for individual background galaxies, find foreground galaxies within 20 arcmin and sum up the kappa contribution
'''
print i
iidx_fore = array(kdt.query_ball_point(xy_back[i], r))
x_back, y_back = xy_back[i]
z_back, DC_back = redshift[idx_back][i], DC_arr[idx_back][i]
ikappa = 0
示例4: range
# 需要导入模块: import WLanalysis [as 别名]
# 或者: from WLanalysis import gnom_fun [as 别名]
############ ONCE TIME: saves part of the data into files ######
#data = np.array(hdulist[0].data)
##data[data<=1]=0.0
##data[data>1]=1.0#mask out everything has mask<1
#data[data>0]=1.0#mask out everything has mask=0
#for icount in range(63):
#print icount
#idata=data[:,step*icount:step*(1+icount)]#.flatten().reshape(1,-1)
#save(mask_dir+'smaller/weight0_cat_W%i_step%i_start%i'%(Wx,step, icount), idata)
#################################################################
#import time
#print 'begin',time.strftime("%Y-%m-%d %H:%M")
f_Wx = WLanalysis.gnom_fun(centers[Wx-1])
# 1 field needs to be split into 63 cores to do
def partialdata2grid (icount):
'''for a small portion of the data, put into a grid'''
print 'icount',icount
idata = load(mask_dir+'smaller/weight0_cat_W%i_step%i_start%i.npy'%(Wx,step, icount))
print 'loaded',icount
ix, iy=np.indices(idata.shape)
iy+=step*icount
#radeclist = (array(w.wcs_pix2world(ix, iy, 0)).reshape(2,-1)).T ////jia changed on 12/9, since the coordinates seems to be off..
#radeclist = (array(w.wcs_pix2world(iy, ix, 0)).reshape(2,-1)).T
#y, x = f_Wx (radeclist)
y, x = f_Wx ((array(w.wcs_pix2world(iy, ix, 0)).reshape(2,-1)).T )
print icount,'done f_wx %s'%(icount)#,time.strftime("%Y-%m-%d %H:%M")