Well-formed batch files

Spire can run any SPIDER batch file. But in order to present a batch file in the graphical batch form, the file must conform to a specific text style. The main rules:

  1. Use a header at the top of the batch file
  2. Put all your registers in the header
  3. Put all your input and output file names in the header
Some additional guidelines will allow your batch files to make use of some extra features in Spire:

  1. The symbolic parameter [FILENUMS] has a special meaning for Spire. Use this symbol to designate a document file for selecting numbered data files.
  2. Use file name substitution in the header, not below in the body of the batch file.
  3. The first line (or the first line after some initial HTML markup) should be a comment of the form:

    ; filename.bat :: spider procedure file :: (date) (time)

    This enables programs to recognize it as a SPIDER batch file. Programs that write or alter batch files can use this line to insert a modification date.

A SPIDER batch file header

consists of All register and symbolic filename assignments should have a one-line comment on the same line.
Each section should start with a comment of the form "-- input files --".
That is, there should be at least 2 hyphens before and after the title. For example:

; power.bat :: spider procedure file :: 14:32:33 19-AUG-2003
; converts to scanned file to SPIDER format, and calculates
; the average power spectrum for a set of micrographs.

x72=50    ; % of the overlap in x
x73=50    ; % of the overlap in y 

; --------------- Input files ----------------
FR G
[FILENUMS]../filenums     ; file numbers
FR G
[mics]../Micrographs/raw  ; micrograph template

; --------------- Output files ---------------
FR G
[out]power/pw_avg       ; power spectra
FR G
[roo];power/roo         ; 1D rotationally averaged spectra

; --------------- END BATCH HEADER ---------------


Register assignments

Parameters used by a batch file should be set at the start of the batch code, not scattered throughout the file. This enables users to easily identify all relevant inputs and edit them as needed. Put user-defined parameters in the header, like this:

x51 = 1024    ; width of window
x52 = 1024    ; height of window
; ----------------- END BATCH HEADER ------------------- 
 :
 :
WI
infile
outfile
x51,x52    ; width, height of window

x93 = x51 / 2.0   ; half window size
 :
 :

Don't hard code the numbers in the body of the file:

 :
 :     ;;;;;;;;;;;; DON'T DO THIS
WI
infile
outfile
1024,1024  ; EDIT THIS to the size of the desired window 

x93 = 1024 / 2.0  ; EDIT here too
 :
 :

Register assignments in the header must have one-line comments. These comments are used as descriptive prompts when a form is presented to the user.


Filenames and symbolic parameters

Symbolic parameters may be used in place of any text string. Typically they are used for filenames, file sets (e.g., pic{***x55}), directories, and stacks. The FR G or FR L commands should be used to set symbols equal to text strings, in the form [symbol]textstring:

; --------------- Input files ---------------
FR G
[params]../params           ; parameter doc file
FR G
[FILENUMS]../filenums       ; file numbers doc file
FR G
[mics]../Micrographs/raw  ; micrograph template

; --------------- Output files ---------------
FR G
[out1]power/pw_avg        ; power spectra
FR G
[out2]power/pw_ro         ; 1D rotationally averaged spectra
FR G
[out3]power/roo           ; same as above but in doc file

  • Each filename assignment must have a one-line comment on the same line.
  • The special document files for file numbers should use the symbol [FILENUMS].
  • Filename assignments can be divided into sections with headings such as 'input files' and 'output files'. Section headings must be a comment line with either "-- input files --" or "-- output files --" (that is, put at least 2 minus signs before and after the title).