Give an option for finding the starts/stops with a slope/derivative based approach rather than having it return to baseline. That works when we don't care at all about separately closely spaced events, but for the mechanical stims that are ~3-5 seconds apart, they should be separated but the current method does not.
PsuedoCode:
if this i frame >Threshold for 3 frames
If the slope is >0
Continue until the slope is below 0 (it's decreasing) for at least 3 frames then assign an End
else
While i>threshold
check each next ith frame if slope>0
i++
Give an option for finding the starts/stops with a slope/derivative based approach rather than having it return to baseline. That works when we don't care at all about separately closely spaced events, but for the mechanical stims that are ~3-5 seconds apart, they should be separated but the current method does not.
PsuedoCode: if this i frame >Threshold for 3 frames If the slope is >0 Continue until the slope is below 0 (it's decreasing) for at least 3 frames then assign an End else While i>threshold check each next ith frame if slope>0 i++