{"id":18757194,"url":"https://github.com/jaantollander/oneeurofilter","last_synced_at":"2025-04-07T11:07:36.908Z","repository":{"id":46067502,"uuid":"162690438","full_name":"jaantollander/OneEuroFilter","owner":"jaantollander","description":"Simple Python and Julia implementations of the 1€ Filter. The codes can be used as a pseudocode for implementing the algorithm in other languages.","archived":false,"fork":false,"pushed_at":"2023-03-28T10:28:51.000Z","size":1417,"stargazers_count":293,"open_issues_count":2,"forks_count":38,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T09:08:15.275Z","etag":null,"topics":["noise-filter","noise-filtering","one-euro-filter","python"],"latest_commit_sha":null,"homepage":"https://jaantollander.com/post/noise-filtering-using-one-euro-filter/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaantollander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jaantollander"}},"created_at":"2018-12-21T08:53:01.000Z","updated_at":"2025-03-15T22:47:59.000Z","dependencies_parsed_at":"2024-11-07T17:58:24.042Z","dependency_job_id":null,"html_url":"https://github.com/jaantollander/OneEuroFilter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaantollander%2FOneEuroFilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaantollander%2FOneEuroFilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaantollander%2FOneEuroFilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaantollander%2FOneEuroFilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaantollander","download_url":"https://codeload.github.com/jaantollander/OneEuroFilter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247640462,"owners_count":20971557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["noise-filter","noise-filtering","one-euro-filter","python"],"created_at":"2024-11-07T17:41:58.417Z","updated_at":"2025-04-07T11:07:36.883Z","avatar_url":"https://github.com/jaantollander.png","language":"Python","funding_links":["https://github.com/sponsors/jaantollander"],"categories":[],"sub_categories":[],"readme":"# 1€ Filter (One Euro Filter)\nA simple Python implementation of the 1€ Filter (1e filter, 1 euro filter, One Euro Filter). The code in [`one_euro_filter.py`](./python/one_euro_filter.py) can be used as pseudocode for implementing the algorithm in other languages. Detailed pseudocode about the underlying mathematics of the algorithm and sources can be found in a blog post that I wrote about it, [Noise Filtering Using 1€ Filter](https://jaantollander.com/post/noise-filtering-using-one-euro-filter/).\n\n```python\nimport math\n\n\ndef smoothing_factor(t_e, cutoff):\n    r = 2 * math.pi * cutoff * t_e\n    return r / (r + 1)\n\n\ndef exponential_smoothing(a, x, x_prev):\n    return a * x + (1 - a) * x_prev\n\n\nclass OneEuroFilter:\n    def __init__(self, t0, x0, dx0=0.0, min_cutoff=1.0, beta=0.0,\n                 d_cutoff=1.0):\n        \"\"\"Initialize the one euro filter.\"\"\"\n        # The parameters.\n        self.min_cutoff = float(min_cutoff)\n        self.beta = float(beta)\n        self.d_cutoff = float(d_cutoff)\n        # Previous values.\n        self.x_prev = float(x0)\n        self.dx_prev = float(dx0)\n        self.t_prev = float(t0)\n\n    def __call__(self, t, x):\n        \"\"\"Compute the filtered signal.\"\"\"\n        t_e = t - self.t_prev\n\n        # The filtered derivative of the signal.\n        a_d = smoothing_factor(t_e, self.d_cutoff)\n        dx = (x - self.x_prev) / t_e\n        dx_hat = exponential_smoothing(a_d, dx, self.dx_prev)\n\n        # The filtered signal.\n        cutoff = self.min_cutoff + self.beta * abs(dx_hat)\n        a = smoothing_factor(t_e, cutoff)\n        x_hat = exponential_smoothing(a, x, self.x_prev)\n\n        # Memorize the previous values.\n        self.x_prev = x_hat\n        self.dx_prev = dx_hat\n        self.t_prev = t\n\n        return x_hat\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaantollander%2Foneeurofilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaantollander%2Foneeurofilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaantollander%2Foneeurofilter/lists"}