Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

DEP: Remove "old behavior" of fftconvolve, so it's the same as convol…

…ve/correlate, etc.
  • Loading branch information...
commit 66fe7c892906373caf64f116d72f9d2edb97f53e 1 parent 0be0fac
@endolith endolith authored rgommers committed
Showing with 7 additions and 6 deletions.
  1. +7 −6 scipy/signal/
13 scipy/signal/
@@ -163,13 +163,14 @@ def fftconvolve(in1, in2, mode="full"):
if mode == "full":
return ret
elif mode == "same":
- if product(s1, axis=0) > product(s2, axis=0):
- osize = s1
- else:
- osize = s2
- return _centered(ret, osize)
+ return _centered(ret, s1)
elif mode == "valid":
- return _centered(ret, abs(s2 - s1) + 1)
+ for d1, d2 in zip(in1.shape, in2.shape):
+ if not d1 >= d2:
+ raise ValueError(
+ "in1 should have at least as many items as in2 in "
+ "every dimension for 'valid' mode.")
+ return _centered(ret, s1 - s2 + 1)
def convolve(in1, in2, mode='full'):

3 comments on commit 66fe7c8


This commit broke a test in statsmodels. I'm not sure whether it's my fault for swapping the arguments to fftconvolve, but code that worked formerly for mode == "valid" won't work now, and it's not stated in the documentation what exactly is expected.


Deprecation warning in 0.12.x would make sense. I'll put that on my todo list.


Should be fixed by gh-477. Can you check that that works for you?

Please sign in to comment.
Something went wrong with that request. Please try again.