我正在尝试分析FITS图像的数据,该图像位于与python程序不同的目录中。图片未压缩,但是在此行代码之后,我收到以下错误:
from astropy.io import fits
img_file = '/home/rest/of/path/my_image.fits'
img_data = fits.getdata(img_file)
错误:
img_data = fits.getdata(img_file)
File "/usr/lib64/python2.7/site-packages/astropy-1.3-py2.7-linux-x86_64.egg/astropy/io/fits/convenience.py", line 208, in getdata
data = hdu.data
File "/usr/lib64/python2.7/site-packages/astropy-1.3-py2.7-linux-x86_64.egg/astropy/utils/decorators.py", line 722, in __get__
val = self.fget(obj)
File "/usr/lib64/python2.7/site-packages/astropy-1.3-py2.7-linux-x86_64.egg/astropy/io/fits/hdu/compressed.py", line 1368, in data
data = compression.decompress_hdu(self)
ValueError: Unrecognized compression type: GZIP_2
我认为一定是导致错误的路径说明,因为当我较早在所有相同目录中运行它并且仅指定文件名时,它就可以工作。我还读了另一个问题,即该路径规范应该起作用。如何从另一个目录中的图像成功获取数据?