def check_partial(self): xt = xc axis = -1 lag = 1 yt = autocorr_py(xt, lag, axis = axis) yr = yt.copy() for i in range(xt.shape[(axis +1) % 2]): tmp = correlate(xt[i], xt[i], 'full') center = xt[i].size - 1 assert_array_equal(tmp[center:center+1+lag], yt[i]) xt = xc axis = 0 lag = 1 yt = autocorr_py(xt, lag, axis = axis) yr = yt.copy() for i in range(xt.shape[(axis +1) % 2]): tmp = correlate(xt[:, i], xt[:, i], 'full') center = xt[:,i].size - 1 assert_array_equal(tmp[center:center+1+lag], yt[:, i])
def check_double_partial(self): # C, axis 1 test xt = xc axis = -1 lag = 1 yt = autocorr(xt, lag, axis = axis) yr = autocorr_py(xt, lag, axis = axis) assert_array_equal(yt, yr) # C, axis 0 test xt = xc axis = 0 lag = 0 yt = autocorr(xt, lag, axis = axis) yr = autocorr_py(xt, lag, axis = axis) assert_array_equal(yt, yr) # F, axis 0 test xt = xf axis = 1 lag = xt.shape[axis] - 1 yt = autocorr(xt, lag, axis = axis) yr = autocorr_py(xt, lag, axis = axis) assert_array_equal(yt, yr) # F, axis 1 test xt = xf axis = -1 lag = 1 yt = autocorr(xt, lag, axis = axis) yr = autocorr_py(xt, lag, axis = axis) assert_array_equal(yt, yr)
def check_float(self): # C, axis 1 test xt = xcf axis = -1 lag = xt.shape[axis] - 1 yt = autocorr(xt, lag, axis = axis) yr = autocorr_py(xt, lag, axis = axis) assert_array_equal(yt, yr) # C, axis 0 test xt = xcf axis = 0 lag = xt.shape[axis] - 1 yt = autocorr(xt, lag, axis = axis) yr = autocorr_py(xt, lag, axis = axis) assert_array_equal(yt, yr) # F, axis 0 test xt = xff axis = 0 lag = xt.shape[axis] - 1 yt = autocorr(xt, lag, axis = axis) yr = autocorr_py(xt, lag, axis = axis) assert_array_equal(yt, yr) # F, axis 1 test xt = xff axis = -1 lag = xt.shape[axis] - 1 yt = autocorr(xt, lag, axis = axis) yr = autocorr_py(xt, lag, axis = axis) assert_array_equal(yt, yr)