View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Re: arithmetic with text files?

joshjturner wrote on Sep 13, 2006

Hi -

Just a quick question that may not be a good one. Is there a way to divide every entry in a text file or a list by a string? In other words, I have a script that gives me a list of numbers that I want to plot, but I have to normalize by a number (that I have written to another text file), so I've been painfully doing it by hand becaue I can't find an easier way using IRAF. imarith only works on images, but I want to do the same thing basically using lists. Thanks!

Josh

Mike Fitzpatrick wrote on Sep 13, 2006

See the TCALC task in the TABLES.TOOLS package.

If what you have is a file with some numbers and you want to divide each by a constant:


list = "numbers.txt"
while (fscan (list, x) != EOF) {
    print ((x / 3.14159))
}


Cheers,
-Mike

Last post on Sep 13, 2006