import numpy as np def slip_beginnings(x) : # returns indicies i for which x[i-1]=0 and x[i]>0 starts = [] prev = False for i in range(len(x)) : if (not prev and x[i]) : starts.append(i) prev = x[i] return starts