def fft_cross_corr(a): M = a.shape[0] L = a.shape[1] cross_correlations = np.zeros((M**2, 2 * L - 1), dtype=np.complex128) for i in range(0, M): for j in range(0, M): cross_correlations[i * M + j, :] = sc.cross_correlate(a[i], a[j]) return cross_correlations
def fft_cross_corr(a): M = a.shape[0] L = a.shape[1] cross_correlations = np.zeros((M ** 2, 2 * L - 1), dtype=np.complex128) for i in range(0, M): for j in range(0, M): cross_correlations[i * M + j, :] = sc.cross_correlate(a[i], a[j]) return cross_correlations
def test_cross_correlate(self): inp1 = np.linspace(1, 4, 4) inp2 = np.linspace(4, 7, 4) out = sc.cross_correlate(inp1, inp2, maxlag=2, unbiased=False) ref = np.array([20, 38, 60, 47, 32]) np.testing.assert_array_almost_equal(out, ref)