Package: pyfilters-lib
Filters SDKDescriptionIt 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:high pass - high pass filter (HPF). Cuts off all frequencies below the filter pass frequencylow pass - low pass filter (LPF). Cuts off all frequencies above filter pass frequency.band pass - bandpass filter. Passes a certain bandwidthband 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.TypesFilterTypeType of filter, enum with values:FtHP - high pass filterFtLP - low pass filterFtBandStop - band stop filterFtBandPass - band pass filterFtNone - default value, type not setFilterParamParameters of filter, structure with fields:type - type of filtersamplingFreq - sampling frequency of raw signal, integer valuecutoffFreq - central frequency, double valuePreinstalled filtersLibrary contains a list of some filters. The full list you can get with functions:Pythonpreinstalled_filters=preinstalled_filters_list()InitializationFor work with filter you need to create aFilterobject and optionallyFilterListobject. TheFilterListcontains objects of theFiltertype and manipulates them.Python# creating filterfilter=Filter()param=FilterParam(FilterType.ft_band_stop,250,100)filter.init_by_param(param)# then create list of filtersfilter_list=FilterList()# and add the filterflist.add_filter(filter)UsageFilter one value:Pythonsample=SAMPLEfilteredValue=flist.Filter(sample)Filter array of values:Python# by one filtersamples=[xforxinrange(max_samples)]filter.filter_array(samples);# by list of filterssamples=[xforxinrange(max_samples)]flist.filter_array(samples);Finishing work with the libraryPython# removing filtersdelfilter# removing list of filtersdelflist