ComplexWarning when calling convolve2d() in SciPy, why?
Question: When I run

    
    
    from scipy.signal import convolve2d
    convolve2d([[2, 2, 2], [1, 2, 3], [0, 1, 0]], [[0.5], [0.5]], 'valid')
    

I get

    
    
    Warning (from warnings module):
      File "C:\Program Files\Python 2.7\lib\site-packages\scipy\signal\signaltools.py", line 422
        return sigtools._convolve2d(in1, in2, 1, val, bval, fillvalue)
    ComplexWarning: Casting complex values to real discards the imaginary part
    

Why am I getting this, and how do I properly prevent it?


Answer: This is a bug that was fixed in release 0.12.0.

