25.2 Analysis Templates
The Origin workbook is capable of storing raw data, metadata, mathematical formulae, scripts and analysis results (including graphs). Combine this ability to store complex information with Origin's Recalculate analysis feature and you have the potential to create an Analysis Template.
The Analysis Template concept differs from Origin's workbook template concept in at least one very important way: when you save a workbook template, all data are destroyed. This would include, for instance, any cell references/cell linking information that might be used in calculations. Thus, saving your Analysis Template as an OTW file is not what you want to do. While the Analysis Template concept is a bit amorphous (similar functionality could be achieved in an OPJ file, as explained below), it is probably best exemplified by the workbook window file -- the OGW -- a standalone file that can be inserted, as needed, into your OPJ files and which can be freely shared with colleagues.
The OGW will not only retain information on column number, designation and order, format and style options, etc., but also information on which analyses you wish to perform and what sort of output you wish to generate. When supplied with the proper data, an analysis template will crunch your numbers and automatically create output in the form of worksheet columns, and analysis report sheets that summarize your results with a combination of tables and graphs.
Saving Analysis Operations into a Template
If all your analysis operations are consolidated into one workbook, you can select menu File: Save Workbook as Analysis Template... to save the workbook as an analysis template (*.OGW file). You can directly drag this OGW file into Origin to open it, and you will find all analysis related data are cleared but the analysis operations are kept as indicated by the green locks.
If your analysis operations are also associated with matrixbooks, even independent graph windows, you can choose to save the entire project as a project-level analysis template. The saved project then becomes a template to which you add new data. To save the current project as template, click File: Save Project without Data and all existing data will be cleared before saving.
Similarly, you can duplicate the current project file with all windows and operations but without any data. If the project file has been modified since opening, the user is prompted to save the operations and graph customizations in the project file before duplicating. A new UNTITLED.opj is created and immediately opened after duplication. To duplicate the .opj file, click File:Duplicate Project Without Data.
Using Saved Template to Handle Repetitive Tasks
If you only want to use saved template to process another dataset, workbook-as-template works the same as project-as template where both require importing new data into the template to update all analysis related graphs and results.
The added advantage of the workbook-as-template method is that the Batch Processing dialog, opened by clicking button or from menu File: Batch Processing, can be used to process multiple files or datasets automatically.
Use Active Workbook as Template to Handle Repetitive Tasks
If you have analyzed one of your data files within one workbook, you can easily do the same analysis for all other files by importing them into the workbooks cloned from active workbook. This is done by choosing the template <clone> as Template Name in the dialog for importing.
Reporting Batch Analyzed Results
To summarize and report analyzed results, you can create a Custom Report sheet which contains tables, graphs, external images, such as logos, etc., and link all those elements with the output of analysis operations in an analysis template.
Alternatively, you can choose to output results obtained from an analysis template directly into a pre-customized Word template to create a Word or PDF file for reporting.
To do so, first you have to prepare a Word template with favorable cells bookmarked. The bookmarks can be added to an analysis template in a special worksheet with name Bookmarks, by selecting menu File:Add Word Bookmarks to Analysis Template to open Add Word Bookmarks to Analysis Template dialog.
To pass analyzed results via Word bookmarks to Word template, you have to copy results from the analysis template and paste them as links to the corresponding cells where Word bookmarks are added. When done, you can re-save current analysis template and use it along with the Word template to export batch analyzed results directly to a Word or PDF file.
This simple example will illustrate the concept:
- Open a new Origin project, click the Import ASCII button and open \Samples\Curve Fitting\Linear Fit.dat. The file is imported into the active worksheet. The sheet is renamed Linear Fit.
- Highlight columns B through D, select Analysis: Fitting: Fit Linear from the menu, and open the Linear Fit dialog box.
- Set Recalculate to Auto.
- Open the Output Results branch and verify that the output is going to the source workbook (the same one that contains the imported data).
- Click OK to perform your linear fit. Note the completion of the fit and the writing of results to the FitLinear and FittedValues worksheets.
- Click on the Linear Fit worksheet, then right-click in the area to the right of the worksheet columns. From the shortcut menu, choose Clear Worksheet and verify that you wish to remove all data. This will also clear the previous output as that output is "dependent" upon the presence of the Linear Fit data (you can verify this by clicking on these two tabs).
Note that, at this point, you have not saved your Analysis Template (you are merely working in an untitled Origin project file). There are a couple of options for saving, depending upon your needs:
- If you wish to save a pared-down Analysis Template -- the smallest functioning unit, if you will -- and all of your input and output can be contained within the workbook itself, then you can save an Origin window file. Select File: Save Window As -- not Save Template As -- and save your workbook as an OGW file.
- If you need to include your Analysis Template in a more complex project -- one that perhaps contains separate graph, matrix or layout windows -- then you could save your workbook as part of your project file (File: Save Project As). Note, however, that if you save your workbook as an OGW file as prescribed above, you can always add it to an Origin project file with the File: Open menu command.
Finally, to see a demonstration of the Analysis Template, click the Import ASCII button and re-import \Samples\Curve Fitting\Linear Fit.dat. The file is imported into the active worksheet, the curve fit is performed and the results are written to the FitLinear and FittedValues worksheets.
Note to Advanced Users: If your Analysis Template procedure is performed by a user-defined X-Function and you intend to save the Template as an OGW file and share it with a colleague, you will need to check the Save in Project check box when creating your X-Function. For more information about this option, please see the Programming Help file.