SBC Posted August 15, 2022 Posted August 15, 2022 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)
Thorsten Vogt Posted August 16, 2022 Posted August 16, 2022 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. Regards, Thorsten 1
Thorsten Vogt Posted August 16, 2022 Posted August 16, 2022 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: 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: 1
SBC Posted August 16, 2022 Author Posted August 16, 2022 HI Thorsten, Thankyou very much, these functions are great solutions to my questions (and more...)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now