[AstroPy] Extend io.fits class to support wavelength vector?

Michael Droettboom mdroe at stsci.edu
Tue Jul 7 11:44:34 EDT 2015


I think you probably want to look at the `astropy.wcs` package which 
handles the conversion from raw values to physical values and back based 
on a FITS header.

Mike

On 07/07/2015 11:10 AM, Leonard Burtscher wrote:
> 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
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy




More information about the AstroPy mailing list