ngamsCmd_GLEAMCUTOUT.py 文件源码

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

项目:ngas 作者: ICRAR 项目源码 文件源码
def get_bparam(ra, dec, psf_path):
    """
    """
    #psflist = pyfits.open('mosaic_Week2_freqrange_psf.fits')
    psflist = pyfits.open(psf_path)
    w = pywcs.WCS(psflist[0].header, naxis=2)
    pixcoords = w.wcs_world2pix([[ra, dec]], 0)[0]
    #pixcoords = w.wcs_world2pix([[ra, dec]], 1)[0]
    #pixcoords = [int(round(elem)) for elem in pixcoords]
    pixcoords = [int(elem) for elem in pixcoords]
    a = pixcoords[1]
    b = pixcoords[0]
    a_len = psflist[0].data[0].shape[0]
    b_len = psflist[0].data[0].shape[1]
    if (a >= a_len):
        raise Exception("Cutout centre is out of the PSF map: {0} >= {1}".format(a, a_len))
        a = a_len - (a_len - a + 1) # a = a - 1?
    if (b >= b_len):
        raise Exception("Cutout centre is out of the PSF map: {0} >= {1}".format(b, b_len))
        b = b_len - (b_len - b + 1)
    bmaj = psflist[0].data[0][a][b]
    bmin = psflist[0].data[1][a][b]
    bpa = psflist[0].data[2][a][b]
    return (bmaj, bmin, bpa)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号