Welcome to iraf.net Friday, April 26 2024 @ 12:58 PM GMT
srwalton |
02/07/2006 05:11PM (Read 4813 times)
|
|
|
Status: offline
Registered: 12/08/2005
Posts: 2
|
Hello. I ran the apparently simple script which follows:minmax('tmp_image', verbose=no, update=no, force=yes)
=minmax.minval
if (real(minmax.minval) < 0) {
imarith('tmp_image', '+', real(minmax.minval), 'tmp_image')
}by putting these lines into a file called 't.cl' and doingcl> cl < t.clThe "=minmax.minval" prints out -295. but the IF is not taken. What am I doing wrong? I have tried adding and removing the real() function call around minmax.minval, and adding 'cache minmax' to the top of the script, but these changes make no difference.
|
|
|
|
pyrafuser |
02/07/2006 05:11PM
|
|
|
Status: offline
Registered: 01/30/2006
Posts: 4
|
It's a hack, but if you add a print statement (ie print "") at the end of your script, it should work.
|
|
|
|
fitz |
02/07/2006 05:11PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
Think of the cl redirection as just a way of redirecting your keyboard input, then try simply typing your script in at the CL prompt to see what's going on. You'll notice that after you get to the closing brace of the 'if' the CL prompts again with the ">>>" indicating it is expecting more input. When redirecting it sees the EOF and so doesn't compile the block, what it is actually expecting is some token to tell it that the 'if' is complete or is part of an 'if-else' block. The hack print stmt from pyrafuser terminates the if block, the more common trick people have learned over the years is to terminate an if with a ';'. Note you can accomplish the same thing with IMEXPR, e.g. minmax ('tmp1', update+, force+)
imexpr ("(a<0)?(a+b):a", 'tmp2', a='tmp1', b=a.i_minpixval)This costs an extra temp image and is somtimes a no-op but I mention it FYI.
Also, if you are simply trying to shift all the values to be ositive then I think you want "abs(minpix)" in the expression, otherwise you're effectively subtracting the negative min value from everything.-Mike
|
|
|
|
| |
|
Content generated in: 0.13 seconds |
|