How to read in IRAF multispec spectra?

折月煮酒 提交于 2021-02-20 18:53:45

问题


I have a spectrum in a fits file that I generated with Iraf. The wavelength axis is encoded in the header as:

WAT0_001= 'system=multispec'
WAT1_001= 'wtype=multispec label=Wavelength units=angstroms'
WAT2_001= 'wtype=multispec spec1 = "1 1 2 1. 2.1919422441886 4200 0. 452.53 471'
WAT3_001= 'wtype=linear'
WAT2_002= '.60 1. 0. 3 3 1. 4200.00000000001 1313.88904209266 1365.65012876239 '
WAT2_003= '1422.67911152069 1479.0560707956 1535.24082980747 1584.94609332243'

Is there an easy way to load this into python?


回答1:


I have been using this code, which was given to me by Rick White. However, the specutils package is probably the better way to do it:

from specutils.io import read_fits
spectra_list = read_fits.read_fits_spectrum1d('mymultispec.fits')
print spectra_list[0]
   Spectrum1D([ 338.06109619,  395.59234619,  326.0012207 , ...,
         660.0098877 ,  686.54498291,  689.58374023])

print spectra_list[1].dispersion
   <Quantity [ 8293.44875263, 8293.40459999, 8293.36044556,...,
        8166.53073537, 8166.48250242, 8166.43426803] Angstrom>


来源:https://stackoverflow.com/questions/29923315/how-to-read-in-iraf-multispec-spectra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!