I am trying to access the SDSS catalog through the FITS file I downloaded here, I am looking at the DR16Q_v4.fits file.
Unfortunately I cannot seem to find where the actual spectrum data is located even though I can find all the information listed in the data models, none of the table listed contain an array with a length long enough to be the flux array or the wavelength array.
I tried navigating the file on my own :
from astropy.io import fits
file = fits.open("C:\\Users\\Lord Duck\\Downloads\\DR16Q_v4.fits")
file.info()
h1=file[1].header
print(repr(h1))
wields the expected description given in the previous data models :
No. Name Ver Type Cards Dimensions Format
0 PRIMARY 1 PrimaryHDU 4 ()
1 CATALOG 1 BinTableHDU 375 750414R x 183C [18A, D, D, J, J, I, 6A, 6A, I, D, I, D, I, I, I, K, D, I, I, D, I, D, I, D, D, I, D, 12A, D, J, 19A, D, K, D, D, K, D, D, K, D, D, K, D, D, K, D, D, K, D, D, K, D, E, 5D, 5D, 5D, E, D, D, D, D, D, D, D, D, K, K, K, K, K, K, J, J, J, 74J, 74J, 74I, 74I, B, J, 3A, J, J, J, D, D, D, D, 14A, J, D, 5E, 5D, 5E, 5D, 5E, D, D, I, D, D, D, D, I, D, D, D, D, D, D, D, D, E, E, E, E, E, E, E, E, E, I, E, E, E, E, E, E, E, E, E, I, I, D, D, D, D, D, D, J, D, D, D, J, D, D, D, J, D, 21A, D, D, E, E, D, K, D, D, E, E, E, E, E, E, E, D, I, 28A, D, D, D, D, D, D, D, D, D, D, D, D, D, D, D]
XTENSION= 'BINTABLE' / binary table extension
BITPIX = 8 / array data type
NAXIS = 2 / number of array dimensions
NAXIS1 = 2290 / length of dimension 1
NAXIS2 = 750414 / length of dimension 2
PCOUNT = 0 / number of group parameters
GCOUNT = 1 / number of groups
TFIELDS = 183 / number of table fields
TTYPE1 = 'SDSS_NAME'
TFORM1 = '18A '
TTYPE2 = 'RA '
TFORM2 = 'D '
TTYPE3 = 'DEC '
....
Going further I tried extracting the data :
data=file[1].data
print(len(data))
Which wields :
750414
So I assume that data is an array of length 750414 which represent all the different quasar from the SDSS catalog and going one step further :print(len(data[0])) wields 183 corresponding to the 183 tables with all the characteristic of each quasar.
But where is the spectrum ?