Using defpac function
figueira wrote on Jan 15, 2007
Hello!
I'm trying to make my reduction programs a little bit robust in order to share them with my team members. I'm starting to use tasks such as "defpac" in my scripts and I have a few problems.
Here is my file for "def_test.cl"
def_test.cl:
#######################################################################
# start task with
# task $def_test ="/Users/pedrofigueira/iraf/scripts/DRACS/def_test.cl"
#######################################################################
if (! defpac("images.imutil")) {
print("Package not present.")
bye
}
;
imheader.longheader=yes
EOF
It exhibits a strange behaviour. When I run it, it enters in the if block even if I have the package loaded. Why is this? Am I using correctly the defpac task? I really don't understand it...
I am using IRAF2.13 in a macintel.
All the best and thank you for the help!
Pedro Figueira
I'm trying to make my reduction programs a little bit robust in order to share them with my team members. I'm starting to use tasks such as "defpac" in my scripts and I have a few problems.
Here is my file for "def_test.cl"
def_test.cl:
#######################################################################
# start task with
# task $def_test ="/Users/pedrofigueira/iraf/scripts/DRACS/def_test.cl"
#######################################################################
if (! defpac("images.imutil")) {
print("Package not present.")
bye
}
;
imheader.longheader=yes
EOF
It exhibits a strange behaviour. When I run it, it enters in the if block even if I have the package loaded. Why is this? Am I using correctly the defpac task? I really don't understand it...
I am using IRAF2.13 in a macintel.
All the best and thank you for the help!
Pedro Figueira
Mike Fitzpatrick wrote on Jan 15, 2007
The defpac() function is expecting only the package name, not the path to the package, e.g. "if (! defpac('imutil')" should do what you want. Note that packages are loaded by default both in your login.cl file and perhaps in other package loading scripts (i.e. 'images' is loaded by login.cl, 'imutil' is then loaded automatically when IMAGES is loaded).
Cheers,
-Mike
Cheers,
-Mike
figueira wrote on Jan 15, 2007
Thank you for the advice. I'm realyy sorry to be such a die-harder, but it still doesn't work. I'll show you how I use it and the errors that ocurred.
ecl> task $def_test ="/Users/pedrofigueira/iraf/scripts/DRACS/def_test.cl"
ecl> def_test
** Syntax error, line 6
**: if (! defpac("imutil")) {
^
Package not present.
ecl> imheader.longheader=yes
ecl>
As you see the package was loaded (as we can confirm from the last command on the command line) but the task execution gave a strange error and printed the message as if it wasn't.
Do you have any other ideas?
Anyway, thank you very much for your effort.
All the best,
Pedro
ecl> task $def_test ="/Users/pedrofigueira/iraf/scripts/DRACS/def_test.cl"
ecl> def_test
** Syntax error, line 6
**: if (! defpac("imutil")) {
^
Package not present.
ecl> imheader.longheader=yes
ecl>
As you see the package was loaded (as we can confirm from the last command on the command line) but the task execution gave a strange error and printed the message as if it wasn't.
Do you have any other ideas?
Anyway, thank you very much for your effort.
All the best,
Pedro
Mike Fitzpatrick wrote on Jan 15, 2007
Try using
-Mike
if (defpac("images") == no) ......, I'm not quite sure why the '!' isn't being accepted.-Mike
figueira wrote on Jan 15, 2007
Excellent, it worked! I think I understand what you mean.
But note that I followed this programming schemme because I found it in the document:
An Introductory Userâs Guide to IRAF Scripts, by Ed Anderson (page 21)
Thank you very much!
Pedro
But note that I followed this programming schemme because I found it in the document:
An Introductory Userâs Guide to IRAF Scripts, by Ed Anderson (page 21)
Thank you very much!
Pedro
Last post on Jan 15, 2007