Jump to content

User Reference:ExpressionFilter

From BCI2000 Wiki
Revision as of 17:36, 16 January 2008 by Mellinger (talk | contribs)

Function

The ExpressionFilter uses Arithmetic Expressions to determine its output. Additionally, a warning message may be sent to the operator module, depending on an expression's value.

Parameters

WarningExpression

A boolean expression. Whenever this expression evaluates to true, a warning message is displayed in the operator module's log window. Set this parameter to the empty string to disable the warning message.

Expressions

A matrix of arithmetic expressions that determines the filter's output signal; output signal dimensions are derived from matrix dimensions: Matrix rows correspond to signal channels, and matrix columns correspond to signal elements (samples). For each signal block, each of the expressions is evaluated, and the result is entered into the corresponding element in the output signal. Expressions may contain references to the filter's input signal, and to state variables (see examples).

When the Expressions parameter is an empty matrix, the ExpressionFilter will return its input unchanged.

States

Any available state may enter into one of the expressions.

Examples

When the JoystickFilter is used to track a joystick position, the JoystickXpos and JoystickYpos state variables represent joystick position. When the ExpressionFilter is present in the signal processing module, sitting between LinearClassifier and Normalizer, it may be configured to control the cursor directly by joystick position, using this 2-by-1 matrix:

JoystickXpos
JoystickYpos

In the same configuration, to re-enable cursor movement by the output of signal processing without removing the ExpressionFilter from the signal processing module, use this matrix:

Signal(0,0)
Signal(1,0)

The following 2-by-2 matrix will replace a 2-by-2 input signal with its square. Additionally, when the ResultCode state variable is nonzero, the output will be zero.

Signal(0,0)^2*(ResultCode==0)   Signal(0,1)^2*(ResultCode==0)
Signal(1,0)^2*(ResultCode==0)   Signal(1,1)^2*(ResultCode==0)

See also

User Reference:Expression Syntax