11.7 The Integrate Gadget
The Integrate Gadget tool (the addtool_curve_integ X-Function) allows you to select an arbitrary range of data on a graph intuitively, using the region of interest (ROI) object (yellow rectangle). Then the tool performs integration on the chosen section to calculate the area under the curve and display the results instantly on top of the ROI.
With this Gadget, you can:
- Specify the integration limits
- Specify baseline
- Display the difference curve and the integral curve inside the ROI
- Calculate quantities including: peak area, peak height, peak center and FWHM
To Open Integrate Gadget
To use this tool, select Gadgets: Integrate... from the Origin menu when a graph window is active. If the tool has already been activated, you can re-open the Integrate dialog by clicking on the arrow in the upper-right corner of the ROI and choosing Preferences.
To Show or Hide Gadget Tool
To toggle the display of all gadget ROI boxes in a graph at the same time, click the H button in the top right corner of the graph, which enables users to export the graph with gadget results.
ROI Box tab
||Specify the X Data range for the ROI.
- The beginning of X scale.
- The ending of X scale.
- Fixed (Prevent moving by ROI)
- Fix the X scale to prevent from moving by ROI box.
|Show Tool Name (toolname)
||Specify whether to show the tool name at the top of the rectangle in the graph. The tool name can be specified in Preferences.
|Fill Color (rectcolor)
||Specify the color of the rectangle that attaches to the graph. See the list of colors.
|Show Area/FWHM on Center-Top (showtop)
||Specify whether to show the integrated area and FWHM of the selected section at the top of the rectangle in the graph.
|Fit Limits To (fitlimit)
||Specify the integration limits. You can get the limits through linear interpolation/extrapolation or use raw data points as integral limits.
- Interpolate to Rectangle Edge
- Specify whether to interpolate the two points at the rectangle edges according to the source data, and then use these two points as integration limits. Please note that if the rectangle edge exceeds the source data, it will not interpolate.
- Interpolate/Extrapolate to Rectangle Edge
- Specify whether to interpolate/extrapolate the two points at the rectangle edges according to the source data and then use these two points as integration limits.
- Data Points
- Do not interpolate and use the raw data points as integration limits.
|Area Type (areatype)
|| Specify the integral area type.
- Mathematical Area
- The area is the algebraic sum of trapezoids.
- Absolute Area
- The area is the sum of absolute trapezoid values.
- Baseline Subtracted Curve
- Specify whether to show the baseline subtracted curve in the graph.
- Show Integrated Area
- Specify whether to show the integrated area in the graph.
- Keep the shading color after closing gadget
- Specify whether to keep the shading color of integrated area after closing the gadget.
- Note: For information on customizing the shaded (integrated) area and baseline, see this FAQ.
- Integral Curve
- Do not show the integral curve in the graph.
- Restrict to Rectangle
- Show the integral curve inside the rectangle. If the integral values are much larger than the original curve, the integral curve will be re-scaled to restrict inside the rectangle box. The integral curve does not show the true values in this case.
- True Value
- Show the actual integral values in the graph.
||Specify a baseline mode.
- None (Y=0)
- Use Y=0 as baseline.
- Constant Y
- Use a horizontal line as the baseline.
- Straight Line
- Use a straight line, which can be tilted, as the baseline.
- Use Existing Dataset
- Use an existing data set as the baseline.
- 2nd Derivative
- Use the 2nd Derivative method to create baseline.
- End Point Weighted
- Create a smoothed curve using data points from two ends
|| This is only available when Constant Y is selected for Method. You can use it to specify the Y value for the horizontal line to be used as the baseline.
|Fix x to (fixxto)
|| This is only available when Straight Line is selected for Method. It works together with Y offset of left (yoffsetleft) and Y Offset of Right (yoffsetright). It is used to specify how to choose X values for the beginning and end of the baseline.
Now, suppose we define the value of Y offset of left (yoffsetleft) as b1 and Y offset of right (yoffsetright) as b2; the beginning Y value of the baseline as a1, and the ending Y value as a2. Then we always have a1-b1=y1 and a2-b2=y2, where y1 and y2 are the Y values at x1 and x2, respectively. For how to define x1 and x2, see below.
- Entire Data
- Fix x to the entire data set. When you select this, x1 is the X value of the beginning of the raw data and x2 is the X value of the end of the raw data.
- Fix x to the rectangle. When you select this, x1 is the X value that corresponds to the left edge of the rectangle and x2 is the X value that corresponds to the right edge.
- Fix x to the X scale. When you select this, x1 is the beginning of the scale and x2 is the end of it.
| Y Offset of Left (yoffsetleft)
|| This is only available when Straight Line is selected for Method. It used to set the value of b1 mentioned above.
|Y offset of Right (yoffsetright)
|| This is only available when Straight Line is selected for Method. It used to set the value of b2 mentioned above.
|Baseline Dataset (xyrbase)
||This is only available when Dataset is selected for Method. It is used to specify an existing data set to be used as the baseline.
Range 1 (Range1)
- X (X=)
- Specify the X range.
- Y (Y=)
- Specify the Y range.
- Select this check box if you want to use only part of the data set as the baseline.
- Specify the beginning row.
- Specify the ending row.
||Select a smoothing method to apply smoothing prior to creating the baseline. This option is only available when the Mode is set as 2nd Derivative. Options include:
- Window Size
- Specify the desired window size (a positive integer) in the moving window for the Savitzky-Golay or Adjacent-Averaging smoothing.
- Specify threshold for the Savitzky-Golay or Adjacent_Averaging smoothing.
- Polynomial Order
- This parameter is available only when Savitzky-Golay is selected for Smoothing Method. It specifies the polynomial order (1 through 9).
|Maximum Anchor Points
|| Specify the maximum of baseline anchor points. This option is only available when you set Mode to 2nd Derivative.
|| Specify connect method for the anchor points. This option is only available when you set Mode to 2nd Derivative.
|| Specify the percentage of end points to create baseline. This option is only available when you set Mode as End Points Weighted.
Output Quantities to
Customize the output results.
|Script Window (script)
|| Specify whether to output the results to the Script window.
|Results Log (reslog)
||Specify whether to output the result to the Results Log.
|Long Name in Results Log/Script Window (useLongName):
||Specify whether to use the long names of the Quantities (quantities) or the variable names of them when Origin outputs the results to the Results Log or Script window.
|Append to Worksheet (appendwks)
||Specify whether to append the results to a worksheet.
|Result Workbook Name (wbkName)
||This is only available when Append to Worksheet (appendwks) is selected. It is used to specify the name of the worksheet.
|Add Label to Graph (LabelToGraph)
||It is used to specify whether output the label to the graph.
Specify the quantities to be outputted.
| Dataset Identifier (name)
||Specify a dataset identifier in the drop-down list.
| Beginning Row Index (begin_row)
||Specify whether to output the beginning row index.
| Ending Row Index (end_row)
||Specify whether to output the ending row index.
| Beginning X (begin_x)
||Specify whether to output the beginning X value.
| Ending X (end_x)
||Specify whether to output the ending X value.
|Max Height (ph)
|| Specify whether to output the maximum height, as computed from the baseline.
|X at YMax (pc)
|| Specify whether to output the X value at the maximum Y value.
| Area (pa)
|| Specify whether to output the area, as computed from the baseline.
| Area Above Baseline (paa)
|| Specify whether to output the area above the baseline.
| Area Below Baseline (pab)
|| Specify whether to output the area below the baseline.
|| Specify whether to output the centroid.
|| Specify whether to output the FWHM (the full width at half the height of the source curve).
|Left Half Width (plhw)
|| Specify whether to output the left half width.
|Right Half Width (prhw)
|| Specify whether to output the right half width.
| Y Max (pymax)
|| Specify whether to output the Y value on the input curve at the X position where the Y on subtracted curve has the maximum absolute value.
| Index of X at YMax (pxofymax)
|| Specify whether to output the index of X for the Y Max value.
| Baseline (base)
|| Specify whether to output the baseline information.
|Notes: The name in the brackets is the tree node name, and the name outside is the tree node label. When an X-function executes by script, you have to assign values to tree nodes using their names. Special characters and spaces are not allowed in tree node names. However, you can use special characters and white space in the tree node label.
Baseline and Integrated Curve
| Baseline (base)
|| Specify whether to output the baseline information.
||Specify whether to output the Integral Curve.
|Output To (Outputto)
||Specify where to output the result .
The Fly-Out Menu
Click the triangle button near the top right corner of the ROI to open a fly-out menu that offers the following options:
||Output the result.
|New Output for All Curves (N)
||Output the results for all curves in the current layer to the specified worksheet (if not empty, append the results).
|New Output for All Layers (L)
||Output the results for all curves in all layers within the current graph to the specified worksheet (if not empty, append the results).
|Update Last Output
||Update the last output. Only available when there is already an output.
|Go to Result Worksheet
|| Go to the result worksheet once the result has been output to worksheet.
|Go to Source Worksheet
|| Go to the source worksheet
|| Change the input data.
|Expand to Full Plot(s) Range
|| Expand the ROI box to the full Plots range.
|Fix ROI Position
|| Fix the position of ROI box.
|| Save the settings in this dialog as a dialog theme.
|Save as <default>
|| Save the setting in this dialog as <default> theme.
|| Load the dialog theme pre-saved.
|| Open the Preferences dialog.
To perform integration on an area of a graph with the baseline at y=2, do the following:
- Create a new worksheet.
- Import the Origin sample data fftfilter1.DAT which is located in <Origin Program Folder>\Samples\Signal Processing.
- Select Plot: Line: Spline Connected from the Origin menu, to draw a graph.
- Select Gadgets: Integrate from the Origin menu when the graph window is active, to bring up the Data Exploration: addtool_curve_integ dialog box.
- Go to the Baseline tab. Choose Constant Y for the Method, and then enter 2 in the Y= edit box.
- Click the OK button. This will add a rectangle onto the plot. The integration area is shown at the top of the rectangle.
- Click the button and select New Output from the context menu. The results will be outputted to the Classic Script Window by default.