Welcome to iraf.net Tuesday, April 16 2024 @ 08:58 AM GMT


 Forum Index > Help Desk > Systems New Topic Post Reply
 Problem with apparently simple CL script
   
srwalton
 02/07/2006 05:11PM (Read 4811 times)  
+----
Newbie

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.

 
Profile Email Website
 Quote
pyrafuser
 02/07/2006 05:11PM  
+----
Newbie

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.

 
Profile Email
 Quote
fitz
 02/07/2006 05:11PM  
AAAAA
Admin

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

 
Profile Email
 Quote
   
Content generated in: 0.12 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login