arg - replicate template script while substituting markers
arg inputs template [marker] [nlines]
- inputs = ""
- Name of file with substitution values or strings, one per line, to substitute
for 'marker' in the 'template' script
- template = ""
- Name of the template script
- marker = "&"
- Marker character or character-sequence representing the values or strings to
be read from 'inputs'
- nlines = 0
- Number of lines from the template script to replicate for each line read from
'inputs'; when 'nlines = 0', the entire template is replicated for each line
'Arg' is a program to facilitate writing long scripts where the same
command or set of commands is to be repeated for a large number of
non-trivial input values (e.g., list of image names, list of numeric
values, etc..). Using 'arg', one only needs to write a template script
once, in which the variable input is represented by a unique marker
character or character sequence (e.g., "&", "%", "@1", "@2", etc.) that
is not used in the script to denote anything other than that variable
input. If 'nlines' is other than 0, the template script must have
'nlines' times the number of lines in the substitutions list. When
'nlines = 0', commented lines (starting with a '#') in the template
script are skipped and omitted from the output. Output will be to the
standard output, but may be redirected to a file.
Note that this task is a wrapper around a unix program 'arg' (which may
also be installed outside of the iraf system, e.g. in /usr/local/bin )
and that it may be necessary to escape certain marker characters from
the IRAF CL and/or from the Unix shell in order to properly pass them to
'arg' (e.g. "\&" instead of "&").
1. We constructed a super dark image and associated sigma image by
combining the dark frames from several observing runs with the same CCD
camera. For the individual runs we then construct master dark images by
replacing pixels in a copy of that super dark that differ more than 3
sigma from the mean in a contemporaneous dark by values taken from that
contemporaneous dark in order to account for systematic changes over
time. The mean of the super dark frame is 0.183; the ampersands ('&')
in "script.tem" will be replaced by the observing run identifier ('Nov01',
'Feb02', etc..) and the percentage signs ('%') in "expr.tem" will be
replaced with mean value of the dark frame of a run that is determined
"on the fly".
rj> type script.tem
imstat ("&/DARK.fits[256:768,256:768]", fields="mean", lower=INDEF,
upper=INDEF, format-, > "tmp.stat")
arg ("tmp.stat", "expr.tem", marker="%", nlines=1, > "imcalc.expr")
delete ("tmp.stat,imcalc.expr", yes, verify-)
rj> type expr.tem
if ( abs( im1 - 0.183 - ( im3 - % ) ) > 3*abs(im2) ) then
( im1 - 0.183 + % )
rj> type runs.lis
rj> arg runs.lis script.tem nl=0 > script.cl
rj> cl < script.cl