View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Conversion of fits to txt

shruthi wrote on Jun 19, 2015


Hello everyone,

I am having trouble converting my spectra which is in fits to txt file.

I used wspectext but what I want is instead of wavelength, I want velocity.

So description of what I am doing:

1. splot the spectra.fits

2. used keystroke v to convert the wavelength to velocity scale

3. save the new spectra in velocity scale as new_spectra.fits

4. changing from fits to txt as

wspectext new_spectra.fits new_spectra.txt

Finally I find that the .txt file still has wavelength instead of velocity!

Please anyone, I need some help..

Thank you in advance.


Mike Fitzpatrick wrote on Jun 19, 2015


I haven't tried it myself yet, but I think you need to first run the DISPTRANS task to convert the dispersion units in the header before printing it out with WSPECTEXT. The 'v' key in SPLOT essentially just changes the plot axes.


shruthi wrote on Jun 19, 2015


Ok so can I do just the below command to convert to velocity scale?

disptrans spectra.fits new_spectra.fits km/s

Thank you for the reply


Mike Fitzpatrick wrote on Jun 19, 2015


See the help pages for both DISPTRANS and SPLOT for their discussion of velocity units. For velocity you need to also specify the velocity zero point, e.g.

cl> disptrans old.fits new.fits "km/s 1 micron"

would define 1 micron as the zero point. Note the quotes around the entire unit string so it isn't taken as separate arguments.

shruthi wrote on Jun 19, 2015


Ok so if I want to keep my H-alpha line as the zero-point then i give

disptrans spectra.fits new_spectra.fits "km/s 6563 angstroms"

Hope I have understood it right.


shruthi wrote on Jun 19, 2015


Thanks a ton. I tried and it worked.

So finally I am able to get text file with velocity terms.

Thank you

Last post on Jun 19, 2015