Welcome to iraf.net Friday, May 17 2024 @ 02:41 AM GMT


 Forum Index > Help Desk > Systems New Topic Post Reply
 Writing tasks that accept lists and wildcards
   
sirmarcos
 05/24/2006 07:04PM (Read 5159 times)  
++---
Junior

Status: offline


Registered: 12/05/2005
Posts: 32
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.

The re-born Mac IRAF web site: http://macsingularity.org
 
Profile Email Website
 Quote
fitz
 05/24/2006 07:04PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Hi Marcos,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.[code:1:6e1c0ba3ae]
procedure qcont (images)string images { prompt = "Image list" }begin
string imgfile, img # Exapnd image template
imgfile = mktemp ("tmp$qcont") # get temp file
sections (images, opt="full", > imgfile) list = imgfile
while (fscan (list, img) != EOF) {
.....stuff
}
end
[/code:1:6e1c0ba3ae]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.Cheers,
-Mike

 
Profile Email
 Quote
sirmarcos
 05/24/2006 07:04PM  
++---
Junior

Status: offline


Registered: 12/05/2005
Posts: 32
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?

The re-born Mac IRAF web site: http://macsingularity.org
 
Profile Email Website
 Quote
fitz
 05/24/2006 07:04PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
The SECTIONS task will expand file templates and @files automatically, i.e.sections foo.fits
sections @flist
sections foo*.fitswill expand the single file name, the contents of the @file, or the wildcard template. Note however thatsection flistwill return just 'flist' and not the expanded contents as if you'd used '@flist'.-Mike

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