def numpy_zero_crossings2(array):
    nonzero_array = array[np.nonzero(array)]
return (nonzero_array[:-1] * nonzero_array[1:] < 0).sum()
Different results to counting zero-crossings of a large sequence