[SciPy-user] convolve2d.. or Numeric to numarray conversion

Travis Oliphant scipy-user@scipy.net
17 Feb 2003 22:25:23 -0700

On Sun, 2003-02-16 at 18:20, Kasper Souren wrote:
> > Look at the scipy.signal package
> >
> > info(scipy.signal.convolve)
> >
> > will do N-D convolution for you.
> That's what I had found before. But I didn't mention in the list; in fact I 
> forgot about it.
> It works fine, but only for N = 1...
> >>> signal.convolve(zeros((5,5)), zeros((5,5)))
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python2.2/site-packages/Numeric/Numeric.py", line 205, 
> in convolve
>     return cross_correlate(a,asarray(v)[::-1],mode)
> ValueError: Object too deep for desired array
> And the zen of this message is yet too deep for me to comprehend. Maybe my 
> earthly desires are still too grand to commence on this journey ;)

I'm sorry you are running into trouble.  

The problem is that your version of SciPy has a bug which overwrites the
correct convolve function (that handles N-d) with the one in Numeric
which only handles 1-d. 

The current version (in CVS) works correctly.  Or you can fix it with a
simple line change in scipy/signal/__init__.py 

-Travis O.