Click or drag to resize

SavitzkyGolayFilter Class

Class SavitzkyGolayFilter is a correlation filter specialized for filtering with Savitzky-Golay coefficients with additional boundary options for better edge continuity. The default boundary option ShiftFilterCenter provides data smoothing all the way boundary ends.
Inheritance Hierarchy
SystemObject
  CenterSpace.NMath.CoreCorrelationFilter
    CenterSpace.NMath.CoreSavitzkyGolayFilter

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
[SerializableAttribute]
public class SavitzkyGolayFilter : CorrelationFilter, 
	ICloneable

The SavitzkyGolayFilter type exposes the following members.

Constructors
 NameDescription
Public methodSavitzkyGolayFilter Constructs a
C#
SavitzkyGolayFilter
for smoothing using Savitzky-Golay coefficients. This creates a filter of width five using a third order smoothing polynomial.
Public methodSavitzkyGolayFilter(Int32) Constructs a
C#
SavitzkyGolayFilter
for smoothing using Savitzky-Golay coefficients. This creates a filter of width of five.
Public methodSavitzkyGolayFilter(Int32, Int32, Int32) Constructs a
C#
SavitzkyGolayFilter
for data smoothing using Savitzky-Golay coefficients fitted to a polynomial of order
C#
polynomialOrder
.
Public methodSavitzkyGolayFilter(Int32, Int32, Int32, Int32) Constructs a
C#
SavitzkyGolayFilter
instance which implements a correlation filter using Savitzky-Golay coefficients. Either the data or a derivative of
C#
derivativeOrder
of the data can be smoothed.
Top
Properties
 NameDescription
Public propertyBoundaryOption Gets/Sets the current boundary option.
Public propertyNumberLeft Gets the number of points left of the filtering window center point.
Public propertyNumberOfCoefficients Gets the number of filter coefficients. Effectively the filter width.
(Inherited from CorrelationFilter)
Public propertyNumberRight Gets the number of points right of the filtering window center point.
Public propertyWindowWidth Gets the width of the moving window.
Top
Methods
 NameDescription
Public methodClone Creates a deep copy of this SavitzkyGolayFilter instance.
Protected methodCorrelate Does the correlation and takes care of internal correlation and work objects.
(Inherited from CorrelationFilter)
Public methodFilter(DoubleVector) Filters
C#
data
using the current boundary option.
(Overrides CorrelationFilterFilter(DoubleVector))
Public methodFilter(DoubleVector, DoubleVector) Filters
C#
data
using the current boundary option.
(Overrides CorrelationFilterFilter(DoubleVector, DoubleVector))
Public methodScaleDerivative Scales raw Savitzky-Golay derivatives given the abscissa step size.
Top
Fields
 NameDescription
Protected fieldcoefficients_ Filtering coefficients for correlation operation.
(Inherited from CorrelationFilter)
Protected fieldwork_ Provides a working vector for correlation results.
(Inherited from CorrelationFilter)
Top
Remarks
The width of the filter is: numberLeft + numberRight + 1. Note that smoothing boundaries requires significantly more computational effort than zero padding. The current boundary option can be set using the
C#
BoundaryOption
property.
Example
SavitzkyGolayFilter sgf = new SavitzkyGolayFilter(2, 2, 3, 0); // Width 5, Polynomial degree 3 sgf.BoundaryOption = SavitzkyGolayFilter.SavitzyGolayBoundaryOptions.DoNotFilterBoundaryPoints; DoubleVector x = new DoubleVector(2, 1, 1, 3, 1, 1, 2); DoubleVector z = sgf.Filter(x);
See Also