FilterContinuousVariable

Filters the specified continuous variable using the specified frequency filter.

Syntax

FilterContinuousVariable(doc, contVar, filteredVarName, filterType, filterOrder, freq1, freq2)

Parameters

Parameter

Type

Description

doc

documentReference

Reference to the document.

contVar

variableReference

Reference to the variable.

filteredVarName

string

The name of the filtered variable.

filterType

string

The type of the filter. Should be ‘Lowpass’, ‘Highpass’, ‘Bandpass’, ‘Bandstop’ or ‘Notch’

filterOrder

number

The number specifying the filter order. Should be between 3 and 11 inclusive.

freq1

number

Filter frequency parameter (in Hz). See comments below.

freq2

number

Filter frequency parameter (in Hz). See comments below.

Return

None.

Note

If the filter type is Lowpass or Highpass, freq1 is a cutoff frequency and freq2 is not used. Butterworth filter is 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. Butterworth filter is used.

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 scripts apply band-pass filter to the variable ContChannel01. The result of filtering is then saved in a continuous variable Cont1BandFiltered. The filter order is 5 and the frequency band is from 1000 Hz to 2000 Hz:

Python

import nex
doc = nex.GetActiveDocument()
var = doc["ContChannel01"]
nex.FilterContinuousVariable(doc, var, "Cont1BandFiltered", "Bandpass", 5, 1000, 2000)

NexScript

doc = GetActiveDocument()
var = doc["ContChannel01"]
FilterContinuousVariable(doc, var, "Cont1BandFiltered", "Bandpass", 5, 1000, 2000)