【问题标题】:Trouble Returning WCS from FITS Image从 FITS 图像返回 WCS 时遇到问题
【发布时间】:2020-12-04 05:42:29
【问题描述】:

我正在使用 astropy 加载 FITS 图像并从中检索 WCS。

from astropy.io import fits
from astropy.wcs import WCS

with fits.open('hst_A2744_f606w_drz.fits') as hdul:
    wcs = WCS(hdul[1])
    print(wcs)

哪个返回

WCS Keywords

Number of WCS axes: 2
CTYPE : 'RA---TAN'  'DEC--TAN'
CRVAL : 3.587755699764648  -30.39711750881429
CRPIX : 3000.4999999998081  2989.499999999809
CD1_1 CD1_2  : -1.3888888888888e-05  0.0
CD2_1 CD2_2  : 0.0  1.3888888888889599e-05
NAXIS : 6000  5978

我的目标是将 CRVAL 作为字符串、元组或数组返回,如下所示: (3.587755699764648, -30.39711750881429)

我尝试以wcs['CTYPE']wcs[CTYPE]wcs.CTYPE 访问它,但都返回错误。

【问题讨论】:

    标签: python astropy wcs


    【解决方案1】:

    你想要WCS.wcs

    特别是WCS.wcs.crval(或WCS.wcs.ctype,因为在您的问题中您写了您想要CRVAL 值,但您尝试找到CTYPE 值)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-13
      • 1970-01-01
      • 2014-12-05
      • 1970-01-01
      • 1970-01-01
      • 2022-12-05
      相关资源
      最近更新 更多