コード例 #1
0
def test_convolve1():
    """
    convolve(data, kernel, mode=FULL)
    Returns the discrete, linear convolution of 1-D
    sequences a and v; mode can be 0 (VALID), 1 (SAME), or 2 (FULL)
    to specify size of the resulting sequence.
    """
    result = convolve.convolve(np.arange(8), [1, 2], mode=VALID)
    test = np.array([ 1,  4,  7, 10, 13, 16, 19])
    assert_equal(result.all(),test.all())
コード例 #2
0
def test_convolve6():
    result = convolve.convolve(np.arange(8), [1, 2, 3], mode=FULL)
    test = np.array([ 0,  1,  4, 10, 16, 22, 28, 34, 32, 21])
    assert_equal(result.all(),test.all())
コード例 #3
0
def test_convolve5():
    result = convolve.convolve(np.arange(8), [1, 2, 3], mode=SAME)
    test = np.array([ 1,  4, 10, 16, 22, 28, 34, 32])
    assert_equal(result.all(),test.all())
コード例 #4
0
def test_convolve4():
    result = convolve.convolve(np.arange(8), [1, 2, 3], mode=VALID)
    test = np.array([ 4, 10, 16, 22, 28, 34])
    assert_equal(result.all(),test.all())
コード例 #5
0
def test_convolve3():
    result = convolve.convolve(np.arange(8), [1, 2], mode=FULL)
    test = np.array([ 0,  1,  4,  7, 10, 13, 16, 19, 14])
    assert_equal(result.all(),test.all())
コード例 #6
0
def test_convolve10():
    result = convolve.convolve([1.,2.], np.arange(10.))
    test = np.array([  0.,   1.,   4.,   7.,  10.,  13.,  16.,  19.,  22.,  25.,  18.])
    assert_equal(result.all(),test.all())
コード例 #7
0
def test_convolve9():
    result = convolve.convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL)
    test = np.array([ 0,  1,  4, 10, 20, 35, 56, 77, 90, 94, 88, 71, 42])
    assert_equal(result.all(),test.all())
コード例 #8
0
def test_convolve8():
    result = convolve.convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME)
    test = np.array([ 4, 10, 20, 35, 56, 77, 90, 94])
    assert_equal(result.all(),test.all())
コード例 #9
0
def test_convolve7():
    result = convolve.convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID)
    test = np.array([35, 56, 77])
    assert_equal(result.all(),test.all())