Batch File Processing with Offline Sorter
A useful, time-saving feature in Offline Sorter is its built-in Batch File Processing function. Batch processing automates commonly used Offline Sorter operations across multiple data files, helping researchers reduce the time spent repeating the same tasks.
What Can Batch Processing Do?
The Batch function can queue multiple files, perform channel-level operations, apply sorting parameters, and save results in a selected file format to a specified output directory.
Examples of channel-level operations include thresholding, filtering, and waveform alignment. Researchers can also configure sorting parameters, such as the sorting time range and Valley Seeking settings.
Offline Sorter's Batch File Processing function was developed in response to customer feedback and the need to reduce repetitive work when sorting large numbers of files. For full instructions on creating batch files, consult page 360 of the Offline Sorter User Guide.
Video Examples of Batch File Processing
Use the video examples provided on the original Plexon page to see how batch processing works in practice.
Understanding Batch File Commands
A batch command file contains one command per line. Each command begins with a main keyword followed by subcommands or arguments. Lines are not case-sensitive, blank lines are ignored, and lines beginning with
//
are treated as comments.
Offline Sorter uses six main batch command keywords:
1. File
Queues a specific file for processing. The file is not processed until the
Process
command is reached.
File C:\myfiles\test.plx
2. Dir
Queues files matching a specified path and filename pattern, such as all PLX files in a directory.
Dir C:\myfiles\*.plx
3. ForEachFile
Defines an action to perform on each file. Available actions include saving files, exporting to PLX, PL2, NEX, or NEX5 formats, applying sorting templates, and exporting waveform, unit, or channel information.
ForEachFile ExportToNex
4. ForEachChannel
Defines an operation to perform on each channel in each file. Depending on the workflow, this can include filtering, waveform detection and alignment, sorting, outlier removal, interval filtering, and sorting statistics.
ForEachChannel ValleySeek ForEachChannel SortSummaryToPP ForEachChannel LogStats2d
5. Set
Changes a parameter used by the batch operation. Parameters can control filtering, waveform detection, alignment, sorting, output formats, and the output directory.
Set FeatureX 0 Set FeatureY 1 Set ParzenRadiusMult 1.0
6. Process
Starts processing all files currently in the queue and resets the queued-file list.
Process
How a Batch File Workflow Works
In general, an Offline Sorter batch file follows four steps:
- Select input files: Use
FileorDirto specify which data files should be processed. - Define file and channel actions: Use
ForEachChannelandForEachFileto specify sorting, analysis, and saving operations. - Set processing parameters: Use
Setto define values that control how the operations are performed. - Run the batch: Use
Processto execute the queued operations.
Example Batch Command File
The example below is adapted from the Offline Sorter batch file example. It configures Valley Seeking sorting, creates sorting summaries, logs 2D sorting statistics, and exports results to NEX files.
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
In this example, the first batch uses feature dimensions PC1 and PC2 with a Parzen radius multiplier of 1.0. It processes the specified files, sends sorting summaries to PowerPoint, logs 2D sorting quality statistics, and exports timestamps to NEX files.
The batch then changes the Parzen radius multiplier to 2.0 and processes the next group of files using the updated setting.
Helpful Tip
In Offline Sorter, the Help → Quick Batch Reference menu provides a printable summary of batch commands and their arguments. This can help when building or modifying your own batch files.
