Skip to main content

1€ filter (One Euro Filter)

Project description

PyPI Version Downloads

1€ filter

Provides a python implementation for the 1€ filter.

Install

pip install OneEuroFilter --upgrade

Minimal example

from OneEuroFilter import OneEuroFilter

config = {
    'freq': 120,       # Hz
    'mincutoff': 1.0,  # Hz
    'beta': 0.1,       
    'dcutoff': 1.0    
    }

f = OneEuroFilter(**config)

# First parameter is the value to filter
# the second parameter is the current timestamp in seconds
filtered = f(2.1, 0)

Doc

class OneEuroFilter.OneEuroFilter.OneEuroFilter(freq: float, mincutoff: float = 1.0, beta: float = 0.0, dcutoff: float = 1.0)

Bases: object

filter(x: float, timestamp: float = None)

Filters a noisy value.

  • Parameters:
    • x (float) – Noisy value to filter.
    • timestamp (float*,* optional) – timestamp in seconds.
  • Returns: the filtered value
  • Return type: float

reset()

Resets the internal state of the filter.

setBeta(beta: float)

Sets the Beta parameter.

  • Parameters: beta (float) – Parameter to reduce latency (> 0).

setDerivateCutoff(dcutoff: float)

Sets the dcutoff parameter.

  • Parameters: dcutoff (float) – Used to filter the derivates. 1 Hz by default. Change this parameter if you know what you are doing.

setFrequency(freq: float)

Sets the frequency of the input signal.

  • Parameters: freq (float) – An estimate of the frequency in Hz of the signal (> 0), if timestamps are not available.
  • Raises: ValueError – If one of the frequency is not >0

setMinCutoff(mincutoff: float)

Sets the filter min cutoff frequency.

  • Parameters: mincutoff (float) – Min cutoff frequency in Hz (> 0). Lower values allow to remove more jitter.
  • Raises: ValueError – If one of the frequency is not >0

setParameters(freq: float, mincutoff: float = 1.0, beta: float = 0.0, dcutoff=1.0)

Sets all the parameters of the filter.

  • Parameters:
    • freq (float) – An estimate of the frequency in Hz of the signal (> 0), if timestamps are not available.
    • mincutoff (float*,* optional) – Min cutoff frequency in Hz (> 0). Lower values allow to remove more jitter.
    • beta (float*,* optional) – Parameter to reduce latency (> 0).
    • dcutoff (float*,* optional) – Used to filter the derivates. 1 Hz by default. Change this parameter if you know what you are doing.
  • Raises: ValueError – If one of the parameters is not >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}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oneeurofilter-0.2.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

OneEuroFilter-0.2.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file oneeurofilter-0.2.1.tar.gz.

File metadata

  • Download URL: oneeurofilter-0.2.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for oneeurofilter-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5eff592a4f68f86334fe7a9dcf65fde69b11bceba759e8c19de044bcfd803b2a
MD5 1a7f4791bb1cec53d43e396c961c078b
BLAKE2b-256 8b9f7e1be35a8dff589acd1162d7e61f0255554582405a20eecbfb040d9cb0c3

See more details on using hashes here.

File details

Details for the file OneEuroFilter-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for OneEuroFilter-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a81db3155ea51c4f920762de04e888909d17e2af87d9e544947d20740f70fae8
MD5 9fbff00498c47efb81c2c4effaa93bf0
BLAKE2b-256 0963c394722ae007dc4edbee52588f0e27a59b1d9739721c249777eb67f30446

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page