npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

1eurofilter

v1.2.2

Published

Algorithm to filter noisy signals for high precision and responsiveness.

Downloads

145

Readme

NPM Version npm downloads

1€ filter typescript version

Provides a typescript implementation for the 1€ filter.

Install

npm install 1eurofilter

Minimal example

import {OneEuroFilter} from '1eurofilter'

let frequency = 120; // Hz
let mincutoff = 1.0; // Hz
let beta = 0.1;      
let dcutoff = 1.0; 

let f = new OneEuroFilter(frequency, mincutoff, beta, dcutoff);

let noisyvalue = 2.1;
let timestamp = 0.0; // in seconds

let filtered = f.filter(noisyvalue, timestamp);

Doc

constructor

new OneEuroFilter(freq, mincutoff, beta, dcutoff)

Constructs a 1 euro filter.

Parameters

| Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | freq | number | undefined | An estimate of the frequency in Hz of the signal (> 0), if timestamps are not available. | | mincutoff | number | 1.0 | Min cutoff frequency in Hz (> 0). Lower values allow to remove more jitter. | | beta | number | 0.0 | Parameter to reduce latency (> 0). | | dcutoff | number | 1.0 | Used to filter the derivates. 1 Hz by default. Change this parameter if you know what you are doing. |

filter

filter(value, timestamp): number

Returns the filtered value.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | value | number | Noisy value to filter | | timestamp | number | (optional) timestamp in seconds |

reset

reset(): void

Resets the internal state of the filter.

setBeta

setBeta(beta): void

Sets the Beta parameter

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | beta | number | Parameter to reduce latency (> 0). |

setDerivateCutoff

setDerivateCutoff(dcutoff): void

Sets the dcutoff parameter

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | dcutoff | number | Used to filter the derivates. 1 Hz by default. Change this parameter if you know what you are doing. |

setFrequency

setFrequency(freq): void

Sets the frequency of the signal

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | freq | number | An estimate of the frequency in Hz of the signal (> 0), if timestamps are not available. |

setMinCutoff

setMinCutoff(mincutoff): void

Sets the filter min cutoff frequency

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | mincutoff | number | Min cutoff frequency in Hz (> 0). Lower values allow to remove more jitter. |

setParameters

setParameters(freq, mincutoff, beta): void

Sets the parameters of the 1 euro filter.

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | freq | number | An estimate of the frequency in Hz of the signal (> 0), if timestamps are not available. | | mincutoff | number | Min cutoff frequency in Hz (> 0). Lower values allow to remove more jitter. | | beta | number | Parameter to reduce latency (> 0). |

Related publication

DOI

@inproceedings{10.1145/2207676.2208639,
    author = {Casiez, G\'{e}ry and Roussel, Nicolas and Vogel, Daniel},
    title = {1 € Filter: A Simple Speed-Based Low-Pass Filter for Noisy Input in Interactive Systems},
    year = {2012},
    isbn = {9781450310154},
    publisher = {Association for Computing Machinery},
    address = {New York, NY, USA},
    url = {https://doi.org/10.1145/2207676.2208639},
    doi = {10.1145/2207676.2208639},
    pages = {2527–2530},
    numpages = {4},
    keywords = {noise, jitter, lag, precision, filtering, responsiveness, signal},
    location = {Austin, Texas, USA},
    series = {CHI '12}
}