Jump to content

Filter a Signal to View Only Samples with Values Above a Threshold


Recommended Posts

  • Seeq Team

FAQ:

I've got a signal with drop-outs and I want to filter my signal to only visualize samples with values above a threshold. Is there a quick way to do this in Seeq?

Solution:

We can use Seeq's Signal Filtering capabilities to break down a signal into individual samples and create a new signal that keeps the samples only above your specified threshold. 

1. Visualize your signal with drop-outs and determine the threshold value. For this example, we will filter out all samples with a value of less than or equal to 40F. 

image.png

2. Open a new Seeq Formula window and use the search documentation to look for information on filtering a signal. When we begin to type filter, we see right away an option "filter() Signal". Open the documentation to get an understanding of what the function is doing and example syntax. 

image.png

The first example below is taking a string signal and breaking it down into samples, then keeping samples only if their string value is not equal to 'T4A' (note single or double quotes are required for string inputs). The second example is filtering to remove infinite values or NaN values. The first logical statement "$sample.getValue().isValid()" is keeping only the samples with valid values, removing NaN or other invalid values. The second logical statement "$sample.getValue().isFinite()" is keeping only the samples with finite values. Note that we can string as many logical criteria together as we want here using the && operator. 

In our case, we want to filter our temperature signal to show only samples with values above 40F. The syntax in the formula input window below "$Temp.filter($sample -> ($sample.getValue().isGreaterThan(40)))" shows how we are able to take our temperature signal, break it down into individual samples, and then only keep samples whose value is greater than 40F. 

image.png

The new filtered signal appears nearly exactly the same as the original, but with the drop-outs removed. 

image.png

  • Like 1
Link to comment
Share on other sites

  • Administrators

The method I use in the newer versions of Seeq is the remove() function.  It shortens the syntax a little bit and gets around a transform.  See screenshots below for details.

image.png

The result.
image.png

Link to comment
Share on other sites

  • 1 year later...
  • Seeq Team

Hi Pat,

You will need to make sure that the maximum interpolation is less than the data being removed or else the data will be interpolated through the gaps. You can set the maximum interpolation in the formula as well by adding a .setmaxinterpolation(<time>) at the end.

  • Like 1
Link to comment
Share on other sites

That helped, thanks.  Would it make sense to have a trim or clamp function to make this easier?  All I want to do is to remove data outside of a range, and it seems you have to go pretty deep to get that to work

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...