def zero_crossings(data):
 zx = np.zeros(len(data))
 zx[np.where(((data[:(-1)] * data[1:]) < 0))] = 1
 return zx

def zero_crossings ( data ) : zx = np . zeros ( len ( data ) ) zx [ np . where ( ( ( data [ : ( - 1 ) ] * data [ 1 : ] ) < 0 ) ) ] = 1 return zx
return a vector of length n-1 of zero-crossings within vector data .