This might be in the FITS Header, but I couldn't find it.

I am looking at the FITS files for SDSS 1D spectro images from DR7 using the SDSS Data Archive Server at das.sdss.org (there might be an easier way to do this now with DR12).

http://das.sdss.org/spectro/ holds all FITS files generated by the spectroscopic pipelines.

The URL for a typical FITS file is http://das.sdss.org/spectro/1d_26/0283/1d/spSpec-mmmmm-pppp-fff.fit

to access FITS file spSpec-mmmmm-pppp-fff.fit, where mmmmm is the mjd, pppp is the plate ID number and fff is the fiber ID number.

It is explained here: http://classic.sdss.org/dr5/dm/flatFiles/spSpec.html


Primary HDU image: spectrum, continuum-subtracted spectrum, noise in spectrum, mask array.
HDU 1 and 2: Line detections and measurements. Under most circumstances, the line measurements in HDU 2 should be used.
HDU 3: Emission-line redshift measurements
HDU 4: Cross-correlation redshift measurement
HDU 5: Line index measurements
HDU 6: Mask and per-pixel resolution

That is, for primary HDU image holds the spectrum. The first row is the spectrum, the second row is the continuum subtracted spectrum, the third row is the noise in the spectrum (standard deviation, in the same units as the spectrum), the forth row is the mask array. The spectra are binned log-linear. Units are 10^(-17) erg/cm/s^2/Ang.

Question: I see FIVE rows in the primary HDU, not FOUR. What do these values mean?

The header information states:

ARRAY1  = 'SPECTRUM'           / units of (10^-17 erg/s/cm^2/A                  
ARRAY2  = 'CONTINUUM-SUBTRACTED SPECTRUM' / units of (10^-17 erg/s/cm^2/A       
ARRAY3  = 'ERROR   '           / units of (10^-17 erg/s/cm^2/A                  
ARRAY4  = 'MASK    '           / mask bit array     

But what is the fifth array?

EDIT: Solely to prevent link rot, the URL linked below for plate spectra http://data.sdss3.org/datamodel/files/BOSS_SPECTRO_REDUX/RUN2D/PLATE4/spPlate.html presents:

File Format

Number             EXTNAME     Type                            Contents
HDU0                           NPIX x NFIBER float image       Flux in units of 10^-17^ erg/s/cm^2^/Ang
HDU1               IVAR        NPIX x NFIBER float image       Inverse variance (1/sigma^2^) for HDU 0 
HDU2               ANDMASK     NPIX x NFIBER 32-bit int image  AND mask
HDU3               ORMASK      NPIX x NFIBER 32-bit int image  OR mask
HDU4               WAVEDISP    NPIX x NFIBER float image       Wavelength dispersion in pixels
HDU5 fields        PLUGMAP     binary table                    Plug-map structure from plPlugMapM file
HDU6               SKY         NPIX x NFIBER float image       Average sky flux in units of 10^-17^ erg/s/cm^2^/Ang

The data I see for spSpec-53166-1615-513.fit are:

HDU0: 127.76799774  127.74199677  127.71600342  127.68900299  129.7460022

HDU1: 3.67299652e+00   3.88988495e+00   4.13349915e+00   4.10649872e+00

HDU2: 7.47320271  7.04110146  6.8415041   6.68683195  6.52122736  6.4465971

HDU3: 8.38860800e+07   1.67772160e+07   1.67772160e+07   0.00000000e+00

HDU4: 5.96072006    5.84291983    5.67241001    5.57223988    5.43919992
  • 2
    $\begingroup$ I'm voting to close this question as off-topic because it is not about physics. $\endgroup$
    – Danu
    Sep 10, 2015 at 20:57
  • $\begingroup$ No, your question is not about physics. Your question is about how to read the output of some software; that's not physics. $\endgroup$
    – Danu
    Sep 10, 2015 at 21:19
  • 1
    $\begingroup$ crossposted: stackoverflow.com/q/32511536 $\endgroup$
    – Kyle Oman
    Sep 10, 2015 at 21:34
  • 1
    $\begingroup$ I feel like this is on-topic since it is the official astronomy data, not someone's random files. It would be the same if the LHC published raw counts on their website. $\endgroup$
    – user10851
    Sep 10, 2015 at 21:41
  • 1
    $\begingroup$ In keeping with my opinion on earlier meta questions, I'd be in favor of this being on-topic because of the specificity of format questions asked: it asks about a single astrophysical data set and nothing else. That said, my opinion is not universally held, and I'm not going to take preemptive, moderator-powered action without a clear consensus. $\endgroup$ Sep 11, 2015 at 0:30

1 Answer 1


I asked my local SDSS experts, and the answer is that the fourth and fifth arrays are both bitmasks.

Some background: the spectra are often generated with separate exposures that are combined into one dataset. Each exposure comes with its own set of flags. When combining datasets, the question naturally arises "Do we set a flag if it appears in any of the primitive datasets, or only if it appears in all of them?"

One array contains the bitwise AND of the flags from the primitive datasets, the other contains the bitwise OR. You can decide which coalescing operation suits your needs.

This behavior is documented for one of the photometry plate formats here if nowhere else.

  • $\begingroup$ Interesting. I had a pretty thorough search through the documentation and didn't find an actual explicit explanation (there were always 4 rows mentioned). I saw the page you linked, but it's talking about a different type of file (spPlate not spSpec). Not that I doubt that you're right. This is astronomy documentation, after all. $\endgroup$
    – Kyle Oman
    Sep 11, 2015 at 20:39
  • $\begingroup$ Thanks for the help. I don't think that's what I'm seeing though---see the above edit. Only the fourth array, HDU3, looks like bitmasks. HDU2 and HDU4 (the third and fifth arrays) look like errors. $\endgroup$ Sep 11, 2015 at 23:52
  • $\begingroup$ @ChrisWhite See the above outputs? The fifth array doesn't look like bitmasks. It looks like error values. $\endgroup$ Sep 13, 2015 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.