当前位置: 首页>>代码示例>>Python>>正文


Python MCUtils.get_fits_data方法代码示例

本文整理汇总了Python中MCUtils.get_fits_data方法的典型用法代码示例。如果您正苦于以下问题:Python MCUtils.get_fits_data方法的具体用法?Python MCUtils.get_fits_data怎么用?Python MCUtils.get_fits_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MCUtils的用法示例。


在下文中一共展示了MCUtils.get_fits_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: hashresponse

# 需要导入模块: import MCUtils [as 别名]
# 或者: from MCUtils import get_fits_data [as 别名]
def hashresponse(band,events,calpath='../cal/',verbose=0):
    """Given detector xi, eta, return the response at each position."""
    # Hash out the response correction
    if verbose:
        mc.print_inline("Applying the response correction.")
    flat = mc.get_fits_data(flat_filename(band, calpath))
    events['col'], events['row'] = xieta2colrow(events['xi'], events['eta'],
                                                flat_filename(band, calpath))
    events['flat'] = flat[np.array(events['col'], dtype='int16'),
                          np.array(events['row'], dtype='int16')]
    events['scale'] = gxt.compute_flat_scale(events['t'], band)
    # TODO: Separately do the binlinearly interpolated response
    events['response'] = (events['flat']*events['scale'])
    return events
开发者ID:sarallelagram,项目名称:gPhoton,代码行数:16,代码来源:curvetools.py

示例2: xieta2colrow

# 需要导入模块: import MCUtils [as 别名]
# 或者: from MCUtils import get_fits_data [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
开发者ID:sarallelagram,项目名称:gPhoton,代码行数:20,代码来源:curvetools.py

示例3: enumerate

# 需要导入模块: import MCUtils [as 别名]
# 或者: from MCUtils import get_fits_data [as 别名]
for i,band in enumerate(bands):
    delta = mc.angularSeparation(data[band]['ra'],data[band]['dec'],
                                 data[band]['racent'],data[band]['deccent'])
    plt.subplot(1,2,i+1,yticks=[],xlim=[0.*a,0.002*a])
    plt.title('{band} Angular Separation (arcsec)'.format(
                                                    band=band,d=r'$\Delta$'))
    plt.hist(delta*a,bins=500,range=[0.*a,0.002*a],color='k')
    fig.savefig('../calpaper/src/angSep({band}).png'.format(band=band))

###############################################################################
"""Deadtime Sanity Checks
According to the calibration paper, the FUV deadtime correction should be
small (~ a few percent), but it is actually bigger than the NUV correction.
"""
fig = plt.figure(figsize=(8,4))
fig.subplots_adjust(left=0.12,right=0.95,wspace=0.02,bottom=0.15,top=0.9)
for i,band in enumerate(bands):
    plt.subplot(1,2,i+1,yticks=[])
    plt.title('{band} Deadtime Ratio Histogram'.format(band=band))
    plt.hist(data[band]['t_eff']/data[band]['t_raw'],bins=100,range=[0.2,1.2])

"""Response Sanity Checks"""
fig = plt.figure(figsize=(8,4))
fig.subplots_adjust(left=0.12,right=0.95,wspace=0.02,bottom=0.15,top=0.9)
for i,band in enumerate(bands):
    flat = mc.get_fits_data(flat_filename(band,'../cal/'))
    plt.subplot(1,2,i+1,yticks=[])
    plt.title('{band} Response Histogram'.format(band=band))
    plt.hist(flat.flatten(),bins=100,range=[0.2,1.2])
    plt.hist(data[band]['response'],bins=100,range=[0.2,1.2])
开发者ID:cmillion,项目名称:gPhoton,代码行数:32,代码来源:script.py


注:本文中的MCUtils.get_fits_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。