[Scipy-tickets] [SciPy] #595: scipy.signal.fftconvolve can not return complex results because of bug

SciPy scipy-tickets@scipy....
Sat Jan 26 15:49:12 CST 2008


#595: scipy.signal.fftconvolve can not return complex results because of bug
------------------------+---------------------------------------------------
 Reporter:  psederberg  |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:  0.7     
Component:  Other       |     Version:          
 Severity:  normal      |    Keywords:          
------------------------+---------------------------------------------------
 Hi Folks:

 I think I've found a minor bug in fftconvolve that prevents complex
 results from getting returned.

 At the top of the function you'll find the following code:

 {{{
 def fftconvolve(in1, in2, mode="full"):
     """Convolve two N-dimensional arrays using FFT. See convolve.

     """
     s1 = array(in1.shape)
     s2 = array(in2.shape)
     if (s1.dtype.char in ['D','F']) or (s2.dtype.char in ['D', 'F']):
         cmplx=1
     else: cmplx=0

 }}}

 As you can see, new vectors are created containing the size of each of the
 input vectors.  These vectors will always be int32, which means that cmplx
 will never get set to 1.

 The correct code should be:

 {{{
     if (in1.dtype.type in [numpy.float, numpy.double]) or \
        (in2.dtype.type in [numpy.float, numpy.double]):
         cmplx=1
     else: cmplx=0
 }}}

 Note the change both to what ndarrays' types get checked and how they get
 checked.

 I'll look into becoming a contributing developer to numpy/scipy, but in
 the meantime hopefully someone can fix this before the next release.

 Best,
 Per

-- 
Ticket URL: <http://scipy.org/scipy/scipy/ticket/595>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list