[SciPy-user] Data convolution.

Travis E. Oliphant oliphant at ee.byu.edu
Wed May 26 13:33:33 CDT 2004


Andrea Riciputi wrote:
> Hi,
> I need to perform convolution on a set of two dimensional data resulting 
> from a numerical simulation. Since my numerical simulation is written in 
> Python and C (for CPU intensive task), I'm wondering if scipy is able to 
> fit my needs. I've read the tutorial but it's quite terse about the 
> topic, further I've found a reference to FFT section that has not been 
> written.
> 

Yes, you can do convolution.

from scipy import *

info(signal.convolve)

should give more information.  But... this is really for convolution 
where one or both of the inputs are small for 2.D. FIR filtering (say 
less than 32x32 -- not really sure of the cutoff size).

Convolution of large data sets can be done  be done with FFT's (but 
their will be boundary wrapping issues that you will need to address --- 
or ignore depending on what you are doing).

To get something to compare with

c = signal.convolve(a,b)

will do the job.  An optional third input will control the size of the 
resulting output.  Post if you have further questions.

-Travis O.





More information about the SciPy-user mailing list