Relative Content

Tag Archive for pythonnumpymatplotlibconvolutionprobability-distribution

Why does my numpy convolution appear off-centred?

I’m trying to convolve two probability maps in Python with numpy.convolve, and decided to use mode=’same’ so that I could plot the convolution against the original distributions. However, my convolution doesn’t seem to be in the correct place, as I would expect its peak to lie between distributions A and B (see figure), or at the very least at a higher value of x than it is now. When I try using mode=’full’, the convolution occurs in a different place on the x-axis, but still does not occur where I would expect it. The location of the convolution in relation to the original arrays is very important to what I’m doing, so needs to occur between the other two distributions (provided by understanding of maths is right). I don’t know why this isn’t happening, so does anyone know how to fix it? Any help would be greatly appreciated!