Up Next
Go up to 7 Tcl functions for implementing wavefront reconstruction
Go forward to 7.2 ef_seq and related commands.

7.1 An example batch file.

A batch version of the ef program is supplied with the distribution. This can be very useful if you have large amounts of data to reduce, or would like to use the program in a repetitive manner.

The following code segment shows a very simple batch file which reduces the data from 1 pair of extra-focal images and writes the results of date reduction to an output file.

You will find a similar batch file to this in the example directory of the ef documentation. If you copy all of the files in this directory to a directory where you have write permission, you may run the batch file. To run the batch file type the following command:
ef -batch -e batch.tcl
This is the recommended way to invoke a batch file. On startup the program automatically executes the tcl code in the file ef. This code does the initial setup of the program, including initializing the data-reduction code.

The first thing that the batch file does is turn off all attempts to display images. If the image display code is not loaded, the displays will fail anyway. It is best (faster) to make sure the program does not try to display in the first place.

The second block of code sets the optical configuration, and selects a data reduction sequence. We also set a tcl variable equal to the current working directory.

In the third block of code we load a flat-field a dark and two extra-focal images. When loading the first extra-focal image we have assumed that the fits header of the file contains an appropriate focus value. After loading the second file we demonstrate how to add a FOCUS value to the data files fits header using the fitsHeader command. This is a completely general mechanism, any key (FOCUS) value (1.0) pair can be added. If no value is specified this command will report back the value associated with the key, or if the key does not exist it will return the string "undefined". If you need to specify the image centers, you must do so as shown in the the commented out lines at the end of this block.

The last block of code runs an automatic data reduction sequence, and stores some results to file.

You should be able to create simple batch files by following the above example. The rest of the material in this chapter covers individual functions which you may wish to use in batch files in greater detail. You may also need to read the next chapter on Tcl extensions.

7.1.1 Reading an image file.

ef_addFileCmndLine {d f im}
d = directory or path of file.
f = file name.
im = image to be read, on of ef1, ef2, dark or flat.

This function attempts to open an image file. The variables d and f should point to a valid data file. The argument im is the name of the image object that will be created if when the file is opened. By convention, if this file is to be used for wavefront reduction it should have one of the names ef1, ef2, dark or flat. By preference the image file should be in FITS format. If you need to convert files to FITS format from any other format, the freely available netpbm utilities can convert nearly all known image types into FITS format.

The program can also read plain image files containing no header information. In order to make use of this the files must be named using the convention string_

s,i,f
_width_height.d where: Note that unlike FITS files, these files are not portable between computers with different byte ordering.
Laplacian Optics Inc.     Email:   laplace@laplacian.com

Up Next