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.
>>> convolve(np.arange(8), [1, 2], mode=VALID)
array([ 1, 4, 7, 10, 13, 16, 19])
>>> convolve(np.arange(8), [1, 2], mode=SAME)
array([ 0, 1, 4, 7, 10, 13, 16, 19])
>>> convolve(np.arange(8), [1, 2], mode=FULL)
array([ 0, 1, 4, 7, 10, 13, 16, 19, 14])
>>> convolve(np.arange(8), [1, 2, 3], mode=VALID)
array([ 4, 10, 16, 22, 28, 34])
>>> convolve(np.arange(8), [1, 2, 3], mode=SAME)
array([ 1, 4, 10, 16, 22, 28, 34, 32])
>>> convolve(np.arange(8), [1, 2, 3], mode=FULL)
array([ 0, 1, 4, 10, 16, 22, 28, 34, 32, 21])
>>> convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=VALID)
array([35, 56, 77])
>>> convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=SAME)
array([ 4, 10, 20, 35, 56, 77, 90, 94])
>>> convolve(np.arange(8), [1, 2, 3, 4, 5, 6], mode=FULL)
array([ 0, 1, 4, 10, 20, 35, 56, 77, 90, 94, 88, 71, 42])
>>> convolve([1.,2.], np.arange(10.))
array([ 0., 1., 4., 7., 10., 13., 16., 19., 22., 25., 18.])