Snyder005
Snyder005

Reputation: 224

Cannot read a large FITS file using Astropy.io.fits

I am currently attempting to read data from a large data FITS format data file using astropy.io.fits for Python 3.4. While I can successfully open the file using the memmapper mode, I cannot access the data within the file. Here is my code

from astropy.io import fits

hdu_list = fits.open('large_file.fit', memmapper=True)
table = hdu_list[1].data

On the second line table = hdu_list[1].data I then get OSError: [WinError 8] Not enough storage is available to process this command

My thinking is that when assigning the data to the variable table, the attempt is made to read the entire file, causing the storage error. Is there any work around, or a method to simply read in each line of the table data at a time?

Upvotes: 0

Views: 1127

Answers (1)

Snyder005
Snyder005

Reputation: 224

Discovered what went wrong. I tried to open the FITS file with fitsio and then read row by row. However the program ran for awhile, then threw an IOError. I found that one of the rows of the file was corrupted, and that was what was causing the inability of astropy.io.fits to read the file without throwing an error. I am unsure of exactly how the row became corrupted, or exactly what was wrong with it, I simply downloaded a second copy of the FITS file and that fixed the problem.

Upvotes: 2

Related Questions