Astropy: fits.getdata 返回 NaN

创建于 2017-08-28  ·  3评论  ·  资料来源: astropy/astropy

你好,

我正在使用 astropy 2.0.1,Python 2.7。 当我尝试将 FITS 数据放入数组(适合文件链接)时

from astropy.io import fits
image_data = fits.getdata('NGC_628_NA_MOM2_THINGS.FITS')

我得到了充满 NaN 的 numpy 数组

array([[[[ nan,  nan,  nan, ...,  nan,  nan,  nan],
         [ nan,  nan,  nan, ...,  nan,  nan,  nan],
         [ nan,  nan,  nan, ...,  nan,  nan,  nan],
         ..., 
         [ nan,  nan,  nan, ...,  nan,  nan,  nan],
         [ nan,  nan,  nan, ...,  nan,  nan,  nan],
         [ nan,  nan,  nan, ...,  nan,  nan,  nan]]]], dtype=float32)

作为 HDU 列表打开

hdu_list = fits.open('NGC_628_NA_MOM2_THINGS.FITS')
image_data = hdu_list[0].data

返回相同的结果。 但是SAOImage ds9可以成功打开显示数据。

io.fits

最有用的评论

该图像的边缘有很多nan 。 不过看起来没问题:

from astropy.io import fits
import matplotlib.pyplot as plt

data = fits.getdata('NGC_628_NA_MOM2_THINGS.FITS')
plt.imshow(np.squeeze(data), origin='lower', cmap='gray')
plt.show()

png image 573 x 429 pixels

所有3条评论

该图像的边缘有很多nan 。 不过看起来没问题:

from astropy.io import fits
import matplotlib.pyplot as plt

data = fits.getdata('NGC_628_NA_MOM2_THINGS.FITS')
plt.imshow(np.squeeze(data), origin='lower', cmap='gray')
plt.show()

png image 573 x 429 pixels

哎呀,我的错。
@MSeifert04 非常感谢这个超级快速的答案!

没问题。 祝数据好运:)

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

matteobachetti picture matteobachetti  ·  43评论

ChrisBeaumont picture ChrisBeaumont  ·  46评论

bsipocz picture bsipocz  ·  32评论

MSeifert04 picture MSeifert04  ·  52评论

eteq picture eteq  ·  59评论