Real-Time Expressions: Filter Out Unwanted Data


Filter out unwanted data by removing specific data points and/or ranges of data values. The filter operation utilizes the real-time expression comparison operators (!==, ==, <, <=, >, >=). Comparison operations can be chained together to apply multiple filters.


A Single Filter
=[data stream] <operator> <value>

Multiple Filters
=[data stream] <operator1> <value1> <operator2> <value2> <operator3><value3>


The data stream above, pitch, has several erroneously high data points that are squashing the line graph. 

To filter out these data points (in this example, remove any value above 3), open up the tile configuration and apply the following expression:

=[pitch] < 3

With the erroneous data points removed, the shape of the actual signal can be easily seen.

To filter out a specific data point in addition to the previous filter, simply add another <operator> <value> to the end of the expression. For example, to also filter out the largest data value in the data stream, 2.64, use the following expression:

=[pitch] < 3 != 2.64

Notice that the y-axis of the line graph above changed from a max of 2.64 to 2.51 because the previous max value was removed from the dataset. Additional filters could be applied by continuing to chain <operator> <value> pairs to the expression.

The resulting filtered dataset can be combined with other expression operations by simply using ( ) to group the filtered data set and applying the corresponding expression operator. For example, a smooth operation can be applied to the filtered dataset using the following expression:

=smooth([pitch] < 3 != 2.64)

Filtered datasets can be a part of nested functions. For example, a round to two decimal places operation can be performed on the smoothed, filtered dataset using the following expression:

=math.round(smooth([pitch] < 3 != 2.64), 2)

Feedback and Knowledge Base