View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Another question about scombine

lsh20 wrote on Apr 18, 2006

Hi Mike,
if i have 200 spectrums,and i want to combine them to 100 spectrums,two combine to one. Can i use a @file to be a input file? If i can, how can i write the @ file? thank you

Mike Fitzpatrick wrote on Apr 18, 2006

Lishen,

You can't really do it with a single command, you'll need to repeatedly call scombine on groups of the two spectra you want to combine until you process the entire set. The easiest way to do this depends on the image names to some extent.

In the simplest case let's assume you can create a text file called 'cmds.txt' containing all the commands you want to run, e.g. something like

scombine blue001,red001 combined001
scombine blue002,red002 combined002
: : :

You could then execute all the commands as simply

cl < cmds.txt

Various unix tools could be use to build this file, there is also the FIELDS and JOINLINES tasks in iraf to split/combine lists and tables.

Another method would be to create a list of the input and output image names, e.g. in 'files.txt' something like

blue001 red001 combined001
blue002 red002 combined002
: : :

Then you could write a small loop to read the file and run scombine, e.g.

cl> list = "files.txt"
cl> while (fscan (list, s1, s2, s3) != EOF) {
>> scombine (s1//","//s2, s3)
>> }

where the variables s1/s2/s3 are the filenames on each line, and the scombine call uses the "//" string concatenation operator to create the input image list. Tasks file FILES can expand a template like "blue*" into a list of matching files, and JOINLINES can combine two lists, etc.

See the Script Programmer's Guide (http://iraf.net/irafdocs/script/) for more about processing in loops and syntax needed. Hope this helps.

Cheers,
-Mike

Last post on Apr 18, 2006