[SciPy-User] Sign or weights reversal in ndimage.convolve?

Juan Nunez-Iglesias jni.soma at gmail.com
Wed Feb 11 06:36:22 EST 2015


Hi,


Can someone clear up exactly what ndimage.convolve does with the weights input? Here's an example session:


In [1]: sig = np.array([0, 0, 1, 1, 0, 0])
In [2]: w = np.array([-1, 1])
In [3]: from scipy import ndimage as nd
In [4]: nd.convolve(sig, w)
Out[4]: array([ 0, -1,  0,  1,  0,  0])


I would have expected the output to be [0, 1, 0, -1, 0, 0]. ie:


out[1] = sig[1]w[0] + sig[2]w[1] = 0 * -1 + 1 * 1 = 1.


Where am I going wrong?


Thanks!


Juan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20150211/d45793c3/attachment.html>


More information about the SciPy-User mailing list