Skip to main content

Efficient FIR realtime filter

Project description

An efficient finite impulse response (FIR) filter class written in C++ with python wrapper.

The class offers also adaptive filtering using the least mean square (LMS) or normalised least mean square (NLMS) algorithm.

Installation

Linux

If you want to install it via pip you first need to install the fir1 filter package:

sudo add-apt-repository ppa:berndporr/usbdux
sudo apt-get update
sudo apt install fir1
sudo apt install fir1-dev
Then install the python package with pip::
pip3 install fir1

Note that this will install from source so you need to have swig installed.

You can also install from source:

git clone https://github.com/berndporr/fir1
cd fir1
cmake .
make
make install
python3 setup.py install

Windows

The setup.py is alpha and needs to be tested.

Usage

Realtime filtering

The filter is a realtime filter which always receives the values one by one so can process data as it comes in from an ADC converter. This is simulated here with the for loop:

import fir1
b = signal.firwin(999,0.1)
f = fir1.Fir1(b)
for i in range(len(noisy_signal)):
    clean_signal[i] = f.filter(noisy_signal[i])

The constructor Fir1(b) receives the coefficients and then filtering is performed with the method filter().

LMS adaptive filter

Please check the C++ code for examples and the main github page. The functions are identical.

Project details


Download files

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

Files for fir1, version 1.3.0.7
Filename, size File type Python version Upload date Hashes
Filename, size fir1-1.3.0.7-cp36-cp36m-win_amd64.whl (27.5 kB) File type Wheel Python version 3.6 Upload date Hashes View hashes
Filename, size fir1-1.3.0.7-py3.6-linux-x86_64.egg (75.2 kB) File type Egg Python version 3.6 Upload date Hashes View hashes
Filename, size fir1-1.3.0.7-py3.6-win-amd64.egg (30.4 kB) File type Egg Python version 3.6 Upload date Hashes View hashes
Filename, size fir1-1.3.0.7.tar.gz (52.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page