Working with file numbers



Some Spider Procedure files make use of a file-numbering doc file.

The symbolic parameter [FILENUMS] has a special meaning for Spire.

Users can enter file numbers in the "File numbers:" entry box in Spire's main window.


File number document files

The problem: you want to write a Spider DO loop that iterates over a set of files, but the file numbers have gaps (i.e., some numbers are missing).
Solution: use a document file that lists the file numbers. The DO loop reads the keys, and fetches the file numbers.


 ; ----------- Input files --------------
 FR G
   [FILENUMS]../filenums   ; File numbers

 ; -------------- END Procedure HEADER -------------

 UD N,x20                  ; Get the number of files
   [FILENUMS]

 DO x11=1,x20

   UD x11,x55              ; x55 is now the micrograph number
     [FILENUMS]
   
  :
  :

The [FILENUMS] symbolic parameter

Spire searches the Procedure file header for a parameter called [FILENUMS]. It must be capitalized, inside square brackets. If found, Spire will replace the contents of the designated doc file ("../filenums" in the example above) with the file numbers entered by the user. You could use any symbolic parameter, but use [FILENUMS] if you want to be able to enter file numbers interactively.

The "File numbers:" entry box

Users can enter file numbers in the "File numbers:" entry box in the lower left of Spire's main window. The Enter key writes these values to a doc file.

Numbers should be separated by commas. Ranges are specified by hyphens. You can mix commas and ranges, e.g., 1, 3, 5-8, 11 produces a doc file with 1, 3, 5, 6, 7, 8, 11 .

You can use the "File numbers:" button to the left of the entry box to select a group of files. The file numbers of these files will be displayed in the box.

Saving to a file: with the cursor in the File numbers entry box, hitting the Enter key writes the displayed values into the file denoted by [FILENUMS].

If there are numbers in this box, Spire will create a temporary file-number doc file, and use this temporary file instead of the file denoted by the [FILENUMS] parameter. I.e., even if you have a doc file called filenums.doc, Spire will ignore it in place of the numbers in the display, as long as it is designated by [FILENUMS].

This behavior can be turned off. In the Commands menu, select Options. Under the Preferences menu, toggle "Use filenums entry".