本文整理汇总了Python中MCUtils.get_fits_header方法的典型用法代码示例。如果您正苦于以下问题:Python MCUtils.get_fits_header方法的具体用法?Python MCUtils.get_fits_header怎么用?Python MCUtils.get_fits_header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCUtils
的用法示例。
在下文中一共展示了MCUtils.get_fits_header方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xieta2colrow
# 需要导入模块: import MCUtils [as 别名]
# 或者: from MCUtils import get_fits_header [as 别名]
def xieta2colrow(xi, eta, calfile, detsize=1.25):
"""Convert detector xi, eta into col, row."""
flat = mc.get_fits_data(calfile)
flatinfo = mc.get_fits_header(calfile)
# should be able to get npix from the header...
npixx = flat.shape[0]
npixy = flat.shape[1]
pixsz = flatinfo['CDELT2']
flatfill = detsize/(npixx*pixsz)
col = ((( xi/36000.)/(detsize/2.)*flatfill + 1.)/2. * npixx)
row = (((eta/36000.)/(detsize/2.)*flatfill + 1.)/2. * npixy)
# You could theoretically drop a cut on detector position / detsize here...
# Also, is this cut absolutely necessary? I think it's already been taken
# care of by the flag==0 assertion in the SQL query.
#cut = ((col > 0.) & (col < flat.shape[0]-1) &
# (row > 0.) & (row < flat.shape[1]-1))
#cut = np.where(ix == True)
return col, row