Skip to content

← signal_processing package

FIRFilter

Apply FIR filter to signal.

Together with the IIR filter, this is one of the two default ways to select or remove frequency bands in a signal. The FIR filter delays the signal more than the IIR filter, but has less signal phase distortion in the region between passband (retained frequencies) and stopband (suppressed frequencies); however, the FIR filter is more CPU intensive for the same amount of filtering, especially when the low cutoff frequencies are being used. This filter maintains internal state to filter seamlessly across chunk boundaries. On the first few samples the filter will exhibit some minor artifacts, but is initialized to have minimal step response. More Info... Version 1.1.2

Ports/Properties

data

Data to process.

verbose name
Data
default value
None
port type
DataPort
value type
Packet (can be None)
data direction
INOUT

kernel

Filter kernel.

verbose name
Kernel
default value
None
port type
DataPort
value type
Packet (can be None)
data direction
OUT

axis

Axis along which to filter. Rarely anything other than 'time' is used here.

verbose name
Filter Along Axis
default value
time
port type
ComboPort
value type
str (can be None)

order

Filter order. If unspecified, this will be auto-determined based on the tightness of the transition bands and the desired stopband attenuation (using the Kaiser window rule). Note that high orders (e.g., 1000 or greater) will be fairly heavy on the CPU, especially with many channels.

verbose name
Filter Order
default value
None
port type
IntPort
value type
int (can be None)

frequencies

Transition frequencies. For a lowpass/highpass filter, you can either give the cutoff frequency, or two frequencies to determine the rolloff curve. For a bandpass/bandstop filter, you can give two cutoff frequencies, or 4 frequencies to determine the rolloff curve. The syntax for 'freeform' filters is [(frequency1, gain1), (frequency2, gain2), ...], and you can use the special frequency value -1 as a stand-in for the highest frequency at which a filter can be designed for the given sampling rate (the signal's Nyquist frequency).

verbose name
Frequencies
default value
[0.25, 0.5, 45, 50]
port type
ListPort
value type
list (can be None)

mode

Filter mode. Low/highpass lets low/high frequencies through, bandpass lets frequencies in a limited band through, and bandstop (a.k.a. notch) removes frequency in a limited band. The freeform mode (rarely used) can design arbitrary filters by specifying frequencies in the spectrum and corresponding desired gain factors.

verbose name
Filter Mode
default value
bandpass
port type
EnumPort
value type
str (can be None)

minimum_phase

Design minimum-phase filter. If enabled, a filter with minimum signal delay will be designed, which will distort the signal phases, especially in the transition region. If disabled, a linear-phase filter will be designed, which will not distort the signal at all, but which incurs a delay of half the filter order in samples.

verbose name
Minimum Phase
default value
True
port type
BoolPort
value type
bool (can be None)

antisymmetric

Design antisymmetric filter. This designs rarely-used / special-purpose filters for signal differentiation or 90 degree phase shifting. Make sure you specify the order explicitly and choose and odd number if you use this.

verbose name
Antisymmetric
default value
False
port type
BoolPort
value type
bool (can be None)

stop_atten

Minimum attenuation in stopband. This is the minimum acceptable attenuation, in dB, in the stopband, which is ideally infinitely suppressed, but in practice 30-80 dB are enough, depending on the amplitudes of the signals to attenuate.

verbose name
Min Stopband Attenuation
default value
50.0
port type
FloatPort
value type
float (can be None)

convolution_method

FIRFilter coefficients can be convolved with the input signal using multiple methods. The standard method performs time-domain convolution. For long signals (>214 samples) using filters with a modest number of coefficients (>24), it can be faster to do the convolution in the frequency domain using the overlap-add method.

verbose name
Method Of Convolution
default value
standard
port type
EnumPort
value type
str (can be None)

cut_preringing

Cut off the pre-ringing portion generated by the filter. This is currently only supported in linear-phase mode and offline.

verbose name
Cut Preringing
default value
False
port type
BoolPort
value type
bool (can be None)

direction

Filtering direction. This describes how information is propagated during the filter process. Forward means that an event (e.g., a spike) will result in a ripple that follows the event. Forward-backward means that the ripple will propagate in both directions, and will be symmetric around the event, but this results in effects preceding their causes, which can be problematic when performing causality analysis and is not replicable in real time. Gap-aware filtering additionally respects data boundaries (e.g., where bad time windows have been cut out) and does not propagate information across them.

verbose name
Filtering Direction
default value
forward
port type
EnumPort
value type
str (can be None)

verbose

Enable verbose logging. This will log when the filtering is completed and duration of the filtering process.

verbose name
Verbose
default value
False
port type
BoolPort
value type
bool (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)