本文整理匯總了Python中MCUtils.rotvec方法的典型用法代碼示例。如果您正苦於以下問題:Python MCUtils.rotvec方法的具體用法?Python MCUtils.rotvec怎麽用?Python MCUtils.rotvec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MCUtils
的用法示例。
在下文中一共展示了MCUtils.rotvec方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: rrhr
# 需要導入模塊: import MCUtils [as 別名]
# 或者: from MCUtils import rotvec [as 別名]
def rrhr(band,skypos,tranges,skyrange,width=False,height=False,stepsz=1.,
verbose=0,response=True,hdu=False,retries=20):
"""Generate a high resolution relative response (rrhr) map."""
imsz = gxt.deg2pix(skypos,skyrange)
# TODO the if width / height
flat, flatinfo = cal.flat(band)
npixx,npixy = flat.shape
fltsz = flat.shape
pixsz = flatinfo['CDELT2']
detsize = 1.25
# Rotate the flat into the correct orientation to start.
flat = np.flipud(np.rot90(flat))
# NOTE: This upsample interpolation is done _last_ in the canonical
# pipeline as part of the poissonbg.c routine.
# The interpolation function is "congrid" in the same file.
# TODO: Should this be first order interpolation? (i.e. bilinear)
hrflat = scipy.ndimage.interpolation.zoom(flat,4.,order=0,prefilter=False)
img = np.zeros(hrflat.shape)[
hrflat.shape[0]/2.-imsz[0]/2.:hrflat.shape[0]/2.+imsz[0]/2.,
hrflat.shape[1]/2.-imsz[1]/2.:hrflat.shape[1]/2+imsz[1]/2.]
for trange in tranges:
t0,t1=trange
entries = gQuery.getArray(gQuery.aspect(t0,t1),retries=retries)
n = len(entries)
asptime = np.float64(np.array(entries)[:,2])/tscale
aspra = np.float32(np.array(entries)[:,3])
aspdec = np.float32(np.array(entries)[:,4])
asptwist= np.float32(np.array(entries)[:,5])
aspflags= np.float32(np.array(entries)[:,6])
asptwist= np.float32(np.array(entries)[:,9])
aspra0 = np.zeros(n)+skypos[0]
aspdec0 = np.zeros(n)+skypos[1]
xi_vec, eta_vec = gnomonic.gnomfwd_simple(
aspra,aspdec,aspra0,aspdec0,-asptwist,1.0/36000.,0.)
col = 4.*( ((( xi_vec/36000.)/(detsize/2.)*(detsize/(fltsz[0]*pixsz)) + 1.)/2. * fltsz[0]) - (fltsz[0]/2.) )
row = 4.*( (((eta_vec/36000.)/(detsize/2.)*(detsize/(fltsz[1]*pixsz)) + 1.)/2. * fltsz[1]) - (fltsz[1]/2.) )
vectors = mc.rotvec(np.array([col,row]),-asptwist)
for i in range(n):
if verbose>1:
mc.print_inline('Stamping '+str(asptime[i]))
# FIXME: Clean this mess up a little just for clarity.
img += scipy.ndimage.interpolation.shift(scipy.ndimage.interpolation.rotate(hrflat,-asptwist[i],reshape=False,order=0,prefilter=False),[vectors[1,i],vectors[0,i]],order=0,prefilter=False)[hrflat.shape[0]/2.-imsz[0]/2.:hrflat.shape[0]/2.+imsz[0]/2.,hrflat.shape[1]/2.-imsz[1]/2.:hrflat.shape[1]/2+imsz[1]/2.]*dbt.compute_exptime(band,[asptime[i],asptime[i]+1],verbose=verbose,retries=retries)*gxt.compute_flat_scale(asptime[i]+0.5,band,verbose=0)
return img