Hi,
I am using astropy 2.0.1, Python 2.7. When I try to get FITS data into array (fits file link) by
from astropy.io import fits
image_data = fits.getdata('NGC_628_NA_MOM2_THINGS.FITS')
I get numpy array full of NaNs
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)
Open as HDU list
hdu_list = fits.open('NGC_628_NA_MOM2_THINGS.FITS')
image_data = hdu_list[0].data
return the same result. But SAOImage ds9 can successfully open and show data.
That image just has a lot nan
s at the edges. It looks okay though:
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()
Ooops, my fault.
@MSeifert04 Thanks a lot for this super-fast answer!
No problem. Good luck with the data :)
Most helpful comment
That image just has a lot
nan
s at the edges. It looks okay though: