[Scipy-svn] r7076 - in branches/0.9.x: doc/release scipy/signal scipy/signal/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Sun Jan 23 02:20:40 EST 2011
Author: rgommers
Date: 2011-01-23 01:20:40 -0600 (Sun, 23 Jan 2011)
New Revision: 7076
Modified:
branches/0.9.x/doc/release/0.9.0-notes.rst
branches/0.9.x/scipy/signal/signaltools.py
branches/0.9.x/scipy/signal/sigtoolsmodule.c
branches/0.9.x/scipy/signal/tests/test_signaltools.py
Log:
DEP: Remove old behavior of correlate/convolve.
(backport of r7075)
Modified: branches/0.9.x/doc/release/0.9.0-notes.rst
===================================================================
--- branches/0.9.x/doc/release/0.9.0-notes.rst 2011-01-23 07:18:07 UTC (rev 7075)
+++ branches/0.9.x/doc/release/0.9.0-notes.rst 2011-01-23 07:20:40 UTC (rev 7076)
@@ -107,6 +107,16 @@
were added.
+Improved statistical tests (``scipy.stats``)
+--------------------------------------------
+
+A new function ``scipy.stats.fisher_exact`` was added, that provides Fisher's
+exact test for 2x2 contingency tables.
+
+The function ``scipy.stats.kendalltau`` was rewritten to make it much faster
+(O(n log(n)) vs O(n^2)).
+
+
Deprecated features
===================
@@ -124,16 +134,6 @@
- ``vackar`` (renamed to ``diagbroyden``)
-Improved statistical tests (``scipy.stats``)
---------------------------------------------
-
-A new function ``scipy.stats.fisher_exact`` was added, that provides Fisher's
-exact test for 2x2 contingency tables.
-
-The function ``scipy.stats.kendalltau`` was rewritten to make it much faster
-(O(n log(n)) vs O(n^2)).
-
-
Removed features
================
@@ -147,6 +147,18 @@
functionality is still available by specifying ``mode='economic'``.
+Old correlate/convolve behavior (in ``scipy.signal``)
+-----------------------------------------------------
+
+The old behavior for ``scipy.signal.convolve``, ``scipy.signal.convolve2d``,
+``scipy.signal.correlate`` and ``scipy.signal.correlate2d`` was deprecated in
+0.8.0 and has now been removed. Convolve and correlate used to swap their
+arguments if the second argument has dimensions larger than the first one, and
+the mode was relative to the input with the largest dimension. The current
+behavior is to never swap the inputs, which is what most people expect, and is
+how correlation is usually defined.
+
+
``scipy.stats``
---------------
Modified: branches/0.9.x/scipy/signal/signaltools.py
===================================================================
--- branches/0.9.x/scipy/signal/signaltools.py 2011-01-23 07:18:07 UTC (rev 7075)
+++ branches/0.9.x/scipy/signal/signaltools.py 2011-01-23 07:20:40 UTC (rev 7076)
@@ -22,18 +22,6 @@
_boundarydict = {'fill':0, 'pad':0, 'wrap':2, 'circular':2, 'symm':1,
'symmetric':1, 'reflect':4}
-_SWAP_INPUTS_DEPRECATION_MSG = """\
-Current default behavior of convolve and correlate functions is deprecated.
-
-Convolve and corelate currently swap their arguments if the second argument
-has dimensions larger than the first one, and the mode is relative to the input
-with the largest dimension. The new behavior is to never swap the inputs, which
-is what most people expects, and is how correlation is usually defined.
-
-You can control the behavior with the old_behavior flag - the flag will
-disappear in scipy 0.9.0, and the functions will then implement the new
-behavior only."""
-
def _valfrommode(mode):
try:
val = _modedict[mode]
@@ -55,7 +43,7 @@
return val
-def correlate(in1, in2, mode='full', old_behavior=True):
+def correlate(in1, in2, mode='full'):
"""
Cross-correlate two N-dimensional arrays.
@@ -76,12 +64,6 @@
with respect to the 'full' output.
- 'full': the output is the full discrete linear cross-correlation
of the inputs. (Default)
- old_behavior: bool
- If True (default), the old behavior of correlate is implemented:
- - if in1.size < in2.size, in1 and in2 are swapped (correlate(in1,
- in2) == correlate(in2, in1))
- - For complex inputs, the conjugate is not taken for in2
- If False, the new, conventional definition of correlate is implemented.
Returns
-------
@@ -99,15 +81,6 @@
"""
val = _valfrommode(mode)
- if old_behavior:
- warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG))
- if np.iscomplexobj(in2):
- in2 = in2.conjugate()
- if in1.size < in2.size:
- swp = in2
- in2 = in1
- in1 = swp
-
if mode == 'valid':
ps = [i - j + 1 for i, j in zip(in1.shape, in2.shape)]
out = np.empty(ps, in1.dtype)
@@ -177,7 +150,7 @@
return _centered(ret,abs(s2-s1)+1)
-def convolve(in1, in2, mode='full', old_behavior=True):
+def convolve(in1, in2, mode='full'):
"""
Convolve two N-dimensional arrays.
@@ -219,26 +192,16 @@
slice_obj = [slice(None,None,-1)]*len(kernel.shape)
- if old_behavior:
- warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG))
- if (product(kernel.shape,axis=0) > product(volume.shape,axis=0)):
- temp = kernel
- kernel = volume
- volume = temp
- del temp
-
- return correlate(volume, kernel[slice_obj], mode, old_behavior=True)
+ if mode == 'valid':
+ for d1, d2 in zip(volume.shape, kernel.shape):
+ if not d1 >= d2:
+ raise ValueError(
+ "in1 should have at least as many items as in2 in " \
+ "every dimension for valid mode.")
+ if np.iscomplexobj(kernel):
+ return correlate(volume, kernel[slice_obj].conj(), mode)
else:
- if mode == 'valid':
- for d1, d2 in zip(volume.shape, kernel.shape):
- if not d1 >= d2:
- raise ValueError(
- "in1 should have at least as many items as in2 in " \
- "every dimension for valid mode.")
- if np.iscomplexobj(kernel):
- return correlate(volume, kernel[slice_obj].conj(), mode, old_behavior=False)
- else:
- return correlate(volume, kernel[slice_obj], mode, old_behavior=False)
+ return correlate(volume, kernel[slice_obj], mode)
def order_filter(a, domain, rank):
"""
@@ -376,10 +339,10 @@
mysize = asarray(mysize);
# Estimate the local mean
- lMean = correlate(im,ones(mysize), 'same', old_behavior=False) / product(mysize,axis=0)
+ lMean = correlate(im,ones(mysize), 'same') / product(mysize,axis=0)
# Estimate the local variance
- lVar = correlate(im**2,ones(mysize), 'same', old_behavior=False) / product(mysize,axis=0) - lMean**2
+ lVar = correlate(im**2,ones(mysize), 'same') / product(mysize,axis=0) - lMean**2
# Estimate the noise power if needed.
if noise==None:
@@ -393,7 +356,7 @@
return out
-def convolve2d(in1, in2, mode='full', boundary='fill', fillvalue=0, old_behavior=True):
+def convolve2d(in1, in2, mode='full', boundary='fill', fillvalue=0):
"""Convolve two 2-dimensional arrays.
Convolve `in1` and `in2` with output size determined by mode and boundary
@@ -432,30 +395,19 @@
convolution of `in1` with `in2`.
"""
- if old_behavior:
- warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG))
+ if mode == 'valid':
+ for d1, d2 in zip(np.shape(in1), np.shape(in2)):
+ if not d1 >= d2:
+ raise ValueError(
+ "in1 should have at least as many items as in2 in " \
+ "every dimension for valid mode.")
- if old_behavior:
- warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG))
- if (product(np.shape(in2),axis=0) > product(np.shape(in1),axis=0)):
- temp = in1
- in1 = in2
- in2 = temp
- del temp
- else:
- if mode == 'valid':
- for d1, d2 in zip(np.shape(in1), np.shape(in2)):
- if not d1 >= d2:
- raise ValueError(
- "in1 should have at least as many items as in2 in " \
- "every dimension for valid mode.")
-
val = _valfrommode(mode)
bval = _bvalfromboundary(boundary)
return sigtools._convolve2d(in1,in2,1,val,bval,fillvalue)
-def correlate2d(in1, in2, mode='full', boundary='fill', fillvalue=0, old_behavior=True):
+def correlate2d(in1, in2, mode='full', boundary='fill', fillvalue=0):
"""Cross-correlate two 2-dimensional arrays.
Cross correlate in1 and in2 with output size determined by mode and
@@ -494,8 +446,6 @@
cross-correlation of `in1` with `in2`.
"""
- if old_behavior:
- warnings.warn(DeprecationWarning(_SWAP_INPUTS_DEPRECATION_MSG))
val = _valfrommode(mode)
bval = _bvalfromboundary(boundary)
Modified: branches/0.9.x/scipy/signal/sigtoolsmodule.c
===================================================================
--- branches/0.9.x/scipy/signal/sigtoolsmodule.c 2011-01-23 07:18:07 UTC (rev 7075)
+++ branches/0.9.x/scipy/signal/sigtoolsmodule.c 2011-01-23 07:20:40 UTC (rev 7076)
@@ -1045,8 +1045,6 @@
n1 = PyArray_Size((PyObject *)ain1);
n2 = PyArray_Size((PyObject *)ain2);
- /* Swap if first argument is not the largest */
- if (n1 < n2) { aout = ain1; ain1 = ain2; ain2 = aout; aout = NULL; }
aout_dimens = malloc(ain1->nd*sizeof(intp));
switch(mode & OUTSIZE_MASK) {
case VALID:
Modified: branches/0.9.x/scipy/signal/tests/test_signaltools.py
===================================================================
--- branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-23 07:18:07 UTC (rev 7075)
+++ branches/0.9.x/scipy/signal/tests/test_signaltools.py 2011-01-23 07:20:40 UTC (rev 7076)
@@ -17,25 +17,25 @@
def test_basic(self):
a = [3,4,5,6,5,4]
b = [1,2,3]
- c = convolve(a,b, old_behavior=self.old_behavior)
+ c = convolve(a,b)
assert_array_equal(c,array([3,10,22,28,32,32,23,12]))
def test_complex(self):
x = array([1+1j, 2+1j, 3+1j])
y = array([1+1j, 2+1j])
- z = convolve(x, y,old_behavior=self.old_behavior)
+ z = convolve(x, y)
assert_array_equal(z, array([2j, 2+6j, 5+8j, 5+5j]))
def test_zero_order(self):
a = 1289
b = 4567
- c = convolve(a,b,old_behavior=self.old_behavior)
+ c = convolve(a,b)
assert_array_equal(c,a*b)
def test_2d_arrays(self):
a = [[1,2,3],[3,4,5]]
b = [[2,3,4],[4,5,6]]
- c = convolve(a,b,old_behavior=self.old_behavior)
+ c = convolve(a,b)
d = array( [[2 ,7 ,16,17,12],\
[10,30,62,58,38],\
[12,31,58,49,30]])
@@ -44,57 +44,24 @@
def test_valid_mode(self):
a = [1,2,3,6,5,3]
b = [2,3,4,5,3,4,2,2,1]
- c = convolve(a,b,'valid',old_behavior=self.old_behavior)
+ c = convolve(a,b,'valid')
assert_array_equal(c,array([70,78,73,65]))
-class OldTestConvolve(_TestConvolve):
- old_behavior = True
- @dec.deprecated()
- def test_basic(self):
- _TestConvolve.test_basic(self)
- @dec.deprecated()
- def test_complex(self):
- _TestConvolve.test_complex(self)
-
- @dec.deprecated()
- def test_2d_arrays(self):
- _TestConvolve.test_2d_arrays(self)
-
- @dec.deprecated()
- def test_same_mode(self):
- _TestConvolve.test_same_mode(self)
-
- @dec.deprecated()
- def test_valid_mode(self):
- a = [1,2,3,6,5,3]
- b = [2,3,4,5,3,4,2,2,1]
- c = convolve(a,b,'valid',old_behavior=self.old_behavior)
- assert_array_equal(c,array([70,78,73,65]))
-
- @dec.deprecated()
- def test_same_mode(self):
- a = [1,2,3,3,1,2]
- b = [1,4,3,4,5,6,7,4,3,2,1,1,3]
- c = convolve(a,b,'same',old_behavior=self.old_behavior)
- d = array([14,25,35,43,57,61,63,57,45,36,25,20,17])
- assert_array_equal(c,d)
-
class TestConvolve(_TestConvolve):
- old_behavior = False
def test_valid_mode(self):
# 'valid' mode if b.size > a.size does not make sense with the new
# behavior
a = [1,2,3,6,5,3]
b = [2,3,4,5,3,4,2,2,1]
def _test():
- convolve(a,b,'valid',old_behavior=self.old_behavior)
+ convolve(a,b,'valid')
self.assertRaises(ValueError, _test)
def test_same_mode(self):
a = [1,2,3,3,1,2]
b = [1,4,3,4,5,6,7,4,3,2,1,1,3]
- c = convolve(a,b,'same',old_behavior=self.old_behavior)
+ c = convolve(a,b,'same')
d = array([57,61,63,57,45,36])
assert_array_equal(c,d)
@@ -105,13 +72,13 @@
d = array( [[2 ,7 ,16,17,12],\
[10,30,62,58,38],\
[12,31,58,49,30]])
- e = convolve2d(a,b,old_behavior=self.old_behavior)
+ e = convolve2d(a,b)
assert_array_equal(e,d)
def test_valid_mode(self):
e = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]]
f = [[1,2,3],[3,4,5]]
- g = convolve2d(e,f,'valid',old_behavior=self.old_behavior)
+ g = convolve2d(e,f,'valid')
h = array([[62,80,98,116,134]])
assert_array_equal(g,h)
@@ -119,7 +86,7 @@
a = [[1,2,3],[3,4,5]]
b = [[2,3,4],[4,5,6]]
fillval = 1
- c = convolve2d(a,b,'full','fill',fillval,old_behavior=self.old_behavior)
+ c = convolve2d(a,b,'full','fill',fillval)
d = array([[24,26,31,34,32],\
[28,40,62,64,52],\
[32,46,67,62,48]])
@@ -128,7 +95,7 @@
def test_wrap_boundary(self):
a = [[1,2,3],[3,4,5]]
b = [[2,3,4],[4,5,6]]
- c = convolve2d(a,b,'full','wrap',old_behavior=self.old_behavior)
+ c = convolve2d(a,b,'full','wrap')
d = array([[80,80,74,80,80],\
[68,68,62,68,68],\
[80,80,74,80,80]])
@@ -137,60 +104,18 @@
def test_sym_boundary(self):
a = [[1,2,3],[3,4,5]]
b = [[2,3,4],[4,5,6]]
- c = convolve2d(a,b,'full','symm',old_behavior=self.old_behavior)
+ c = convolve2d(a,b,'full','symm')
d = array([[34,30,44, 62, 66],\
[52,48,62, 80, 84],\
[82,78,92,110,114]])
assert_array_equal(c,d)
-class OldTestConvolve2d(_TestConvolve2d):
- old_behavior = True
- @dec.deprecated()
- def test_2d_arrays(self):
- _TestConvolve2d.test_2d_arrays(self)
-
- @dec.deprecated()
- def test_same_mode(self):
- e = [[1,2,3],[3,4,5]]
- f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]]
- g = convolve2d(e,f,'same',old_behavior=self.old_behavior)
- h = array([[ 7,16,22,28, 34, 40, 37],\
- [30,62,80,98,116,134,114]])
- assert_array_equal(g,h)
-
- @dec.deprecated()
- def test_valid_mode(self):
- _TestConvolve2d.test_valid_mode(self)
-
- @dec.deprecated()
- def test_fillvalue(self):
- _TestConvolve2d.test_fillvalue(self)
-
- @dec.deprecated()
- def test_wrap_boundary(self):
- _TestConvolve2d.test_wrap_boundary(self)
-
- @dec.deprecated()
- def test_sym_boundary(self):
- _TestConvolve2d.test_sym_boundary(self)
-
- @dec.deprecated()
- def test_valid_mode2(self):
- # Test when in2.size > in1.size: old behavior is to do so that
- # convolve2d(in2, in1) == convolve2d(in1, in2)
- e = [[1,2,3],[3,4,5]]
- f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]]
- g = convolve2d(e,f,'valid',old_behavior=self.old_behavior)
- h = array([[62,80,98,116,134]])
- assert_array_equal(g,h)
-
#class TestConvolve2d(_TestConvolve2d):
-# old_behavior = False
# def test_same_mode(self):
# e = [[1,2,3],[3,4,5]]
# f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]]
-# g = convolve2d(e,f,'same',old_behavior=self.old_behavior)
+# g = convolve2d(e,f,'same')
# h = array([[80,98,116],\
# [70,82,94]])
# assert_array_equal(g,h)
@@ -200,7 +125,7 @@
# e = [[1,2,3],[3,4,5]]
# f = [[2,3,4,5,6,7,8],[4,5,6,7,8,9,10]]
# def _test():
-# convolve2d(e,f,'valid',old_behavior=self.old_behavior)
+# convolve2d(e,f,'valid')
# self.assertRaises(ValueError, _test)
class TestFFTConvolve(TestCase):
@@ -468,46 +393,22 @@
def test_rank1_valid(self):
a, b, y_r = self._setup_rank1()
- y = correlate(a, b, 'valid', old_behavior=False)
+ y = correlate(a, b, 'valid')
assert_array_almost_equal(y, y_r[1:4])
self.assertTrue(y.dtype == self.dt)
def test_rank1_same(self):
a, b, y_r = self._setup_rank1()
- y = correlate(a, b, 'same', old_behavior=False)
+ y = correlate(a, b, 'same')
assert_array_almost_equal(y, y_r[:-1])
self.assertTrue(y.dtype == self.dt)
def test_rank1_full(self):
a, b, y_r = self._setup_rank1()
- y = correlate(a, b, 'full', old_behavior=False)
+ y = correlate(a, b, 'full')
assert_array_almost_equal(y, y_r)
self.assertTrue(y.dtype == self.dt)
- @dec.deprecated()
- def test_rank1_valid_old(self):
- # This test assume a.size > b.size
- a, b, y_r = self._setup_rank1()
- y = correlate(b, a, 'valid')
- assert_array_almost_equal(y, y_r[1:4])
- self.assertTrue(y.dtype == self.dt)
-
- @dec.deprecated()
- def test_rank1_same_old(self):
- # This test assume a.size > b.size
- a, b, y_r = self._setup_rank1()
- y = correlate(b, a, 'same')
- assert_array_almost_equal(y, y_r[:-1])
- self.assertTrue(y.dtype == self.dt)
-
- @dec.deprecated()
- def test_rank1_full_old(self):
- # This test assume a.size > b.size
- a, b, y_r = self._setup_rank1()
- y = correlate(b, a, 'full')
- assert_array_almost_equal(y, y_r)
- self.assertTrue(y.dtype == self.dt)
-
def _setup_rank3(self):
a = np.linspace(0, 39, 40).reshape((2, 4, 5), order='F').astype(self.dt)
b = np.linspace(0, 23, 24).reshape((2, 3, 4), order='F').astype(self.dt)
@@ -538,44 +439,23 @@
def test_rank3_valid(self):
a, b, y_r = self._setup_rank3()
- y = correlate(a, b, "valid", old_behavior=False)
+ y = correlate(a, b, "valid")
assert_array_almost_equal(y, y_r[1:2,2:4,3:5])
self.assertTrue(y.dtype == self.dt)
def test_rank3_same(self):
a, b, y_r = self._setup_rank3()
- y = correlate(a, b, "same", old_behavior=False)
+ y = correlate(a, b, "same")
assert_array_almost_equal(y, y_r[0:-1,1:-1,1:-2])
self.assertTrue(y.dtype == self.dt)
def test_rank3_all(self):
a, b, y_r = self._setup_rank3()
- y = correlate(a, b, old_behavior=False)
+ y = correlate(a, b)
assert_array_almost_equal(y, y_r)
self.assertTrue(y.dtype == self.dt)
- @dec.deprecated()
- def test_rank3_valid_old(self):
- a, b, y_r = self._setup_rank3()
- y = correlate(b, a, "valid")
- assert_array_almost_equal(y, y_r[1:2,2:4,3:5])
- self.assertTrue(y.dtype == self.dt)
- @dec.deprecated()
- def test_rank3_same_old(self):
- a, b, y_r = self._setup_rank3()
- y = correlate(b, a, "same")
- assert_array_almost_equal(y, y_r[0:-1,1:-1,1:-2])
- self.assertTrue(y.dtype == self.dt)
-
- @dec.deprecated()
- def test_rank3_all_old(self):
- a, b, y_r = self._setup_rank3()
- y = correlate(b, a)
- assert_array_almost_equal(y, y_r)
- self.assertTrue(y.dtype == self.dt)
-
-
def _get_testcorrelate_class(datatype, base):
class TestCorrelateX(base):
dt = datatype
@@ -593,7 +473,7 @@
# The numpy data type to use.
dt = None
-
+
# The decimal precision to be used for comparing results.
# This value will be passed as the 'decimal' keyword argument of
# assert_array_almost_equal().
@@ -606,27 +486,27 @@
b = np.random.randn(8).astype(self.dt)
b += 1j * np.random.randn(8).astype(self.dt)
- y_r = (correlate(a.real, b.real, mode=mode, old_behavior=False) +
- correlate(a.imag, b.imag, mode=mode, old_behavior=False)).astype(self.dt)
- y_r += 1j * (-correlate(a.real, b.imag, mode=mode, old_behavior=False) +
- correlate(a.imag, b.real, mode=mode, old_behavior=False))
+ y_r = (correlate(a.real, b.real, mode=mode) +
+ correlate(a.imag, b.imag, mode=mode)).astype(self.dt)
+ y_r += 1j * (-correlate(a.real, b.imag, mode=mode) +
+ correlate(a.imag, b.real, mode=mode))
return a, b, y_r
def test_rank1_valid(self):
a, b, y_r = self._setup_rank1('valid')
- y = correlate(a, b, 'valid', old_behavior=False)
+ y = correlate(a, b, 'valid')
assert_array_almost_equal(y, y_r, decimal=self.decimal)
self.assertTrue(y.dtype == self.dt)
def test_rank1_same(self):
a, b, y_r = self._setup_rank1('same')
- y = correlate(a, b, 'same', old_behavior=False)
+ y = correlate(a, b, 'same')
assert_array_almost_equal(y, y_r, decimal=self.decimal)
self.assertTrue(y.dtype == self.dt)
def test_rank1_full(self):
a, b, y_r = self._setup_rank1('full')
- y = correlate(a, b, 'full', old_behavior=False)
+ y = correlate(a, b, 'full')
assert_array_almost_equal(y, y_r, decimal=self.decimal)
self.assertTrue(y.dtype == self.dt)
@@ -636,53 +516,15 @@
b = np.random.randn(8, 6, 4).astype(self.dt)
b += 1j * np.random.randn(8, 6, 4).astype(self.dt)
- y_r = (correlate(a.real, b.real, old_behavior=False)
- + correlate(a.imag, b.imag, old_behavior=False)).astype(self.dt)
- y_r += 1j * (-correlate(a.real, b.imag, old_behavior=False) +
- correlate(a.imag, b.real, old_behavior=False))
+ y_r = (correlate(a.real, b.real)
+ + correlate(a.imag, b.imag)).astype(self.dt)
+ y_r += 1j * (-correlate(a.real, b.imag) + correlate(a.imag, b.real))
- y = correlate(a, b, 'full', old_behavior=False)
+ y = correlate(a, b, 'full')
assert_array_almost_equal(y, y_r, decimal=self.decimal-1)
self.assertTrue(y.dtype == self.dt)
- @dec.deprecated()
- def test_rank1_valid_old(self):
- a, b, y_r = self._setup_rank1('valid')
- y = correlate(b, a.conj(), 'valid')
- assert_array_almost_equal(y, y_r, decimal=self.decimal)
- self.assertTrue(y.dtype == self.dt)
- @dec.deprecated()
- def test_rank1_same_old(self):
- a, b, y_r = self._setup_rank1('same')
- y = correlate(b, a.conj(), 'same')
- assert_array_almost_equal(y, y_r, decimal=self.decimal)
- self.assertTrue(y.dtype == self.dt)
-
- @dec.deprecated()
- def test_rank1_full_old(self):
- a, b, y_r = self._setup_rank1('full')
- y = correlate(b, a.conj(), 'full')
- assert_array_almost_equal(y, y_r, decimal=self.decimal)
- self.assertTrue(y.dtype == self.dt)
-
- @dec.deprecated()
- def test_rank3_old(self):
- a = np.random.randn(10, 8, 6).astype(self.dt)
- a += 1j * np.random.randn(10, 8, 6).astype(self.dt)
- b = np.random.randn(8, 6, 4).astype(self.dt)
- b += 1j * np.random.randn(8, 6, 4).astype(self.dt)
-
- y_r = (correlate(a.real, b.real, old_behavior=False)
- + correlate(a.imag, b.imag, old_behavior=False)).astype(self.dt)
- y_r += 1j * (-correlate(a.real, b.imag, old_behavior=False) +
- correlate(a.imag, b.real, old_behavior=False))
-
- y = correlate(b, a.conj(), 'full')
- assert_array_almost_equal(y, y_r, decimal=self.decimal-1)
- self.assertTrue(y.dtype == self.dt)
-
-
# Create three classes, one for each complex data type. The actual class
# name will be TestCorrelateComplex###, where ### is the number of bits.
for datatype in [np.csingle, np.cdouble, np.clongdouble]:
More information about the Scipy-svn
mailing list