OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis                     
 

17 How to Handle Repetitive Tasks


Recalculation

All Analysis and most data processing dialog boxes in Origin include a Recalculate control. This control allows you to tie output operations to the source data. When Recalculate is set to Auto or Manual, changes to the source data will trigger an update of the output (pending, in the case of Manual). This allows you to analyze multiple datasets by, for instance, serial import of a new data file to replace existing data. This feature is also the basis for creating Analysis Templates. The Analysis Template concept is explained below.

LR dialog recalc 1.png


The Recalculate control has three modes:

None
  • No lock is displayed in the output.
  • Changes to the input data will not result in an update of the output.
Auto
  • An auto green lock Operation lock auto.png is displayed in the output columns and graphs that contain plots of the output data.
  • The output will be automatically updated when input data is changed.
  • You can also click on a lock icon and open the dialog to make changes to the analysis settings, including changing the Recalculate mode.
Manual
  • A manual green lock Operation lock manual.png is displayed in up-to-date output columns, and graphs that contain plots of the output data.
  • A yellow lock Operation lock manual pending.png indicates that input data have changed and recalculation operations are pending. You can trigger updates individually by clicking on a yellow lock and selecting Recalculate from the shortcut menu; or you can update all pending operations by clicking the yellow Recalculate button Button Recalculate Manual.png on the Standard toolbar.
  • You can also click on a lock icon and open the dialog to make changes to the analysis settings, including changing the Recalculate mode.


Tips for Managing Recalculation Operations

  • A left-click on the lock displays a menu that provides multiple options including changing analysis parameters, opening source data sheet, switching to result sheets, and controlling the status of the operation such as switching from manual update to auto update.
  • The Standard toolbar displays a Recalculate button that shows green Button Recalculate Auto.png when all project operations are up-to-date and yellow Button Recalculate Manual.png when there are recalculation operations pending. If you have opened a project and you see that the Recalculate button is yellow, understand that calculations are pending and that the data and data plots you see in the project may not be up-to-date.
  • If a lock icon appears dark gray in color Gray lock pro only.png, this indicates that the associated operation was performed in OriginPro and the window or project has been opened in standard Origin. The operation is not supported by standard Origin and to modify or re-run the analysis, you will need to locate a computer with an OriginPro license.
  • If a lock icon appears red Broken operation lock.png something has occurred which makes recalculation operations impossible. Such conditions are rare but would occur if, for instance, you passed a project file that included a user-defined curve fitting operation to a colleague but failed to pass along your user-defined fitting function.

Block Recalculation: Having many recalculation operations in your project file can slow down your work. Starting with Origin 2019, you can block recalculation -- both Manual and Auto recalculation -- by clicking on a lock icon and choosing Block Recalculation from the popup menu. Placing a block on pending recalculations places a yellow "block" icon Button block recalculation manual.png on each associated operation in the chain. Placing a block on up-to-date calculations places a green "block" icon Button block recalculation auto.png on each operation in the chain. To remove the block, click on the "block" icon and clear the check mark (Note that clicking the yellow Recalculate button Button Recalculate Manual.png on the Standard toolbar does not update blocked operations).

Hide Locks: Starting with 2019, you can hide the lock icons on your graph window by clicking on the graph and, from the main menu, choosing View: Show and clearing the check mark beside Lock Icons. This does not remove associated operations from the graph window. To re-display the icons, repeat the procedure.

Dialog Themes

Settings in analysis dialogs and most other data processing dialogs can be saved as a Dialog Theme file. Once saved, these Theme files containing your custom settings can be recalled as needed. Multiple theme files can be saved from a dialog, allowing for easy repeat analysis of datasets that may each require different settings.

Last used dialog box settings are automatically saved as a <last used> Theme. Origin also allows you to save your custom settings as the <default> Theme. The default Theme, last used Theme, and any named Theme that you have saved, can all be accessed from the theme fly-out menu that opens from the dialog box. The same Themes are also available from the main menu item associated with the analysis dialog box.

Analysis themes menu.png

Dialog Themes are managed with the Theme Organizer tool, available from the Tools menu.

Tutorial: Saving and Re-using a Dialog Theme

  1. Import the file Linear Fit.dat from the Samples\Curve Fitting\ subfolder.
  2. Highlight column B and select Analysis: Fitting: Linear Fit...
  3. In the Linear Fit dialog that opens, check the Fix Intercept checkbox (under Fit Options) and set the Fix Intercept at edit box to 0.
  4. Click the Button Save Theme.png button next to the Dialog Theme control and select Save as .... In the Theme Name box, enter Zero Intercept and press OK. Press OK again to close the Linear Fit dialog box and perform the analysis. FitLinear1 and FitLinearCurve1 result sheets are added to the workbook.
  5. Return to the source data and highlight column C. Select Analysis: Fitting: Linear Fit from the menu. You will see a fly-out menu with multiple Theme options including the Zero Intercept Theme you saved in the previous step.
  6. Select your saved Theme. The analysis is automatically performed on Column C using the settings saved in the Theme. Note that the dialog box does not open.
  • Hold the SHIFT key while clicking on your Theme in the main menu and the associated dialog box will open with settings from the selected Theme loaded into the dialog box.
  • The default Theme Origin shipped for an analysis is called System Default. Click the fly-out menu in the analysis dialog and choose System Default to load it.
  • Click the fly-out menu in the analysis dialog and choose Delete to delete Themes you have created, including any customized <default> Theme.
  • The customized <default> Themes for all analysis dialogs are saved in Defaults.xml in the User Files Folder. Deleting this file restores system default settings of all analysis dialogs.

Project and Workbook Templates

The Project as Template

The Origin project file can be used as a template for carrying out repetitive graphing and analysis tasks. Create the desired graphs and/or analysis results from data in your workbook(s) and save the project. You then simply replace the workbook data, to automatically update graphs and results. When saving the project, you have the following options:

  1. Use the File: Save Project without Data menu item. This will clear all data before saving the project.
  2. Use the File: Duplicate Project without Data menu item. This will create a copy of the existing project where all the data will be cleared before saving.

You can, of course, save the current project with data but the above two options may prove useful when working with very large datasets as they will reduce project file size.

The Workbook as Template

The workbook can contain worksheets with data, metadata, floating or embedded graphs, embedded matrices and notes, plus scripts, variables and other supporting data.

You can save a workbook as a template for repetitive graphing and/or analysis tasks. Depending on your needs, there are three options for saving your workbooks -- as a workbook (OGWU), as a template (OTWU) or as an Analysis Template (OGWU):

  • Workbook (OGWU): Choosing File: Save Window As saves all workbook content.
  • Analysis Template (OGWU): Choosing File: Save Workbook as Analysis Template clears all data columns that are used in analysis operations in the workbook before saving. Operations are preserved as are data that are not associated with analysis operations.
  • Template (OTWU): Choosing File: Save Template As saves the structure of the workbook, plus any analysis operations that exist in the workbook, but all data including data that are not associated with these analysis operations, are cleared.


Workbook templates of all types can now be opened and managed using the New Workbook dialog box, that opens by default, when you start Origin 2019.

Tutorial: Creating an Analysis Template

  1. Start with a new workbook and import the file Samples\Curve Fitting\Sensor01.dat.
  2. Select column B and use the Analysis: Fitting: Linear Fit and open the Linear Fit dialog.
  3. Change the Recalculate drop-down to Auto.
  4. Click the Fit Control tab, check the Fix Intercept check box and enter 0 in the Fix Intercept at edit box.
  5. Click OK to close the dialog and perform the linear regression.
  6. Answer "Yes" to the prompt and switch to the FitLinear1 report sheet to view results including plots of the best-fit line and residuals.
  7. Now switch back to the original data sheet and import the file Samples\Curve Fitting\Sensor02.dat. The analysis results will be automatically updated with this new data. Note that you could continue to use this workbook for importing other data; or you could right-click the workbook window title and choose Duplicate without Data to create a new workbook with the linear fitting operation saved into it. This allows you to import new data into the new workbook and thus save a project with multiple such workbooks, if desired.
  8. With the workbook active, select the menu File: Save Workbook as Analysis Template..., and in the dialog that opens, give a name such as Linear Fit of Sensor Data and click Save.
  9. Choose File: Recent Books and select the template that was saved in the previous step. The workbook will open and the data sheet will be empty.
  10. Import the file Samples\Curve Fitting\Sensor3.dat into the empty data sheet (1st sheet). The analysis results will be automatically generated upon data import.

Analysis Templates can contain custom report sheets and a summary sheet. Thus, you can create an individual report for each file. The advantage of saving the workbook as an Analysis Template is that the Batch Processing tool can use the template to process multiple files or datasets and create a final summary report for all files that are processed as part of the batch analysis. View the Batch Plotting and Batch Analysis sections of this chapter for examples of using the workbook as a template for handling repetitive tasks.

Batch Plotting

Origin provides several methods for batch plotting of graphs from multiple datasets or files. The following two sections outline how to create multiple graphs from (1) data that is already in worksheets, or (2) multiple data files. In addition to these two procedures, batch plotting can also be performed programmatically using LabTalk script or Origin C.

Duplicating Graphs with Data from Other Books/Sheets/Columns

If you have several workbooks, worksheets or columns with similar data structure as you the data used to plot the graph, you can have Origin clone that graph via Window: Duplicate (Batch Plotting) menu with new data. There are two cases:

  • If you have plotted a graph with a single dataset and customized it, and want to clone the graph with other data in the same worksheet: Choose Window: Duplicate (Batch Plotting): Duplicate with New Columns. Pick other data (columns) that you want to plot. Each column will be plotted as a new graph.
  • If you have plotted a graph with data in one worksheet or workbook and customized the graph, and you want to clone the graph with other worksheets or workbooks with a similar data structure: Choose Window: Duplicate (Batch Plotting): Duplicate with New Sheets/Duplicate with New Books. Origin will list all worksheets or workbooks with a similar data structure. Pick the worksheet or workbook you want to plot from. Each worksheet or workbook will be plotted as a new graph.

Tutorial: Duplicating a graph with data from other books/sheets

  1. Press the New Project Button New Project.png button on the Standard toolbar.
  2. Press the Import Wizard Button Import Wizard.png button on the same toolbar. This opens the Import Wizard dialog box.
  3. Click the browse button Button Browse.png to the right of the File box. Browse to the Import and Export folder and select the files S15-125-03.dat, S21-235-07.dat, and S32-014-04.dat. Click Add File(s), then press OK. In the Import Wizard dialog box, press Finish. The files are imported into three separate workbooks.
  4. Drag and select all three Y columns in one of the workbooks, then select the menu item Plot>2D: Multi-Y: 3Ys Y-YY to create a graph with multiple Y axes and one shared X axis. Make any desired customizations to the graph.
  5. Right-click on the title bar of the graph window then select Duplicate (Batch Plotting) shortcut menu.
  6. In the dialog box that opens, press Ctrl and select the other two workbooks/worksheets then press OK. Two more graphs are created with data from the other two workbooks/worksheets.

The Workbook as a Template for Processing Multiple Files

If you want to plot graphs from many data files but don't want to import all files to workbooks before plotting, you can import one file, create the desired graph(s) based on that data, then add the graph(s) to your workbook and save the workbook as a template. Using this template you can process multiple files, creating a workbook for each file and its corresponding graph.

Tutorial: Creating graphs from multiple data files

  1. With a new workbook active, choose File: Import Single ASCII and import the file Sensor01.dat from the Samples\Curve Fitting subfolder of the Origin installation folder.
  2. Highlight column B and create a line+symbol graph of the data.
  3. Double click on the X axis to open the Axis dialog. Make sure Scale tab is active. Select both Horizontal and Vertical on the left panel and set Rescale to be Auto and click OK. This will ensure that the graph scale will update automatically on data change.
  4. In the workbook, right-click on the worksheet tab and select Add Graph as Sheet, then select the graph created above and click Done. This will add a new workbook sheet containing an embedded graph.
  5. Switch to the data sheet, double-click on the tab rename the sheet as Data.
  6. Select the Worksheet: Clear Worksheet menu item to clear the data in this sheet. Note that this step is optional. Clearing the data will reduce the size of the template saved in the next step.
  7. Select the File: Save Window As... menu item, assign a name such as Sensor Data and Graph and press Save.
  8. Now we can use this template to process multiple files. Select the File: Batch Processing... menu item.
  9. In the dialog box that opens set the Batch Processing Mode to Load Analysis Template, then set the Analysis Template control to point to your saved template.
  10. Set Data Source to Import from Files and select the three files Sensor01.dat, Sensor02.dat, and Sensor03.dat from the Samples\Curve Fitting subfolder.
  11. Set the Data Sheet(s) to Data and set Result Sheet to <none>.
  12. Press OK to close the dialog box. You should get three workbooks with the data imported into the first sheet and the graphs updated in the 2nd sheet. To further edit any of the graphs, double-click on the graph to pop up an editable page.

If processing of your data requires some custom import settings, those settings will be saved to the data sheet by default. Settings thus saved to the sheet will be used for import when batch processing of multiple files using the workbook as a template.

Batch Analysis

Origin provides several ways to perform batch analysis of multiple files, data columns, or data plots.

Analyzing Multiple Datasets in Dialogs

Some analysis dialog boxes, for instance Linear Fit and Nonlinear Fit, support analysis of multiple datasets. Report sheets created by these dialog boxes include a summary table listing the parameter values for each dataset and other pertinent results such as goodness-of-fit indicators. The summary table can be copied to an external sheet for further processing.

Tutorial: Fitting Multiple Datasets

  1. Open a new workbook and import the file Samples\Curve Fitting\Multiple Gaussians.dat from the Origin installation folder.
  2. Set the Long Names of the four Y columns as Peak 1, Peak 2, Peak 3 and Peak 4.
  3. Select all four Y columns, and use the Analysis: Fitting: Nonlinear Curve Fit... menu item to open the NLFit dialog box.
  4. Select Gauss from the Function drop-down list, then press the Fit button to perform fitting and close the dialog box.
  5. Switch to the FitNL1 report sheet. You will see a table named Summary which lists the fit parameters and fit statistics for each dataset.

GSB Batch NLFit Summary.png

In the NLFit report sheet, click on the downward-pointing arrow button Button Extract Worksheet DropDown.png next to the table named Summary and select Create Copy as New Sheet. This will create a copy of the table in which all cells are linked to the report. Any updates/changes to the fit will automatically update the values in this copied sheet. This sheet can then be used to plot or to perform secondary analysis on the fit parameters.

When enumerating something like a column Long Name, as you did in step 2 above, enter the string in the first cell (e.g. "Peak 1"), select the cell and hover over the lower-right corner. When the cursor becomes a "+", drag across the other cells and the contents of the first cell will be extended to those cells.

Extend string to other cells.png

Using Gadgets for Analyzing Multiple Curves

Origin includes several gadgets for performing interactive analysis on plotted data. Gadgets allow selecting a data range of interest, switching from one dataset to another, and setting various preferences specific to the analysis being carried out.

Most gadgets offer an option to perform the analysis on all data plots in the current layer, or all data plots in the graph page. This allows for performing repetitive analysis on multiple datasets using the same settings, and generating a table of results across all datasets.

Tutorial: Using the Integrate Gadget to Integrate Multiple Curves

  1. Open the project "Samples\Spectroscopy\Absorbance Spectra.opj".
  2. With the graph window active, choose Gadgets: Integrate from the main menu.
  3. In the dialog that opens, click the Baseline tab and set the Mode drop-down to Straight Line.
  4. Click the Output tab, expand the Output Quantities to node, and check Append to Worksheet. Press OK to close the dialog box.
  5. A region of interest (ROI) object is placed on the graph. If necessary, click on the ROI and resize this object to cover the entire data range plotted in the graph. The integrated area will be displayed as a shaded region.
  6. Click the arrow button Right arrow menu button.png at the top right of the ROI object, then choose Change Data from the context menu and switch to another plot in the layer. Check that the current baseline setting works for other curves in the layer.
  7. Click the arrow button Right arrow menu button.png, select New Output for All Curves (N) or simply press the "N" key. Integration is performed on all curves.
  8. Click the arrow button Right arrow menu button.png again and select Go to Report Worksheet. Expand the report worksheet to view the integration results from all curves.

GSB BatchAnalysis Gadget.png

Batch Analysis Using an Analysis Template

The Batch Processing tool allows you to process multiple files or datasets using an Analysis Template. Simply perform the analysis on one of the files, include all desired results and report sheets in one workbook, and save that workbook as an Analysis Template. The Batch Processing tool then uses the Analysis Template to process multiple files/datasets. You have the option to retain one workbook for each file/dataset, and additionally, to create a summary table with select analysis parameters and other metadata that you have pre-configured in your analysis template.

Tutorial: Batch Analysis of Multiple Files using an Analysis Template

  1. From the main menu, choose File: Batch Processing.... This opens the Batch Processing dialog box.
  2. Set Batch Processing Mode to Load Analysis Template.
  3. Press the browse button Button Browse.png to the right of the Analysis Template box and select the file Sensor Analysis.OGW located in the Samples\Batch Processing subfolder under your Origin installation folder. This Analysis Template contains multiple sheets set up for linear regression analysis, reporting, and summary tables.
  4. Set Data Source to Import From Files, then click the browse button Button Browse.png to the right of the File List and from the Samples\Curve Fitting subfolder under your Origin installation folder, select files Sensor01.dat, Sensor02.dat and Sensor03.dat .
  5. Set Dataset Identifier to File Name, Data Sheet to Data, and Result Sheet to Result, thus selecting the appropriate sheets in the Template.
  6. Uncheck Delete Intermediate Workbook.
  7. Click OK to close the dialog box and process the three files (you can answer "No" to the prompt). You will obtain three books with the data, analysis results, and report for each file, and a fourth book containing the summary table of analysis results from all files.

GSB BatchAnalysis Files.png

Saving the initial workbook as an Analysis Template is optional. You can simply save the Origin project (.opj) and next time replace the data in your workbook to update all results and graphs. The Batch Processing tool also has an option to repeatedly import files into the active window, allowing you to simply re-use an existing book within a project (which contains all desired analysis and graphs) as an on-the-fly template for the batch analysis.

You can batch generate analysis reports using a custom MS Word template, with the option of outputting a PDF file for each report. For more information, see this tutorial.

Repeating Analysis on Other Datasets or Data Plots

For some analysis operations, you can perform the analysis on one dataset or data plot and then repeat the analysis for all other data. This feature is available via a special shortcut menu entry, when you click on the lock associated with the operation.

  • In worksheet columns or reports, clicking the lock will show the menu command Repeat this for All Y columns. Selecting this will repeat the analysis on all other Y columns in the source data sheet.
  • In a graph, clicking the lock will show the menu command Repeat this for All Plots. Selecting this will repeat the analysis for all other data plots in the graph page, even if the plots are in different layers.

This is particularly useful for such analysis dialog boxes as smoothing or interpolation that support input of only one dataset. As long as the data are contained in one worksheet or plotted in one graph, the analysis can be repeated on all other datasets.

Tutorial: Smoothing Multiple Columns in a Worksheet

  1. Import the file Samples\Curve Fitting\Multiple Gaussians.dat into an empty workbook.
  2. Select column B and click Analysis: Signal Processing: Smooth to open the smooth dialog box.
  3. Accept the defaults and press OK to perform smoothing. A new column will be added with the smoothed data.
  4. Click on the lock Operation lock manual.png in the output column and select Repeat this for All Y columns. Three more columns of smoothed data with same settings will be generated from the data in columns C thru E.

Repeating Analysis Using Data Filters

Large multi-column datasets can be quickly reduced by applying filter conditions to one or more columns. This Data Filter feature can also be used in conjunction with the colcopy (column copy) X-Function to produce multiple graphs from the same source data using different filtering conditions. The filtered data can also be analyzed, allowing you to compare graphs and analysis results across multiple filter conditions.

Selected columns from the source data sheet can be copied to create child sheets where the filter condition stays synchronized with the parent sheet, or is locked to the child sheet. When the source data sheet is updated, all child sheets, associated graphs and analysis results will automatically update using their respective filter conditions. Additionally, the filter condition of a particular child sheet can be pushed back to the parent sheet at any time.

The image below displays the source workbook with data for several makes of automobiles. Two books were created with a subset of columns and a data filter to restrict the data to a particular make of automobile. Linear regression analysis of the filtered data was performed, allowing comparison of the results across the two filters.

GSB DataFilter Locked.png

Tutorial: Locking a Filter Condition on Copied Columns

  1. Import the file Samples\Statistics\Automobile.dat
  2. Click on the Make column, then right-click and select Filter: Add or Remove Filter context menu.
  3. Click on the filter icon Button Add Or Remove Data Filter.png that was added to the column, and uncheck all makes but Honda (Choose Select All to clear all and then select Honda). Click OK.
  4. Hold down the CTRL key and click and select the Make, Power and Engine Displacement columns. Next, right-click and select the Copy Columns to... context menu.
  5. Accept defaults in the dialog that opens, and click Ok to copy the columns. A new worksheet will be added to the workbook.
  6. Click and hold the tab of the new worksheet and drag it to an empty spot in the Origin workspace to create a separate workbook.
  7. Click on any of the locks in the columns of this copied sheet, and select Worksheet Filters: Lock. The filter conditions will be locked to this sheet. If you change the filter condition in the original data sheet, this copied sheet will not be affected.
  8. You can now return to the original automobile book and modify the filter condition to Toyota and use Copy Columns to to create another worksheet.
  9. Highlight column B in your Honda workbook,then right-click and choose Set As: X. Do the same for the Toyota book.
  10. Highlight column C in your Honda workbook and click the Scatter button Button Scatter Plot.png on the 2D Graphs toolbar. Do the same for the Toyota book. This gives you two plots of Power vs Engine Displacement, one for Honda, one for Toyota.
  11. Click on the Honda graph and choose Analysis: Fitting: Linear Fit. Accept the dialog defaults and click OK. Do the same for the Toyota graph.
  12. Compare the fitting results for the two automobile makes.

Automating Tasks Using Programming

In addition to the above mentioned methods for automating tasks using the interface, graphing and analysis features can also be accessed programmatically from either the LabTalk scripting language or from Origin C. Access to Graph Themes and templates, and Analysis Templates can be programmed. You can set up some of the procedure manually by first creating the templates using the graphical user interface, and then write your code to call the templates as needed.

You can get a broad look at what programming options are available in Origin by browsing the Programming Chapter of this User Guide. More in-depth programming-related information is linked to from that chapter.

Topics for Further Reading

 

© OriginLab Corporation. All rights reserved.