Skip to main content

Second-order section filtering with multiple filters

Project description

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

import sosfilt
import numpy as np

x = np.random.randn(5, 20, 5)
# 25 random lowpass filters
f = sosfilt.butter(3, np.random.rand(25))

sosfilt.sosfiltfilt(f, x, axis=1)

Project details


Download files

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

Source Distribution

sosfilt-1.3.0.tar.gz (455.7 kB view hashes)

Uploaded Source

Built Distributions

sosfilt-1.3.0-pp310-pypy310_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (178.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

sosfilt-1.3.0-pp310-pypy310_pp73-macosx_10_9_x86_64.whl (156.2 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

sosfilt-1.3.0-pp39-pypy39_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (178.4 kB view hashes)

Uploaded PyPy manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

sosfilt-1.3.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (156.0 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

sosfilt-1.3.0-pp38-pypy38_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (178.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

sosfilt-1.3.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (155.5 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

sosfilt-1.3.0-pp37-pypy37_pp73-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (178.0 kB view hashes)

Uploaded PyPy manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

sosfilt-1.3.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (155.4 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

sosfilt-1.3.0-cp311-cp311-musllinux_1_2_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

sosfilt-1.3.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (190.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

sosfilt-1.3.0-cp311-cp311-macosx_10_9_x86_64.whl (165.9 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

sosfilt-1.3.0-cp310-cp310-musllinux_1_2_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

sosfilt-1.3.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (190.9 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

sosfilt-1.3.0-cp310-cp310-macosx_10_9_x86_64.whl (166.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

sosfilt-1.3.0-cp39-cp39-musllinux_1_2_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

sosfilt-1.3.0-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (191.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

sosfilt-1.3.0-cp39-cp39-macosx_10_9_x86_64.whl (167.0 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

sosfilt-1.3.0-cp38-cp38-musllinux_1_2_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ x86-64

sosfilt-1.3.0-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (192.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

sosfilt-1.3.0-cp38-cp38-macosx_10_9_x86_64.whl (166.3 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

sosfilt-1.3.0-cp37-cp37m-musllinux_1_2_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.2+ x86-64

sosfilt-1.3.0-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (190.4 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

sosfilt-1.3.0-cp37-cp37m-macosx_10_9_x86_64.whl (165.0 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page