How I can restart fmax counting when a condition occurs?
I got two numpy arrays, I call np.fmax.accumulate
on the first, but when it touches the second array value at the same index, it should turns to the first array value at the same index, and then reset and restart maximum accumulating.
Example:
array2 = np.array([4,4,4,3,5,2,1])
array1 = np.array([1,2,3,2,4,1,0.5])
max = np.fmax.accumulate(array1)
0 1 2 3 4 5 6
array2 4 4 4 3 5 2 1
array1 1 2 3 2 4 1 0.5
max 1 2 3 3 4 4 4
expected output 1 2 3 2 4 1 0.5
^ ^ ^
Can I do this using JUST numpy or at least NO LOOPS?