characterize.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:Panacea 作者: grzeimann 项目源码 文件源码
def check_bias(args, amp, folder, edge=3, width=10):
    # Create empty lists for the left edge jump, right edge jump, and structure
    left_edge, right_edge, structure, overscan = [], [], [], []

    # Select only the bias frames that match the input amp, e.g., "RU"
    sel = [i for i, v in enumerate(args.bia_list) if v.amp == amp]
    log = args.bia_list[sel[0]].log

    overscan_list = [[v.overscan_value for i, v in enumerate(args.bia_list)
                      if v.amp == amp]]
    overscan = biweight_location(overscan_list)
    log.info('Overscan value for %s: %0.3f' % (amp, overscan))
    # Loop through the bias list and measure the jump/structure
    big_array = np.array([v.image for v in itemgetter(*sel)(args.bia_list)])
    if args.quick:
        func = np.median
    else:
        func = biweight_location
    masterbias = func(big_array, axis=(0,))

    a, b = masterbias.shape
    hdu = fits.PrimaryHDU(np.array(masterbias, dtype='float32'))

    log.info('Writing masterbias_%s.fits' % (amp))
    write_fits(hdu,
               op.join(folder, 'masterbias_%s_%s.fits' % (args.specid, amp)))

    left_edge = func(masterbias[:, edge:edge+width])
    right_edge = func(masterbias[:, (b-width-edge):(b-edge)])
    structure = func(masterbias[:, edge:(b-edge)], axis=(0,))

    log.info('Left edge - Overscan, Right edge - Overscan: %0.3f, %0.3f'
             % (left_edge, right_edge))
    return left_edge, right_edge, structure, overscan, masterbias
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号