tabpar bug?
sw wrote on Apr 16, 2008
I'm using tabpar to extract something from a file. Normally this works fine, but when I'm extracting something that is number-colon-number it doesn't.
For example: I have a file named foobar. This file contains only "123:456" (without quotes).
Using the code:
I get the result: "130:36.0"
Why does this not print out "123:456"?
This happens for any number-colon-number situation. Is there some reason why this should happen?
Thanks,
Sam
For example: I have a file named foobar. This file contains only "123:456" (without quotes).
Using the code:
tabpar(table="foobar", column=1, row=1)
print(tabpar.value)
I get the result: "130:36.0"
Why does this not print out "123:456"?
This happens for any number-colon-number situation. Is there some reason why this should happen?
Thanks,
Sam
Mike Fitzpatrick wrote on Apr 16, 2008
The CL is interpreting the value 123:456 as a sexagesimal number, and so converts it to real as "123.0 + 456.0/60." The result is 130.6 (I assume your 123.36 is a typo), to work around it you need to quote the value.
-Mike
-Mike
sw wrote on Apr 16, 2008
Thanks for explaining.
It wasn't a typo though. Other values don't seem to add up either according to x+y/60
For instance:
555:555 gives 564:15.0 instead of 564.25
111:111 gives 112:51.0 instead of 112.85
Actually now that I've written this I can see what's happening. The value IRAF outputs (in the 555:555 example) is 564:15.0
15.0/60=0.25 so it must be printing the decimal part to base 60 while the main number is real. Same thing for the others
Anyway, I'll just work around it. Good to know it isn't a bug.
Thanks,
Sam
It wasn't a typo though. Other values don't seem to add up either according to x+y/60
For instance:
555:555 gives 564:15.0 instead of 564.25
111:111 gives 112:51.0 instead of 112.85
Actually now that I've written this I can see what's happening. The value IRAF outputs (in the 555:555 example) is 564:15.0
15.0/60=0.25 so it must be printing the decimal part to base 60 while the main number is real. Same thing for the others
Anyway, I'll just work around it. Good to know it isn't a bug.
Thanks,
Sam
Mike Fitzpatrick wrote on Apr 16, 2008
555:555 gives 564:15.0 instead of 564.25
That may be a quirk/bug in TABPAR, the CL evaluation gives the correct floating-point value, e.g.
cl> =555:555
564.25You have a workaround, but STScI is still responsible for the TABLES package (i.e. write help@stsci.edu to report it).
-Mike
sw wrote on Apr 16, 2008
You have a workaround, but STScI is still responsible for the TABLES package (i.e. write help@stsci.edu to report it).
I've sent them a report.
Thanks,
Sam
Last post on Apr 16, 2008