Welcome to iraf.net Tuesday, April 30 2024 @ 10:40 AM GMT
The Big H |
12/16/2009 03:33AM (Read 1415 times)
|
|
|
Status: offline
Registered: 12/13/2009
Posts: 3
|
I have to perform a large number of repetitive tasks on a large number of files. Basically I have to do the following:imcopy DataFile[0][*,XX].fits SingleXX.fits
program1 SingleXX.fits
{inputs that program1 will prompt me for}
program2 SingleXX.fitsThe commands, including the inputs to program1, will be the same every time except that XX will change (it's a different 2 or 3 digit number each time).Is there a way I can store all these commands, including the inputs to program 1, in a single file that I can then call repeatedly. Basically I want to be able to enter something like "do 68", and it will copy column 68 out of the data file into the file Single68.fits and then run program1 on Single68.fits, enter all the inputs for program1, and then run program2 on Single68.fits. Is this possible?
|
|
|
|
fitz |
12/16/2009 03:33AM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
This is exactly what scripting is for, see the Script Guide to get started (https://iraf.net/irafdocs/script/).Some details will depend on exactly what 'program1' is and how it takes input, let's assume a simple redirected text file would do: The 'do' script (called 'do.cl') would then look something like[code:1:ef443fc0a3]
procedure do (num)int num { prompt = "column number" }begin
string data, single
int lnum lnum = num # make local copy to avoid prompts
data = "DataFile[0][*," // lnum // ".fits"
single = "Single" // lnum // ".fits" imcopy (data, single)
program1 (single, << "p1.txt")
program2 (single)
end
[/code:1:ef443fc0a3]At the CL prompt you would then declare the task as[code:1:ef443fc0a3]cl> task do = /path/do.cl[/code:1:ef443fc0a3]and then execute using "do 68" as you suggest. Note that if you add or change parameters (any variable declared before the 'begin') you'll need to unlearn the parameters (i.e. "cl> unlearn do") to pick up the change.-Mike
|
|
|
|
| |
|
Content generated in: 0.08 seconds |
|