I'm attempting to read the data from a FITS file using the astropy
module fits
and then standard numpy array handling. However, for some reason I am receiving the following error:
IndexError: too many indices
This is the code that I am using:
from astropy.io import fits
import matplotlib.pyplot as plt
hdulist = fits.open('/Users/iMacHome/Downloads/spec-1959-53440-0605.fits')
hdu = hdulist[1]
data = hdu.data
flux = data[:, 1]
^ Error Traceback to the flux = data[:, 1]
line.
loglam = data[:, 2]
This may be a question that perhaps astronomers could answer (or, specifically, astronomers familiar with .fits
files from the SDSS), but I welcome the input from numpy and python users!