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: 67

PostPosted: Jun 17, 2019 9:34 PM    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: 721

PostPosted: Jun 18, 2019 9:54 AM    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: 67

PostPosted: Jun 19, 2019 11:25 AM    Post subject:

Is there something like ScalarTimeRatio for vectors?
jarek



Joined: Oct 22, 2007
Posts: 721

PostPosted: Jun 19, 2019 11:38 AM    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: 67

PostPosted: Jun 20, 2019 4: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: 721

PostPosted: Jun 20, 2019 4: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: 67

PostPosted: Jun 20, 2019 6: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: 721

PostPosted: Jun 20, 2019 6: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: 721

PostPosted: Jun 30, 2019 2: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: 67

PostPosted: Jul 2, 2019 9:52 PM    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: 721

PostPosted: Jul 2, 2019 10:11 PM    Post subject:

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