Jump to content

Histogram of a signal for values during a capsule condition only


Recommended Posts

Posted

I have a continuous time signal (say T) and a capsule defined by value search (eg. simple capsule Y>120) where Y is another signal.

I want to get the histogram of only the values of T that satisfy the the capsule condition, i.e.,

Get hist(T) from data pulled for all capsules where (Y(t)>120)

 

 

Posted

Hi SBC,

applying the the within() function to your signal will result in a new signal that only keeps those parts of the signal where the condition is met. The filtered signal can then be used for the histogram.
image.thumb.png.961b7ade1673971d0a9f0a4d79a06a9c.png

 

image.thumb.png.9c2fed71c3570b8bc13009bb31d232b9.png

Regards,

Thorsten

 

  • Like 1
Posted

One more comment on the post above:

The within() function is creating additional samples at the beginning and the end of the capsule. These additional sample have an effect on the calculations performed in the histogram. To avoid this you can use the remove() and inverse() function to remove parts of the data when the condition is not met:

image.thumb.png.c112d26df1a85a5a524a5202d6f67d52.png

In contrast to within() the remove() function will interpolate values if the distance between samples is less than the Maximum Interpolation setting of the signal. To avoid this when using remove you can combine the signal that the remove function creates with a signal that adds an "invalid" value at the beginning of each capsule so that the interpolation cannot be calculated:

$invalidsAtCapsuleStart = $condition.removeLongerThan(1wk).tosamples($c -> sample($c.startkey(), SCALAR.INVALID), 1s)

$signal.remove($condition.inverse()).combineWith($invalidsAtCapsuleStart)

You can see the different behaviours of the three described methods in the screenshot:

image.thumb.png.4859729f512eebdbaa28c9ee97968a3a.png

  • Thanks 1

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...