mvtsa.simplify.smooth_states#

mvtsa.simplify.smooth_states(labels, min_duration)[source]#

Absorb runs shorter than min_duration samples into a neighbouring run (the longer neighbour), repeatedly, until all runs are long enough.

>>> smooth_states([0, 0, 0, 1, 0, 0, 2, 2, 2], 2).tolist()
[0, 0, 0, 0, 0, 0, 2, 2, 2]