Joined: 05 Dec 2005 Posts: 32 Location: Gainesville
Posted: Wed May 24, 2006 7:04 pm Post subject: Writing tasks that accept lists and wildcards
What is the trick to allow a task to accept wildcards like file*imh or @filelist?
I have written a very basic task that just passes arguments to another iraf task. I call it qcont and it just takes the file, does a continuum on it with a 1st order spline3 and makes the output file_norm. It works like a charm on one file, but it's unclear to me how I alter the task to accept a list of files... any help or pointers would be appreciated.
I assume we're talking about a CL script? If so the trick is to use something like the SECTIONS (or FILES if it isn't an image) task to expand the template, e.g.
list = imgfile
while (fscan (list, img) != EOF) {
.....stuff
}
end
Note some tasks already take image lists and you can just pass it through, other tasks (or pure sccript code) however don't and you need to loop like this.
Joined: 05 Dec 2005 Posts: 32 Location: Gainesville
Posted: Wed May 31, 2006 6:23 pm Post subject:
Thanks. That's pretty much what I was asking ... I just wanted to be able to add the @list functionality that most tasks have. And yes, it was a cl script I had written, so the input was just a string, the file name.
I've written cl scripts that accept lists using the fscan loop like you mentioned, but then the input has to be a list, so I'm guessing the "is it a list or is it a file" determination based on whether the @ is there or not is just a matter of parsing the string and using if statements to handle the file as either an image or a list?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum