Welcome to iraf.net Wednesday, May 01 2024 @ 10:33 PM GMT
sw |
04/16/2008 09:31PM (Read 2520 times)
|
|
|
Status: offline
Registered: 11/03/2007
Posts: 15
|
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:
[code:1:d740cf18de]
tabpar(table="foobar", column=1, row=1)
print(tabpar.value)
[/code:1:d740cf18de]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
|
|
|
|
fitz |
04/16/2008 09:31PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
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
|
|
|
|
sw |
04/16/2008 09:31PM
|
|
|
Status: offline
Registered: 11/03/2007
Posts: 15
|
Thanks for explaining.It wasn't a typo though. Other values don't seem to add up either according to x+y/60For instance:555:555 gives 564:15.0 instead of 564.25
111:111 gives 112:51.0 instead of 112.85Actually 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 othersAnyway, I'll just work around it. Good to know it isn't a bug.Thanks,Sam
|
|
|
|
fitz |
04/16/2008 09:31PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
[quote:eaa0bf36de]555:555 gives 564:15.0 instead of 564.25[/quote:eaa0bf36de]That may be a quirk/bug in TABPAR, the CL evaluation gives the correct floating-point value, e.g.[code:1:eaa0bf36de]cl> =555:555
564.25[/code:1:eaa0bf36de]You have a workaround, but STScI is still responsible for the TABLES package (i.e. write help@stsci.edu to report it).-Mike
|
|
|
|
sw |
04/16/2008 09:31PM
|
|
|
Status: offline
Registered: 11/03/2007
Posts: 15
|
[quote:c78a20f73f]You have a workaround, but STScI is still responsible for the TABLES package (i.e. write help@stsci.edu to report it). [/quote:c78a20f73f]I've sent them a report.Thanks,Sam
|
|
|
|
| |
|
Content generated in: 0.13 seconds |
|