Batch File Processing with Offline Sorter


 

A useful and timesaving feature within Offline Sorter is its built-in Batch File Processing function. The Batch function allows for the automation of commonly used OFS features across multiple files. The Batch function can be used, for example, to select a number of data files, perform specific processes on a channel-level (e.g. threshold, filter, alignment), set & perform sorting parameters (e.g. sort start/end, Valley Seeking), and save results to a given file type within a new folder or directory.

The development of the Batch File Processing function of Offline Sorter was a direct result of customer feedback over the years, and the need for a tool that could cut down on time spent repeating the same tasks involved in sorting a large number of files. If you would like to learn more about what can be done with Batch File Processing and how to write your own batch files, the process is outlined on page 360 of the Offline Sorter User Guide.

Video Examples of Batch File Processing


 

Batch File Commands



The format of the batch command files is one command per line. A command consists of a main keyword, followed by sub-keywords or arguments. A ‘//’ will comment out a line, and lines are not case-sensitive. Blank lines are ignored.


There are only six main keywords: File, Dir, ForEachFile, ForEachChannel, Set, and Process. But the ForeEachFile, ForEachChannel, and Set commands have may sub-commands.

In general, an Offline Sorter batch file does the following things:

  • pre-specify the files to process using the File or Dir commands.
  • pre-specify the actions to be done on each channel of each file (e.g. do some sorting), and the actions to be done on a file-by-file basis (e.g. save the results) using the ForEachChannel and ForEachFile commands.
  • pre-specify the values of other parameters that will affect how the software performs the tasks (e.g. set the Parzen Multiplier for Valley Seeking Sorting) using the Set command.
  • start all the processing with the Process command.

When running the software, the Help | Quick Batch Reference menu item will display a convenient printable summary of the batch commands and their arguments. The batch command keywords are:

 

The File command queues a file for processing. The file is not actually processed until the Process command is encountered. Specify the full path to the files.

Syntax: File filename

e.g. File c:\myfiles\test.plx will queue the file test.plx for processing

 

Example Batch Command File

Here are the contents of example batch file, ofsbatch.ofb:

ForEachChannel ValleySeek
ForEachChannel SortSummaryToPP
ForEachChannel LogStats2d
//ForEachChannel LogStats3d
ForEachFile ExportToNex
Set FeatureX 0
Set FeatureY 1
Set ParzenRadiusMult 1.0
File C:\PlexonData\Plexon\plx\chan9threeunits3.plx
File C:\PlexonData\Plexon\plx\ev024.plx
Process
Set ParzenRadiusMult 2.0
File C:\PlexonData\Plexon\plx\chan9threeunits2.plx
File C:\PlexonData\Plexon\plx\ev024.plx
Process

The behavior of the example file is to:

• Set the feature space to be PC1 and PC2.

• Set the parzen radius multiplier to 1.0.

• Open chan9threeunits3.plx. For each channel:

• Do 2D Valley Seeking sort, using PC1 and PC2.

• Send the sort summary to PowerPoint.

• Log the 2D sort quality stats to the log file.

• Save the timestamps to chan9threeunits3.nex.

• Open ev024.plx.

For each channel:

• Do 2D Valley Seeking sort, using PC1 and PC2.
• Send the sort summary to PowerPoint.
• Log the 2D sort quality stats to the log file.

• Save the timestamps to ev024.nex.


• Set the parzen radius multiplier to 2.0.


• Do the same thing as described above to both files, but this time using a parzen multiplier of 2.0.