使用Astropy库,我创建了一个FITS图像,该图像由2个实际FITS图像插值而成(它们被缩放为“int16”,这是我使用的软件的正确格式:Maxim DL)。在
但是此图像的比例是float64,而不是int16。任何天文处理软件都无法读取(除了适合解放者)
你知道该怎么做吗?我们可以通过改变标题中的“BITPIX”来转换FITS图像吗?在
我试过:(按照这个方法:appendix/faq.html#why-is-an-image-containing-integer-data-being-converted-unexpectedly-to-floats" rel="nofollow noreferrer">Why is an image containing integer data being converted unexpectedly to floats?
from astropy.io import fits
hdu1=fits.open('mypicture.fit')
image=hdu1[0]
print(image.header['BITPIX']) # it gives : -64
image.scale('int16')
data=image.data
data.dtype
print(image.header['BITPIX']) # it gives : 16
hdu1.close()
但是,当我检查新修改的比例我的图片.fit“,它仍然显示-64! 没有保存和应用任何更改!在
如果我没弄错你的问题,这应该行得通。在
相关问题 更多 >
编程相关推荐