2.13.5 Peaks and Baseline

This section deals with Origin's X-Functions that perform peak and baseline calculations, especially valuable for analyses pertaining to spectroscopy.

X-Functions For Peak Analysis

The following table lists the X-Functions available for peak analysis. You can obtain more information on these functions from the X-Function Reference help file.

Name Brief Description
pa

Perform peak analysis with a pre-saved Peak Analyzer theme file.

paMultiY Perform batch processing of peak analysis on multiple Y datasets
pkFind

Pick peaks.

fitpeaks

Fit multiple peaks.

blauto

Create baseline anchor points.

interp1xy

Interpolate the baseline anchor points to create baseline.

subtract_ref

Subtract existing baseline dataset from source data.

smooth

Smooth the input prior to performing peak analysis.

integ1

Perform integration on the selected range or peak.

For peaks that do not require baseline treatment or other advanced options, you can also use peak functions to perform nonlinear fitting. For more information on non-linear fitting from script, please see the Curve Fitting section.

The following sections provide examples on peak analysis.

Creating a Baseline

This example imports a sample data file and creates baseline anchor points using the blauto X-Function.

newbook;
filepath$ = "Samples\Spectroscopy\Peaks on Exponential Baseline.dat";
fname$ = system.path.program$ + filepath$;
impASC;
 
//Create 20 baseline anchor points
range rData = (1,2), rBase =(3, 4);
blauto iy:=rData number:=20 oy:=rBase;

Plot the data and anchor points in same graph:

// plot a line graph of the data
plotxy rData 200 o:=[<new>];
// plot baseline pts to same layer as scatter 
plotxy rBase 201 color:=2 o:=1!;

Finding Peaks

This example uses the pkFind X-Function to find peaks in XY data:

// Import sample pulse data
newbook;
fname$ = system.path.program$ + "Samples\Spectroscopy\Sample Pulses.dat";
impASC;
// Find all positive peaks above a peak height value of 0.2
range rin=(1,2);
range routx = 3, routy=4;
pkfind iy:=rin dir:=p method:=max npts:=5 filter:=h value:=0.2
       ocenter:=<none> ocenter_x:=routx ocenter_y:=routy;

Now graph the data as line plot and the peak x,y as scatter:

plotxy iy:=rin plot:=200;
// Set x output column as type X and plot the Y column
routx.type = 4; 
plotxy iy:=routy plot:=201 color:=2 o:=1;

Integrating and Fitting Peaks

X-Functions specific to the goals of directly integrating peaks, or fitting multiple peaks, do not exist. Therefore, to perform peak fitting or integration, one must first use the Peak Analyzer dialog to create and save a theme file. Once a theme file has been saved, the pa or paMultiY X-Functions can be utilized to perform integration and peak fitting from script.