Welcome to iraf.net Thursday, April 18 2024 @ 06:38 PM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 a simple question about printing variables
   
rkbarry
 03/20/2008 07:03PM (Read 3889 times)  
+----
Newbie

Status: offline


Registered: 02/04/2008
Posts: 6
Hi, fellow iraffers.I have a simple question. I am attempting to pass a parameter to a program in CL. When I do this, and execute the program, it comes back and asks for the value of the parameter I am passing in. To be specific, the bits of code that come in to play are:procedure findcenter(image)
file imagebegin
...
x = real(tabpar.value)
y = real(tabpar.value)print ("drizzle (\"", image, " \", \"psf_test.fits\" , outweig = \"test_test_outweig.fits \" , xsh = 30.5 -", x, ", ysh = 30.5- ",y , " )")end
I call a program named findcenter.cl using the followingfindcenter("test.fits")at the prompt iraf responds with image:If I type in any string, say "junkola" <ret> the output of the print statement is drizzle ("junkola ", "psf_test.fits" , outweig = "test_test_outweig.fits " , xsh = 30.5 -30.88968 , ysh = 30.5- 34.40352 )What is puzzling is that the values of the variables x and y are passed to the print statement and output properly. Yet, the value of the variable "image" is not. This sort of interactivity is okay for dealing with one or two files, but I have thousands!Haaaaallllpp!I would be grateful for help. Thanks in advance.
Rich Confused Confused

 
Profile Email
 Quote
rkbarry
 03/20/2008 07:03PM  
+----
Newbie

Status: offline


Registered: 02/04/2008
Posts: 6
Oh, and another thing. I have tried several versions of the declaration before the begin statement. I tried:file image{mode = hidden}
file image{"junk.fits", mode = hidden}
# file imageThere must be some way to keep this thing from coming back and asking me for the file name after I have already given it as an input parameter!Thanks. Cry

 
Profile Email
 Quote
rkbarry
 03/20/2008 07:03PM  
+----
Newbie

Status: offline


Registered: 02/04/2008
Posts: 6
I assume that my question is too simple and stupid for folks to bother with. I'm just a N00B and am pretty stuck. I'd appreciate your help! Oops!

 
Profile Email
 Quote
fitz
 03/20/2008 07:03PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
[quote:41e73a3d82]I assume that my question is too simple and stupid for folks to bother with. [/quote:41e73a3d82]Patience. A 24-hour reply from a user-based support line is better than most.I'm not sure there's enough information here but I don't want to debug the whole script. A few issues w/ the code snippets:[code:1:41e73a3d82]print ("drizzle (\"", image, " \", \"psf_test.fits\" , outweig = \"test_test_outweig.fits \" , xsh = 30.5 -", x, ", ysh = 30.5- ",y , " )") [/code:1:41e73a3d82]The space after the image name, but inside the quotes, will mean the script will try to access the filename using the space in the name. The xsh/ysh params are multiple values not enclosed in quotes -- are these meant to be expression you want evaluated, the parameters are simple floating point values and I don't understand the '30.5'.Otherwise, how was the script task declared? A declaration with a leading '$' such as[code:1:41e73a3d82]cl> task $findcenter = findcenter.cl[/code:1:41e73a3d82]means the task has no parameters, without the '$' the task has parameters. A parameter is anything between the 'procedure' and 'begin' statement; A query parameter is one of the arguments in the procedure call, all others are hidden params. Hidden params should supply a default value, query params will be prompted for when not on the command-line or when used with a null value (e.g. the value is reset in the script). Does an 'cl> lpar findcenter' show that the task has params? Note that when you change the type of task declaration you'll need to do an 'unlearn' of the task to reset the params. Hope this helps.Cheers,
-Mike

 
Profile Email
 Quote
rkbarry
 03/20/2008 07:03PM  
+----
Newbie

Status: offline


Registered: 02/04/2008
Posts: 6
I'm sorry if I sounded peevish. I *really* didn't mean to. I, being a rank beginner, assumed that my question was indeed a dumb question and that everyone was laughing at the imbecile that asked it. Again, my apologies.
Okay, THAT did it. I just redeclared findcenter without the $ and it works. Now, in reading back through the documentation for CL (such as it is) I don't see this. I'm sure it is because I didn't look in the right place. Oh, I feel like such a dunce! FrownCould someone please direct me to the correct user guide for CL? I have found two so far. They both are "Draft" versions and they are 10 and 20 years out of date. Is the situation that CL has been simply abandoned for Pyraf? Should I, too, abandon it?Mike, thanks for the help.

 
Profile Email
 Quote
fitz
 03/20/2008 07:03PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
[quote:383ab43214]Could someone please direct me to the correct user guide for CL? I have found two so far. They both are "Draft" versions and they are 10 and 20 years out of date.[/quote:383ab43214]These were the original design documents. I suspect what you want is the 'CL Script Programmer's Guide' (old but still useful) available from the 'Introductory Docs' on docs.iraf.net. [quote:383ab43214]Is the situation that CL has been simply abandoned for Pyraf? Should I, too, abandon it? [/quote:383ab43214]The CL is far from abandoned, Pyraf is simply an alternative commandline environment but is required for some new applications from STScI (and soon Gemini). It's up to you which you use, the usual gripes against CL about lack of error handling, backspace and history editing were fixed years ago.-Mike [/quote]

 
Profile Email
 Quote
rkbarry
 03/20/2008 07:03PM  
+----
Newbie

Status: offline


Registered: 02/04/2008
Posts: 6
These were the original design documents. I suspect what you want is the 'CL Script Programmer's Guide' (old but still useful) available from the 'Introductory Docs' on docs.iraf.net.
Thanks. But I don't see this one. The two documents I have are from 1993 and 1986. They don't seem to have the $ trick in them.

 
Profile Email
 Quote
fitz
 03/20/2008 07:03PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
See https://iraf.net/irafdocs/script/ (PDF available at https://iraf.net/irafdocs/script.pdf )-Mike

 
Profile Email
 Quote
   
Content generated in: 0.31 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