def test_getZeroCrossingTimes(): # Set up a simple triangle wave with 2.5 cycles y = np.array([-1., 1., -1., 1., -1., 1.]) t = np.arange(len(y)) Fs = 1. / np.mean(np.diff(t)) xtimes = t[:-1] + (0.5 * np.diff(t)) zc = ZeroCrossing(y, Fs, t0=t[0]) np.testing.assert_allclose(xtimes, zc.getZeroCrossingTimes())