Metadata-Version: 2.4
Name: saftig
Version: 0.2.0
Summary: Implementations of different static and adaptive filtering techniques for the prediction of a correlated signal component from witness signals.
Keywords: prediction,filtering,Wiener filter,LeastMeanSquares,noise cancellation
Author-Email: Tim Kuhlbusch <kuhlbusch@physik.rwth-aachen.de>
License-Expression: GPL-3.0-only
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Project-URL: Repository, https://github.com/timbk/saftig
Requires-Dist: numpy>=2.0.0
Requires-Dist: scipy
Requires-Dist: matplotlib
Requires-Dist: icecream
Requires-Dist: numba
Requires-Dist: psutil~=5.8
Requires-Dist: spicypy~=0.9
Provides-Extra: dev
Requires-Dist: coverage>=5.1; extra == "dev"
Requires-Dist: pylint>=3.0.3; extra == "dev"
Requires-Dist: black>=20.8; extra == "dev"
Requires-Dist: mypy>=1.15; extra == "dev"
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: sphinx-autoapi~=3.3; extra == "dev"
Description-Content-Type: text/markdown

# saftig – Static & Adaptive Filtering Techniques In Gravitational-wave-research

![Test status](https://github.com/timbk/saftig/actions/workflows/testing.yml/badge.svg)
![Linting status](https://github.com/timbk/saftig/actions/workflows/pylint.yml/badge.svg)
![Static type check status](https://github.com/timbk/saftig/actions/workflows/mypy.yml/badge.svg)

Python implementations of different static and adaptive filtering techniques for the prediction of a correlated signal component from witness signals.
The main goal is to provide a unified interface for the different filtering techniques.

[Documentation](https://saftig.readthedocs.io/en/latest/)

## Features

Static:
* Wiener Filter (WF)

Adaptive
* Updating Wiener Fitler (UWF)
* Least-Mean-Squares Filter (LMS)

Non-Linear:
* Experimental non-linear LMS Filter variant (PolynomialLMS)

## Install

From pypi: `pip install saftig`

From repository: `pip install .`

From repository (editable): `make ie`

## Minimal example

```python
>>> import saftig as sg
>>>
>>> # generate data
>>> n_channel = 2
>>> witness, target = sg.eval.TestDataGenerator([0.1]*n_channel).generate(int(1e5))
>>>
>>> # instantiate the filter and apply it
>>> filt = sg.filt.LMSFilter(n_filter=128, idx_target=0, n_channel=n_channel)
>>> filt.condition(witness, target)
>>> prediction = filt.apply(witness, target) # check on the data used for conditioning
>>>
>>> # success
>>> sg.eval.RMS(target-prediction) / sg.eval.RMS(prediction)
0.08221177645361015
```

## Terminology

* Witness signal w: One or multiple sensors that are used to make a prediction
* Target signal s: The goal for the prediction
