Savitzky Golay Filter

Applies a Savitzky-Golay filter to the input data along the channel axis (for each pixel individually) for the purposes of smoothing with the additional possibility of calculating numerical derivatives.

Category

category_preprocessing Preprocessing

Node

sgolay_node

Parameters

Points: the width of the filter function, in number of data points.

Order: the order the polynomials to fit. This must be at most one less than half of the number of points specified.

DerivativeOrder: the order of the derivative to be calculated. This must be at most the order of the polynomial.

Inputs

Input: the input data

Outputs

Output: the output data

Effect of the Filter

The filter applies Savitzky-Golay Smoothing to the input data along the channel axis. Its purpose is to smooth the data and reduce noise, but it can also be used to calculate numerical derivatives.

The Points parmeter specifies how many adjacent points are to be used to fit the Savitzky-Golay polynomials; specifying a larger number will smooth out the curve more, but potentially start to remove actual features in the data.

By default the data is just smoothed out (DerivativeOrder is set to zero), but a numerical derivative may be calculated by setting DerivativeOrder to a number larger than zero. For example, to calculate the first derivative, set DerivativeOrder to 1. This manner of calculating a numerical derivative is more stable against noise than a naive implementation of numerical differentiation.

The following screenshot demonstrates how the filter smooths out a spectrum with the default settings (red: original spectrum, blue: smoothed spectrum):

_images/sgolay_result.png

See also