[AstroPy] Extend io.fits class to support wavelength vector?
Leonard Burtscher
burtscher at mpe.mpg.de
Tue Jul 7 11:10:32 EDT 2015
Hi,
I'm new to this list, but reasonably sure that this question hasn't been asked the last year or so.
When opening a FITS file that includes a spectrum I would like to directly have access to the wavelength vector and store it in a variable, e.g.
hdu=fits.open("test.fits",ext=2,wave=wave)
where
hdr=hdu[2].header
wave=(np.arange(hdr['NAXISi'])+1-hdr['CRPIXi'])*hdr['CDELTi']+hdr['CRVALi']
and
i is chosen such that CTYPEi=="WAVE". The unit is given by CUNITi and could be converted by default to e.g. meters. In case of more than one WAVE axis or missing header information, a warning should be given and the routine could fall back to the usual behaviour without constructing the wavelength vector.
Since this is a very generically used functionality, wouldn't it make sense to implement this into the core of the astropy package?
Cheers,
Leo
More information about the AstroPy
mailing list