[AstroPy] Issues in DR14/DR15 headers read using astropy.io.fits

John K. Parejko parejkoj at uw.edu
Fri Jul 26 18:39:45 EDT 2019


It looks like you're looking at BOSS/eBOSS data? If so, the datamodel for that data is available here:

https://data.sdss.org/datamodel/files/BOSS_SPECTRO_REDUX/RUN2D/spectra/lite/PLATE4/spec.html

The fields in HDU2 (extracted from the spAll database) are named, so you should use those names instead of column indexes, to make it clearer what you are trying to extract:

https://data.sdss.org/datamodel/files/BOSS_SPECTRO_REDUX/RUN2D/spAll.html

Which of the spAll values are you having trouble with, when you say it "produces junk"? The SAS shows a spectrum for your example 2, though it's noisy:

https://dr15.sdss.org/optical/spectrum/view?id=189090&plate=7512&mjd=56777&fiberid=396

John

On 26/07/2019 15:20, Peter Dzwig wrote:
> I am looking for some general help with FITS Headers
> 
> 
> 
> I have two (SDSS) files:
> 
> (1) remote_filename =
> 'https://dr15.sdss.org/optical/spectrum/view/data/format=fits/spec=lite?plateid=0425&mjd=51898&fiberid=0440'
> 
> (2)remote_filename =
> 'https://dr15.sdss.org/optical/spectrum/view/data/format=fits/spec=lite?plateid=7512&mjd=56777&fiberid=0396'
> 
> I wrote some Python code using astropy which extracted the spectrum of
> an object from the second HDU of the appropriate .fits file. In
> particular I wanted to extract certain fields
> 
> For example:
> 
> f = fits.open(remote_filename)
> 
> specdata2 = f[2].data
> 
> RA = specdata2[0][59]
> Dec = specdata2[0][60]
> 
> # Classification
> 
> Class = specdata2[0][61]
> 
> # Redshift and error
> 
> redshift = specdata2[0][63]
> redshift_error = specdata2[0][64]
> 
> used to work fine. In the case of (1) above, it does. In the case of (2)
> it just produces junk. I used the formulation for a large number of
> files from DR12
> 
> FWIW I am running Python 3.7 over Ubuntu 18.04. I think that is probably
> irrelevant as a colleague who is running in another configuration has
> the same sort of problem
> 
> Any ideas why?
> 
> It seems that there might be the following reasons:
> 
> (i) there is a change in the formats (somewhere) in DR15
> 
> (ii) something has changed in the way io.fits treats some HDUs that I
> have missed.
> 
> Is there perhaps a cleaner way of getting this info?
> 
> I have posted this to the Skyserver Helpdesk without any response. Am
> happy to take this offline if people want.
> 
> Thanks for any help,
> 
> Peter
> 
> 
> 

-- 
*************************
John Parejko
parejkoj at uw.edu
http://staff.washington.edu/parejkoj/
Department of Physics and Astronomy
University of Washington
Seattle, WA
**************************


More information about the AstroPy mailing list