Skip to main content

Filters SDK

Description

It is a cross-platform library that allows you to filter the signal with a given set of filters for a specified sampling rate.

The library provides built-in filters of the following types:

  1. high pass - high pass filter (HPF). Cuts off all frequencies below the filter pass frequency
  2. low pass - low pass filter (LPF). Cuts off all frequencies above filter pass frequency.
  3. band pass - bandpass filter. Passes a certain bandwidth
  4. band stop is a band reject filter. Suppresses a certain band.

Digital signal processing involves the formation of the necessary bandwidth and suppression of network interference. The bandwidth is formed by sequential application of VFD and LPF filters. The HPF removes the constant component of the signal and the drift of the isoline, attracting the signal to 0. The LPF removes high-frequency noise from the signal. Mains interference caused by mains interference usually has the frequency of the mains itself - 50 Hz for Russia and CIS countries and 60 Hz for America and some other countries. Mains interference often has a very high amplitude signal and even when outside the signal bandwidth it still gives significant distortion, which leads to the need to suppress it with regenerative filters.

Maximum available signal bandwidth directly depends on sampling frequency and according to Nyquest law does not exceed half of sampling frequency. In practice, usually guided by the rule - Fh=Fd/4. Thus, if we have a sampling frequency of 1000 Hz, the maximum signal frequency will be 250 Hz. This value can be pushed higher, up to 400 Hz, but the higher the frequency, the lower the accuracy of the signal transmission will be.

Thus, a typical signal processing chain is the use of LPF, LPF and the required number of notch filters. The order in which the filters are applied does not matter.

Each filter has a set of internal coefficients, which are recalculated after each new sample of the signal. This means that you cannot use the same instance of the filter class to process multiple signals at once. The rule 1 filter - 1 signal works here.

Types

FilterType

Type of filter, enum with values:

  1. FtHP - high pass filter
  2. FtLP - low pass filter
  3. FtBandStop - band stop filter
  4. FtBandPass - band pass filter
  5. FtNone - default value, type not set

FilterParam

Parameters of filter, structure with fields:

  1. type - type of filter
  2. samplingFreq - sampling frequency of raw signal, integer value
  3. cutoffFreq - central frequency, double value

Preinstalled filters

Library contains a list of some filters. The full list you can get with functions:

preinstalled_filters = preinstalled_filters_list()

Initialization

For work with filter you need to create a Filter object and optionally FilterList object. The FilterList contains objects of the Filter type and manipulates them.

# creating filter
filter = Filter()
param = FilterParam(FilterType.ft_band_stop, 250, 100)
filter.init_by_param(param)

# then create list of filters
filter_list = FilterList()

# and add the filter
flist.add_filter(filter)

Usage

Filter one value:

sample = SAMPLE
filteredValue = flist.Filter(sample)

Filter array of values:

# by one filter
samples = [x for x in range(max_samples)]
filter.filter_array(samples);

# by list of filters
samples = [x for x in range(max_samples)]
flist.filter_array(samples);

Finishing work with the library

# removing filters
del filter

# removing list of filters
del flist

Metadata

Release files for pyfilters-lib 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfilters-lib 1.0.3
File Size Uploaded Provenance Actions
pyfilters_lib-1.0.3.tar.gz 336.2 kB Without provenance Details for pyfilters_lib-1.0.3.tar.gz

Release files / pyfilters_lib-1.0.3.tar.gz

Download URL pyfilters_lib-1.0.3.tar.gz
Size 336.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b8c2c318b7d6cdfd4d777697b5ed86e40f4d995e18f31f68d73c513805f11769
BLAKE2b-256 checksum
How to use checksums
6c0fa7235d06e3b520fcac9a37e585b1c513f945771f492d44618d5cf61d6931
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.6

Security for pyfilters-lib 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page