2.11.17 smooth
Menu Information
Analysis: Signal Processing: Smooth
Brief Information
Performing smoothing of XY data to remove noise or irregularities
Additional Information
This feature is updated in 9.1 SR1. With the options of Lowess and Loess as smoothing method.
Command Line Usage
1. smooth //Perform default smoothing to active data plot or highlighted 1st column in worksheet. smooth %C also works so
2. smooth (1,2) //Perform default SavitzkyGolay filtering using default settings, to XY data in columns 1, 2 of the active worksheet
3. smooth iy:=Col(2) boundary:=periodic; //Perform default SavitzkyGolay filtering with Boundary Condition set to periodic, to Y data in 2nd column of active worksheet
4. smooth iy:=Col(2) polyorder:=3; //Perform Perform default SavitzkyGolay filtering with Polynomial Order set to 2, to Y data in 2nd column of active worksheet
5. smooth iy:=Col(2) method:=pf percent:=70; //Perform smoothing with Percentile Filtering method, percentile is set to 70, to Y data in 2nd column of active worksheet
6. smooth t "my short noise removal theme.oth" //Perform smoothing to active plot or selected column using a presaved smoothing theme file you saved in the smoothing dialog
7. smooth d //open smooth dialog
Variables
Display Name

Variable Name

I/O and Type

Default Value

Description

Input

iy

Input
XYRange

<active>

Specifies the input XY data range to be smoothed

Method

method

Input
int

sg

Specifies the smoothing method to be used. The default is SavitzkyGolay.
Option list
 aav: AdjacentAveraging (0)
 This method essentially takes the average of a certain number (which you specify) of data points around each point in your data and replaces that point with the new average value.
 sg: SavitzkyGolay (1, default)
 This method is actually performing a local polynomial regression. It is best suited to remove noise without affecting the overall signal shape. Original data values are replaced with fitted values.
 pf: Percentile Filter (2)
 This method is also known as rankorder filter. It essentially finds the specified percentile of data points in the data window around each point in your data and replaces that point with the percentile. It is best suited for removing shot noise.
 fft:FFT Filter (3)
 This method is based on FFT lowpass filter. It should be used when the frequency of noise is higher than the true signal. In essence, it removes the highfrequency components with a parabolic window. Frequencies not less than the cutoff frequency will be discarded.
 lw:Lowess (4)
 le:Loess (5)
 These two options above are "locally weighted scatter plot smoothing". They are best used when there are a large number of data points. Please refer to the algorithm page for details.
 bm:Binomial (6)
 This method uses a weighted moving average filter whose weight is derived from binomial coefficients. It is a lowpass filter for removing high frequency noise.

Weighted Average

weight

Input
int

0

This parameter is available only when Method is AdjacentAveraging. When this parameter is set to 1 (checked), weighted averaging will be used.

Use Proportion for Span

prop

Input
int

1

This variable is available only when Method is either Lowess or Loess. Specify whether to use the proportion (01) for span, or use point of windows.

Span (01)

span

Input
double

0.1

This is only available when Use Proportion for Span is selected (i.e. prop = 1). It specifies the proportion value for the span.The bigger the value is, the smoother the curve will be.

Points of Window

npts

Input
int

5

If FFT Filter is not selected for Method, this parameter specifies the number of points in the moving window. Otherwise, you can use this parameter to control the cutoff frequency for the FFT filter. The greater this value, the greater the degree of smoothing. It must be a nonzero positive value. See the Algorithm part for the computation of cutoff frequency.

Boundary Condition

boundary

Input
int

none

Specifies the boundary condition. It is not available when FFT Filter/Lowess/Loess is selected for Method.
Option list
 none:None
 Does no padding
 reflect:Reflect
 Pads data by reflecting signal at both ends
 repeat:Repeat
 Pads data by repeating the ending point at both ends
 periodic:Periodic
 Treats data as a periodic signal
 extrap:Extrapolate
 Uses linear extrapolation to pad signal at both ends

Polynomial Order

polyorder

Input
int

2

This parameter applies only to the SavitzkyGolay smoothing option. It specifies the polynomial order.

Percentile

percent

Input
double

50

This parameter determines the percentile to be used in percentile filtering. The default is 50%, which corresponds to replacing the signal point with median value of the data points in the data window.

Cutoff Frequency

cutoff

Input
double

0

This parameter is visible in GUI when FFT Filter is selected for Method. It is a readonly variable showing the cutoff frequency of the lowpass filter calculated from Points of Window. Please do not use it in script.

Pad to Power of 2 Points

pad

Input
int

0

This parameter is available only when FFT Filter is selected for Method. It is available only from script. It specifies whether to pad the number of data points to power of 2. When this is set to 1, the result will match the result calculated with Origin prior to the Version 8. See more details in the Algorithm part.

Filter Type

filter

Input
int

new

This parameter is available only when FFT Filter is selected for Method. It is available only from script. It specifies the filter type. When old is selected, the result will match the result calculated with Origin prior to the Version 8.
Option list:
 lowpass parabolic filter
 old:Lowpass parabolic(7.5)
 lowpass parabolic filter which is used in Origin 7.5

Baseline to Subtract

baseline

Input
int

two_ends_1

This parameter is available only when FFT Filter is selected for Method. It is available only from script. It specifies whether to subtract a baseline before fft filtering is used.
Option list:
 two_ends:Straight Line Obtained from End Points
 Subtracts the input data with a straight line constructed from the two end points before fft filtering is applied.
 two_ends_1:Straight Line Obtained from the mean of 1% End Points
 Subtracts the input data with a straight line constructed from the mean of 1% end points before fft filtering is applied.
 No subtraction is performed on input data before fft filtering is applied.

Output

oy

Output
XYRange

<new>

Specifies the destination of smoothed signal.
See the syntax here.

Examples
This example shows how import gaussian.dat into Origin.
Use white_noise XFunction to add white noise to it.
Use plotxy XFunction to plot the noised data
Smooth the data and then plot the the smoothed data in another new graph.
// Load data to a new book
fname$ = system.path.program$ + "\Samples\Curve Fitting\Gaussian.dat";
newbook;
impASC;
string bkn$=%H;
// add noise into the data
white_noise [bkn$]1!(2) level:=10;
// plot the noised data
plotxy [bkn$]!(1,2) plot:=200 ogl:=[<new>]<new>;
// smooth the noised data
newsheet book:=bkn$ name:="Smoothed Data";
copydata [bkn$]1!(1) [bkn$]"Smoothed Data"!(1);
smooth iy:=[bkn$]1!(2) oy:=[bkn$]"Smoothed Data"!(2) npts:=10;
// plot the smoothed data
plotxy [bkn$]"Smoothed Data"!(1,2) plot:=200 ogl:=[<new>]<new>;
More Information
For more information, please refer to our User Guide.
Related XFunctions
fft1, fft_filters, wtsmooth
Keywords:adjacent averaging, savitzky golay, fft filter, lowess, loess, binomial, percentile
