View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

How to Change String to Number in table

SongHuang wrote on Aug 05, 2009

Hi

I met a problem when I tried to rebin some spectra in text format.

The format is like :

Wavelength Flux
1000 1.000E29
1005 1.0100E29
...... ........

But when I tried to rebin them by the trebin task, the Flux column was treated like a string, so it was ignored.

I tried to use rtext to change the format to fits, but the same problem exist.

So is there anyway to change the format from string to real number, or let iraf read columns from table in certain format like FORTRAN ?

Thanks a lot

Best Wishes

Yours Quietskies

Jason Quinn wrote on Aug 05, 2009

Quietskies


So is there anyway to change the format from string to real number, or let iraf read columns from table in certain format like FORTRAN ?


The scan command is what you are looking for. Do a "help scan" and example 2 shows you how to use print in combination with scan to achieve a result similar to what you want.

Jason

Last post on Aug 05, 2009