View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Creating a new Task

Lianne wrote on Nov 26, 2008

I'm trying to create a new task in Iraf. I have been given a script

procedure markit (reffile)

string reffile
string *flist

begin
flist = reffile

while ( fscan (flist, s1) != EOF ) {

if (access (s1) ) {
print ('Displaying ',s1 )
disp (s1, 1)
tvmark (1, s1//".mark", col=205, interactive=yes)
}
;
}

end



I put this into notepad++ and saved it into the directory where I am working on my images. I called it markit.cl. Then in iraf I used the command to make the task.

cl> task $markit = markit.cl

which works, then when I'm trying to call the task I get the following error:

cl> markit
**: begin
^
ERROR: syntax error, line 6
called as: 'markit ()'

Any help would be much appreciated.

Mike Fitzpatrick wrote on Nov 26, 2008

Because the task has parameters (i.e. arguments in the procedure declaration, more generally, anything before the 'begin'), you must declare it without the '$', e.g.

task markit = /path/markit.cl


As for the syntax error, I think notepad may have put some control characters in the file that are causing the problem, the script runs fine for me (file created with 'vi').

-Mike

Lianne wrote on Nov 26, 2008

Mike,

Ok, I changed the editor to vim, and entered the command

task markit = /iraf/markit.cl

There is now an error that comes up saying...

ERROR: task 'markit' has no param file

Thanks!
Lianne

Mike Fitzpatrick wrote on Nov 26, 2008

Do an "cl> unlearn markit" before running the task, its still using the param definition from the first time that lives in your uparm directory.

Lianne wrote on Nov 26, 2008

Ok, i did that, then logged out of iraf, then logged back in. Then I did it again
cl> unlearn markit

and it came back with:
ERROR: task 'markit' not found
called as: 'unlearn markit ()'

so I then created it again.

cl> task markit = markit.cl

and again it came up with no param file.

Mike Fitzpatrick wrote on Nov 26, 2008

cl> task markit = markit.cl


Is markit.cl in the current directory or in /iraf/markit.cl as in your last post? Since the parameters are part of the script, a 'has no param file' could also mean the script doesn't exist where the task declaration said it lives (which is the current directory if you don't specify a path).

Lianne wrote on Nov 26, 2008

The markit.cl file is in the current directory.

Mike Fitzpatrick wrote on Nov 26, 2008

Did you do the 'unlearn' after the 'task' statement? Did you change directories after declaring the task?

Lianne wrote on Nov 26, 2008

I did unlearn before the task statement, and I've been in the same directory for everything.

Last post on Nov 26, 2008