Jump to content

Histogram of a signal for values during a capsule condition only


SBC

Recommended Posts

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)

 

 

Link to comment
Share on other sites

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