[UNMAINTAINED] 1D noise reduction filters
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2016-12-02 23:18:51 +01:00
lib Fix: If no compareFunc specified, sort compares values as strings 2014-10-04 08:39:22 +03:00
test Fix: If no compareFunc specified, sort compares values as strings 2014-10-04 08:39:22 +03:00
.gitignore Ignore patterns. 2012-07-18 08:15:42 +02:00
.travis.yml Travis 2012-07-18 08:25:57 +02:00
index.js Add aggregate. 2012-09-22 12:49:06 +02:00
LICENSE Relicense as MIT 2012-08-11 12:04:52 +02:00
package.json 1.0.6 2014-10-06 22:14:18 +02:00
README.md This project is unmaintained 2016-12-02 23:18:51 +01:00

This project is not actively maintained

Issues and pull requests on this repository may not be acted on in a timely manner, or at all. You are of course welcome to use it anyway. You are even more welcome to fork it and maintain the results.

Unmaintained

filters build status

This module implements 1D noise reduction filters. There are currently two available:

  • median filter

  • rolling average with threshold

median

median(data, windowSize)
  • data: An array of numbers.

  • windowSize: The size of the window over which the median is applied. Should be an odd number greater than one, defaults to 3.

Example

var median = require('filters').median;
var raw = [ 2, 3, 4, 9, 6, 2 ];
console.log(median(raw));
// => [ 2, 3, 4, 6, 6, 2 ]

average

average(data, windowSize, threshold)
  • data: An array of numbers.

  • windowSize: The size of the rolling average window. Should be two or greater, defaults to 3.

  • threshold: Maximum difference between two numbers for the average still to be applied. Use this to smooth out small variations but large varitions through immediately. The difference between /a/ and /b/ is calculated as /(max(a, b) - min(a, b)) / max(a, b)/. No default.

Example

var median = require('filters').average;
var raw = [ 2, 3, 4, 9, 6, 2 ];
console.log(average(raw, 3, 0.5));
// => [ 2, 2.5, 3, 9, 7.5, 2 ]

License

MIT