Package Exports
- ml-savitzky-golay
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ml-savitzky-golay) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
savitzky-golay
Savitzky–Golay filter in Javascript
This code is based in the article: Smoothing and Differentiation of Data by Simplified Least Squares Procedures
Installation
npm install ml-savitzky-golay
SavitzkyGolay(data, h, [options])
Uses the Savitzky-Golay filter based in the array of y
values(data
) and the difference between x
dots(h
).
Options
- windowSize: The amount of dots used to make the filtering evaluation, the default value is 5.
- derivative: The grade for the derivative, the default value is 1.
- polynomial: The grade of the polynomial function to use for calculation, the default value is 2.
- pad: How to pad the array to handle borders. Can be one of:
'none'
(default): No padding. The resulting array will be smaller than the original one.'pre'
: Pad the original array before applying the filter'post'
: Pad the resulting array after applying the filter
- padValue: If pad is not none, Determine how to fill the values, if the value don't match with the next strings, the new values are going to be filled with that value.
The default value is 0. The special strings are:
'circular'
: Pad with circular repetition of elements within the dimension.'replicate'
: Pad by repeating border elements of array.'symmetric'
: Pad array with mirror reflections of itself.
Test
$ npm install
$ npm test