rdgen
First produced: 14 April 2003
Last modified: 15 April 2003
multiprocess  - repeat operations on a set

This rather obscure command is designed to multiprocess a list of files in the same way, allowing the possibility of output files based on the input file list. The command line is

mu(lti..) <filelist> <command list>

where <filelist> is the name of a file containing a list of files (one per line) on which the commands are to be applied, and <command list> is the name of a file which contains a list of rdgen commands. If the filenames are omitted they are prompted for. In the command list, the sequence $$$$ is replaced by each of the filenames in turn, and the commands applied. If the filenames have an extension, (i.e. anything after a last ".") this is stripped off for the second and subsequent appearance of $$$$ in the command list.

So, for example, if you have lists of ions, redshifts, Doppler parameters and column densities from e.g. VPFIT, then you can create a set of fake spectra with a given S/N by the file list (set.lis in the example here) containing

set1.dat
set2.dat
set3.dat
...
setn.dat

and the command list file (template.txt) might contain

un                                        (set continuum to unity)
gp                                        (generate line profiles)
$$$$                                      ( .. with parameters from this file)
6.7                                       ( .. and FWHM resolution 6.7 km/s)
no                                        (add noise to the continuum -> workspace)
0                                         ( .. random number seed from time of day!)
50.0                                      ( .. S/N in resultant spectrum)
wr $$$$.fits                              (write result to fits file)

Then, entering into rdgen the sequence:

wl 3300.0 0.025 80000                     (to set the wavelength scale and length)
mu set.lis template.txt
ex                                        (exit program)

is equivalent to:

wl 3300.0 0.025 80000
un
gp
set1.dat
6.7
no
0
50.0
wr set1.fits
un
gp
set2.dat
6.7
no
0
50.0
wr set2.fits
un
gp set3.dat
.....
.....
no
0
50.
wr setn.fits
ex

The files set1.fits, set2.fits ... will appear in your filespace.The main gain with mu is that you don't have to enter all the same commands, or cut and paste them in with minor edits. So you can see what you have done, the full expanded list is in a file called tempjunk.tmp, which you can delete or leave - it is overwritten next time this function is used.

There are some restrictions:

The command list file must be < 80 lines long, and each line < 80 characters. Anything beyond is lost.

The filelist may not contain spaces, so you can't have $$$$ replaced by commands with parameters. Note also that for all but the first use, anything after the last "." in a filename is stripped off, so it is not a good idea to have a list like set.1, set.2, set.3 ... (one per line). What will happen then is the write in the example above will got to set.fits, and only the first one will succeed. Subsequent attempts will fail because the file already exists.

Some commands don't allow redirection in this way, so if the program stops waiting for keyboard input you'll need to enter it (and make sure the filed sequence has not started to do silly things). Examples are prompts for pgplot device, and prompts for filename if you enter wr without the filename on the command line.