next up previous contents index
Next: The MFIT (MULTIPLE 1-D Up: The MACROS / LOG Previous: The MACROS / LOG


Creation and Using Simple Macro Files

Often it is necessary to process a large number of files using the same sequence of data analysis operations. This task is made much easier through ``macro'' files and the RUN SEQUENCE command. Here macros are designed to do the simple job of inputting data from one file, and outputting it in another (although the output file can be missing).

To create the macro file perform the following steps:

  1. Enter the MACROS / LOG FILE interface
  2. Select the CREATE MACRO command, and define the name of the file to contain the macro.
  3. EXIT the MACROS / LOG FILE interface and perform the full sequence of input, analysis, and output commands on one of the files in the sequence. Be careful to make sure all values which may change or remember defaults are set. (Normally, the user can rely on most default values, but for the macro to be really robust, it is better to spend the time setting the values, so the macro contains all the necessary values, and there is no reliance on default values which may be wrong.
  4. EXIT whichever interface you have been using and re-enter the MACROS / LOG FILE interface.
  5. Select the STOP MACRO command to finish recording the sequence.
  6. Edit the file with you favourite editor (you can use <CONTROL>Z to use the same terminal window as FIT2D, and then fg to return to FIT2D, or work from another terminal window). Replace the input file name with the ``variable'' #IN and any output file name with #OUT. (NOTE: The names of variables are CASE SENSITIVE, so don't enter #in.)

The macro is now ready to be run.

The macro can be run repeatedly on a series of files by using the RUN SEQUENCE command. See Section 6.1, Page [*] for details of allowable file series. The macro file to run is selected, as are the first and last files in the series. The ``increment'' between input file is input. Files in a series must be named with a changing numerical part. This is automatically recognised and the first and last numbers in the series defined. To process every file between these numbers (assuming the files exist) enter 1 (or -1 in the case that the last file has a larger number than the first). To skip alternate files enter 2 (or -2), and so on. If for some reason all the files have an extra 0 after the changing numerical part e.g. they are numbered file_10.dat, file_20.dat, file_30.dat, etc. enter 10.

The RUN SEQUENCE command will automatically generate the input file names from this information, and they will replace the #IN ``variable'' which has been placed within the macro.

If the macro defines an output file using the #OUT ``variable'', then the command will also generate the series of output file names. These are the same as the input file names, but with a user specified extension replacing any extension of the input files. The last user input before the macro is automatically run is OUTPUT FILE EXTENSION which is the output file extension used to form the output file names. The generated output file names automatically replace the #OUT ``variable'' each time the macro is run in the sequence.

The progress of the macro is output in the terminal window.


next up previous contents index
Next: The MFIT (MULTIPLE 1-D Up: The MACROS / LOG Previous: The MACROS / LOG
Andrew Hammersley
2004-01-09