Tried to optimize second_window function.

Using numpy.lib.stride_tricks.as_strided to mimic the sliding window behavior. This allows to calculate the min and max for each sliding window with vectorization.
From there we can have only one tight loop written in Python which clip the last_value within min and max from the sliding window.

Another optimization was to set the mask when calculating the clump_unmasked. In the inner loop, we only touch to the .data ndarray which is then much faster.

On my machine, I try this code:
From master branch:
%timeit second_window(np.ma.array(np.random.random_sample((5000,))), 2, 3)
10 loops, best of 3: 56.5 ms per loop

From the second_window_optimize branch, 
%timeit second_window(np.ma.array(np.random.random_sample((5000,))), 2, 3)
100 loops, best of 3: 15.4 ms per loop

Best regards,
Daniel.