Jump to content

Calculate the median value of multiple signals over an interval


Recommended Posts

  • Super Seeqer

Quick method to calculate the median of multiple related signals over a time period 

image.png

$allSignals = combinewith($p1fr.move(1ns),
            $p2fr.move(2ns),
            $p3fr.move(3ns),
            $p4fr.move(4ns))

$allSignals.aggregate(median(),hours(),durationkey())

The first part of the formula combines all the samples from your signals of interest into a new single signal which has all of the datapoints from the first four signals. One trick with the combinewith() function is that it can't combine samples that occur at the exact same timestamp. Since I am using data from a csv file for this example where the timestamps for all 4 signals are exactly the same I use the move() function to slightly offset each of the signals by a nanosecond so that they all combine smoothly.

The final part of the formula is the aggregation where we can calculate the median value of our new combined signals which has all the sample form our prior 4 signals. In this example I am calculating an hourly median but this can be changed to daily() or a calculated condition that makes the most sense for your application. 

 

  • Like 2
Link to comment
Share on other sites

  • Shamus Cunningham changed the title to Calculate the median value of multiple signals over an interval
  • 2 years later...

This is quite crafty. Have there been any changes to the best way to do this? Not that there is anything wrong with it, just checking.

 

I wouldn't have figured this out if I was on a desert island with only a locally installed seeq instance, very lucky for the seeq forums 😄

Link to comment
Share on other sites

  • Seeq Team

Hi Ivan,

At the moment this is still the best way to calculate median with multiple signals. We did logged a feature request to simplify this method. If you are interested to receive an email when there's an update on this, please do submit a seeq ticket at https://seeq.atlassian.net/servicedesk/customer/portal/3.

Thank you.

  • Like 1
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
×
×
  • Create New...