Main siteMain site  ForumForum  ForumSearch  Private messageEmail contact  RegisterRegister  Log inLog in 
Topic: Median value of TimeTransforms
Reply to topic
Author Message
EMebane



Joined: Apr 15, 2019
Posts: 108

PostPosted: Jun 18, 2019 2:34 AM    Post subject: Median value of TimeTransforms

I'd like to determine a median value of a range of values. I tried with TimeTransforms. Even better would be quartile values. Basically I want a moving average that is not impacted by large values from muscle movements so I want to disregard the high and low values in the Moving Average range. I don't see Median in VectorTimeTransform (nor ScalarTimeTransform).
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jun 18, 2019 2:54 PM    Post subject:

You can use ScalarTimeRatio for that. The "Time ratio" property set to 50 (%) will behave like normal median.
EMebane



Joined: Apr 15, 2019
Posts: 108

PostPosted: Jun 19, 2019 4:25 PM    Post subject:

Is there something like ScalarTimeRatio for vectors?
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jun 19, 2019 4:38 PM    Post subject:

No, I don't think so. The ScalarTimeRatio is used primarily for auto threshold.

It might be possible to do a median calculation on a vector in VectorExpressionEvaluator (I have no example).
EMebane



Joined: Apr 15, 2019
Posts: 108

PostPosted: Jun 20, 2019 9:33 PM    Post subject:

In ExpressionEvaluators I don't see an accumulation of historical values. They seem to only run an expression on the incoming live values.
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jun 20, 2019 9:47 PM    Post subject:

You could accumulate them in your own buffer. All expression evaluators can use regular (full) java code, so everything like Collections is available.
EMebane



Joined: Apr 15, 2019
Posts: 108

PostPosted: Jun 20, 2019 11:30 PM    Post subject:

OK. I didn't quite realize that ExpressionEvaluators represent objects that persist from tick to tick and can hold variables, etc. I was basically looking at them as method calls.
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jun 20, 2019 11:43 PM    Post subject:

Yes, you can use advanced settings to create and initialize variables/structures/classes which are fully persistent.
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jun 30, 2019 7:38 PM    Post subject:

FYI.

I added a new option to calculate Median in the VectorToScalar. It could make the above a little bit easier than using ExpressionEvaluator.

Available in version 4.073 or higher.
EMebane



Joined: Apr 15, 2019
Posts: 108

PostPosted: Jul 3, 2019 2:52 AM    Post subject:

Are you planning to add median (and perhaps quartile) to TimeTransforms (vectors and floats) as well? It will help in filtering out invalid high/low values.
jarek



Joined: Oct 22, 2007
Posts: 1073

PostPosted: Jul 3, 2019 3:11 AM    Post subject:

I see no point. The ScalarTimeRatio seems perfectly fine for that and is more flexible.
Reply to topic