How to Trigger a Worksheet Data Filter during Batch Processing

 

Note: In Origin 2020, filter in analysis template will automatically be triggered when doing batch processing so you don’t need to do anything this blog says.

Origin’s Batch Processing tool is one of Origin’s coolest features, particularly when coupled to an Analysis Template™. The Batch Processing tool lets you automate many data import, analysis and graphing operations with little or no programming. Origin 2016 has increased the power of this tool by adding a Script Before Each Process box so that you can add one or more lines of LabTalk script to be run before each batch cycle.

For instance, your batch operation might employ a Data Filter that conditions the dataset before it is analyzed and graphed. Typically, when you apply a filter to a column of data, then change the data, the filter must be reapplied. If you were programming an application that relied on the filter, you could, for instance, reapply the filter using LabTalk script. But when setting up an operation for use with the Batch Processing tool, you need a way to automatically reapply the filter.  This is where the Script Before Each Process box comes in handy.

By adding the following single line of LabTalk script to the Script box, you can trigger an update to the filter each time a new data file is imported into the workbook.

wks.runfilter()

To illustrate, we’ll show a data import -> data filter -> linear fit -> graphing operation employing an Analysis Template™.

Download this zip file and extract the contents (an Analysis Template named Sensor_Data_wPlot.ogw) to a convenient location. Drag and drop the ogw file into Origin to open the file. You will see it is a workbook with floating graph. There is a filter condition on the Sensor Output column. Further, a Linear fit was done on the filtered data.

DOC-2429-Image_Featured

  1. Click File: Batch Processing to open the Batch Processing tool.
  2. Set Batch Processing Mode to Load Analysis Template and browse to the Sensor_Data_wPlot.ogw file that you downloaded.
  3. Click the browse button to the right of File List, browse to Program Files/OriginLab/Origin2016/Samples/Curve Fitting, CTRL + select the three Sensor0x.dat files and click Add Files. Click OK.
  4. Set Result Sheet as <none>
  5. Clear Delete Intermediate Workbook.
  6. In the Script Before Each Process box, enter wks.runfilter()
  7. Click OK.

The batch operation runs and (a) imports data, (b) filters the data to use only the top 15 data points, (c) performs a linear fit on the filtered data and (b) plots the results in the embedded graph, sequentially, for all three data files.

To see a video on Origin 2016’s Script Before Batch Processing feature, go to YouTube.

To see a video on Analysis Templates™, click here.

DOC-2429-Image1A

 

 

 

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です