我正在使用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的身份访问它,但都返回错误。
发布于 2020-12-07 18:40:24
你想要WCS.wcs
特别是WCS.wcs.crval (或WCS.wcs.ctype,因为在您的问题中,您想要CRVAL值,但您显示了查找CTYPE值的尝试)。
https://stackoverflow.com/questions/65138506
复制相似问题