【发布时间】:2014-09-16 13:27:50
【问题描述】:
我想从 python 脚本中获取给定像素的物理天空坐标。我想使用 astropy 的 WCS,但我会在 python 中做任何事情。
这两个sn-ps的代码我都试过了。
from astropy.io import fits
from astropy.wcs import WCS
def astropymethod1(img):
# from http://astropy.readthedocs.org/en/latest/wcs/
w = WCS(img)
lon, lat = w.all_pix2world( 100., 100., 1)
print lon, lat
def astropymethod2(img):
# from http://astropy.readthedocs.org/en/latest/wcs/
hdu = fits.open(img)
w = WCS(hdu[0].header)
lon, lat = w.wcs_pix2world(100., 100., 1)
print lon, lat
问题是我第一次尝试使用 WCS 时出错,结果只是我输入的像素值。
WARNING: FITSFixedWarning: The WCS transformation has more axes (2) than the image it is associated with (0) [astropy.wcs.wcs]
【问题讨论】:
-
您的保管箱链接不是链接。您还有其他服务可以用来向我们展示示例文件吗?
-
我的朋友 Brian 告诉我,我的 fit 文件是多扩展的,因此我需要做的就是在我的第二种方法中使用 hdu[1] 而不是 hdu[0]。
-
这里是保管箱链接。我没有看到它没有出现。 dropbox.com/s/qt0mx78cwfcpsjk/WCS.zip