Skip to main content

optcutfreq

Automatic search of optimal filter cutoff frequency based on residual analysis

The 'optimal' cutoff frequency (in the sense that a filter with such cutoff frequency removes as much noise as possible without considerably affecting the signal) is found by performing a residual analysis of the difference between filtered and unfiltered signals over a range of cutoff frequencies.
The optimal cutoff frequency is the one where the residual starts to change very little because it is considered that from this point, it's being filtered mostly noise and minimally signal, ideally.

Installation

pip install optcutfreq

Or

conda install -c duartexyz optcutfreq

Examples

>>> y = np.cumsum(np.random.randn(1000))
>>> # optimal cutoff frequency based on residual analysis and plot:
>>> fc_opt = optcutfreq(y, freq=1000, show=True)

>>> # sane analysis but specifying the frequency limits and plot:
>>> optcutfreq(y, freq=1000, fclim=[200,400], show=True)

>>> # It's not always possible to find an optimal cutoff frequency
>>> # or the one found can be wrong (run this example many times):
>>> y = np.random.randn(100)
>>> optcutfreq(y, freq=100, show=True)

How to cite this work

Here is a suggestion to cite this GitHub repository:

Duarte, M. (2020) optcutfreq: Automatic search of optimal filter cutoff frequency based on residual analysis. GitHub repository, https://github.com/demotu/optcutfreq.

And a possible BibTeX entry:

@misc{Duarte2020,  
    author = {Duarte, M.},
    title = {optcutfreq: Automatic search of optimal filter cutoff frequency based on residual analysis},  
    year = {2020},  
    publisher = {GitHub},  
    journal = {GitHub repository},  
    howpublished = {\url{https://github.com/demotu/optcutfreq}}  
}

License

The non-software content of this project is licensed under a Creative Commons Attribution 4.0 International License, and the software code is licensed under the MIT license.

Release files for optcutfreq 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for optcutfreq 0.0.8
File Size Uploaded
optcutfreq-0.0.8.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for optcutfreq 0.0.8
File Interpreter ABI Platform
optcutfreq-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / optcutfreq-0.0.8.tar.gz

Download URL optcutfreq-0.0.8.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ba7326b15c7460c9d8ebab896adae9f90e1ebd55bc1c3f86e0bd4bc242d27c67
BLAKE2b-256 checksum
How to use checksums
1553489d651e3989edfca5564126bd866355ca653b9cd59b9900a47e134e0d0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1.post20200323 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release files / optcutfreq-0.0.8-py3-none-any.whl

Download URL optcutfreq-0.0.8-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a13389deb5d46b901cd20cb9ff0026db854ba39e8ff7e343c88a843e4bded5e4
BLAKE2b-256 checksum
How to use checksums
55ec051075c44704b99283b7511ec77d900a0d474da51d1b10f0573353611b60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1.post20200323 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page