def numpy_corr(a, b, maxlag=None, unbiased=True): cross_corr = np.correlate(a, b, mode='full') if unbiased: cross_corr = sc.remove_bias(cross_corr) return cross_corr
def numpy_corr(a, b, maxlag=None, unbiased=True): cross_corr = np.correlate(a, b, mode="full") if unbiased: cross_corr = sc.remove_bias(cross_corr) return cross_corr
def test_remove_bias(self): begin = np.linspace(1, 4, 4) end = np.linspace(1, 3, 3) triang = np.zeros(len(begin) + len(end)) triang[:len(begin)] = begin triang[-len(end):] = end[::-1] output = sc.remove_bias(triang) ref = np.ones(len(triang)) np.testing.assert_array_equal(output, ref)
def test_remove_bias(self): begin = np.linspace(1, 4, 4) end = np.linspace(1, 3, 3) triang = np.zeros(len(begin) + len(end)) triang[: len(begin)] = begin triang[-len(end) :] = end[::-1] output = sc.remove_bias(triang) ref = np.ones(len(triang)) np.testing.assert_array_equal(output, ref)