FilterContinuousVariableEx
Filters a continuous variable using the specified frequency filter. Returns a reference to the new variable with filtered values.
Syntax
FilterContinuousVariableEx(contVar, filterType, filterImplementation, filterOrder, freq1, freq2, ripple=1.0)
Parameters
Parameter |
Type |
Description |
---|---|---|
contVar |
variableReference |
Reference to the variable. |
filterType |
string |
The type of the filter. Should be |
filterImplementation |
string |
Filter implementation. Should be |
filterOrder |
number |
The number specifying the filter order. Use 1 to 12 for IIR filters, 4 and higher for FIR filters. If FIR filter order is odd, order+1 is used. |
freq1 |
number |
Filter frequency parameter (in Hz). See comments below. |
freq2 |
number |
Filter frequency parameter (in Hz). See comments below. |
ripple |
number |
Filter ripple. Used for |
Return
Returns reference to the new continuous variable with filtered values.
Note
Python only.
If the filter type is Lowpass
or Highpass
, freq1
is a cutoff frequency and freq2
is not used.
If the filter type is Bandpass
or Bandstop
, freq1
is the minimum of the frequency range
and freq2
is the maximum of the frequency range.
If the filter type is Notch
, freq1
is the center of the Notch filter and freq2
is the width of the Notch filter.
Standard Notch filter is used.
Examples
The following sample script applies Hamming FIR band-pass filter to the variable ContChannel01
.
The result of filtering is then saved in a continuous variable Cont1BandFiltered
.
The filter order is 51 and the frequency band is from 1000 Hz to 2000 Hz.
Python
import nex
doc = nex.GetActiveDocument()
var = doc["ContChannel01"]
doc["Cont1BandFiltered"] = nex.FilterContinuousVariableEx(var, "Bandpass", "FIR Hamming", 51, 1000, 2000)