Metadata-Version: 2.1
Name: fir1
Version: 1.3.0.9
Summary: Efficient FIR realtime filter
Home-page: https://github.com/berndporr/fir1
Author: Bernd Porr
Author-email: mail@berndporr.me.uk
License: MIT
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python

====
Fir1
====

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 binaries::

    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

You can also install from source::

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


Windows
-------

There is a pre-compiled package which can be installed
via pip::

    pip3 install fir1

If you want to compile from source you first need to
build the static fir windows library which is called
`fir_static.lib`. Open the command line and type::

    cmake -G "Visual Studio 15 2017 Win64" .

Then start Visual Studio and build `fir.sln`. Go
back to the command line and type::

    python setup.py install


Usage
=====

Realtime filtering
------------------

The filter is a realtime filter which receives samples
one by one so it can process data as it arrives 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()`` receives the filter coefficients 
(= impulse response) 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.


