New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

filters

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filters

1D noise reduction filters

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
46
increased by130%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 06 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc