Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fits.getdata returns NaNs #6485

Closed
Amarchuk opened this issue Aug 28, 2017 · 3 comments
Closed

fits.getdata returns NaNs #6485

Amarchuk opened this issue Aug 28, 2017 · 3 comments
Labels

Comments

@Amarchuk
Copy link

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.

@pllim pllim added the io.fits label Aug 28, 2017
@MSeifert04
Copy link
Contributor

MSeifert04 commented Aug 28, 2017

That image just has a lot nans 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()

png image 573 x 429 pixels

@Amarchuk
Copy link
Author

Ooops, my fault.
@MSeifert04 Thanks a lot for this super-fast answer!

@MSeifert04
Copy link
Contributor

No problem. Good luck with the data :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants