View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

a simple question about printing variables

rkbarry wrote on Mar 20, 2008

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 image

begin
...
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 following

findcenter("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

:? :?

rkbarry wrote on Mar 20, 2008

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 image

There 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:

rkbarry wrote on Mar 20, 2008

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:

Mike Fitzpatrick wrote on Mar 20, 2008

I assume that my question is too simple and stupid for folks to bother with.


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:

print ("drizzle (\"", image, " \", \"psf_test.fits\" , outweig = \"test_test_outweig.fits \" , xsh = 30.5 -", x, ", ysh = 30.5- ",y , " )") 


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

cl> task $findcenter = findcenter.cl


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

rkbarry wrote on Mar 20, 2008

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! :(

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. Is the situation that CL has been simply abandoned for Pyraf? Should I, too, abandon it?

Mike, thanks for the help.

Mike Fitzpatrick wrote on Mar 20, 2008

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.


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.

Is the situation that CL has been simply abandoned for Pyraf? Should I, too, abandon it?


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]

rkbarry wrote on Mar 20, 2008

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.

Mike Fitzpatrick wrote on Mar 20, 2008

See http://iraf.net/irafdocs/script/ (PDF available at http://iraf.net/irafdocs/script.pdf )

-Mike

Last post on Mar 20, 2008