I would like to determine the running sum of true values, but reset to zero when an element is false.
For example, the input:
np.array([0,0,1,1,1,1,0,0,0,1,0,1,0,0,1,1])
would result in:
np.array([0,0,1,2,3,4,0,0,0,1,0,1,0,0,1,2])
I prefer a pure numpy solution