예제 #1
0
def test_ccor():
    #Testing the corr function independently
    t1 = TimeSeries([1, 2, 3, 4], [40, 50, 60, 70])
    t2 = TimeSeries([1, 2, 3, 4], [40, 50, 60, 70])
    val = _corr.ccor(t1, t2)
    assert(list(np.real(val)) == [12600, 12000, 11800, 12000])
    assert(list(np.imag(val)) == [0, 0, 0, 0])
예제 #2
0
def test_ccor():
    #Testing the corr function independently
    t1 = TimeSeries([1, 2, 3, 4], [40, 50, 60, 70])
    t2 = TimeSeries([1, 2, 3, 4], [40, 50, 60, 70])
    val = _corr.ccor(t1, t2)
    assert (list(np.real(val)) == [12600, 12000, 11800, 12000])
    assert (list(np.imag(val)) == [0, 0, 0, 0])
예제 #3
0
def test_corr():
    """
    Test cross-correlation functions.
    """

    arr_1 = np.linspace(1, 0, 50, dtype=complex)
    arr_2 = np.arange(0, 50, dtype=complex)
    ts_1 = TimeSeries(arr_2, arr_1)
    ts_2 = TimeSeries(arr_2, arr_2)
    out_arr = _corr.ccor(ts_1, ts_2)

    # Ensure result is consistent with numpy.fft.
    test_arr = np.fft.ifft(np.fft.fft(ts_1) * np.conj(np.fft.fft(ts_2)))
    assert np.allclose(out_arr, test_arr)

    # Test max_corr_at_phase using actual precomputed value of maxcorr.
    idx, maxcorr = _corr.max_corr_at_phase(ts_1, ts_2)
    assert idx == 25
    assert np.isclose(maxcorr, 718.87755102040819)
예제 #4
0
def test_corr():
    """
    Test cross-correlation functions.
    """

    arr_1 = np.linspace(1, 0, 50, dtype=complex)
    arr_2 = np.arange(0, 50, dtype=complex)
    ts_1 = TimeSeries(arr_2, arr_1)
    ts_2 = TimeSeries(arr_2, arr_2)
    out_arr = _corr.ccor(ts_1, ts_2)

    # Ensure result is consistent with numpy.fft.
    test_arr = np.fft.ifft(np.fft.fft(ts_1) * np.conj(np.fft.fft(ts_2)))
    assert np.allclose(out_arr, test_arr)

    # Test max_corr_at_phase using actual precomputed value of maxcorr.
    idx, maxcorr = _corr.max_corr_at_phase(ts_1, ts_2)
    assert idx == 25
    assert np.isclose(maxcorr, 718.87755102040819)