Metadata-Version: 2.1
Name: sosfilt
Version: 1.0.0
Summary: Second-order section filtering with multiple filters
Home-page: https://github.com/angus-g/sosfilt
Author: Angus Gibson
Author-email: angus@agibson.me
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX
Description-Content-Type: text/markdown
Requires-Dist: scipy

# sosfilt

Second-order section filtering with multiple filters.

This library just extracts scipy's `sosfiltfilt` (and related)
method. Instead of taking a single SOS filter, with shape
`(n_sections, 6)`, it takes one filter for each core slice of the
input array. That is, the SOS filter has shape `(n_filters,
n_sections, 6)`, and the input array has shape `(..., n, ...`), where
the product of the shape of all the elided dimensions is
`n_filters`. Notably, it will not do any broadcasting along the
non-core dimensions.

The actual filtering algorithm employed within this library is exactly
the same as that within scipy. In that sense, results should be
identical. However, in order to vectorise the creation of the initial
conditions with `sosfilt_zi`, a direct calculation is employed, rather
than deferring to a linear solve. The result should be practically
identical, but it is possible that they aren't reproducible to machine
precision due to this adjustment.

## Installation

Install directly from the git repository, install from pypi with `pip
install sosfilt`, or install from conda with `conda install -c angus-g
sosfilt`.

## Example

```python
import sosfilt
import numpy as np
from scipy import signal

x = np.random.randn(5, 20, 5)
f = np.stack(
	[
		signal.butter(3, np.random.rand(), output="sos")
		for _ in range(25)
	]
)
sosfilt.sosfiltfilt(f, x, axis=1)
```


