[Scipy-svn] r2226 - in trunk/Lib: integrate linalg sandbox/stats signal tests

scipy-svn at scipy.org scipy-svn at scipy.org
Sun Sep 24 03:10:51 EDT 2006


Author: oliphant
Date: 2006-09-24 02:09:58 -0500 (Sun, 24 Sep 2006)
New Revision: 2226

Modified:
   trunk/Lib/integrate/quadrature.py
   trunk/Lib/linalg/decomp.py
   trunk/Lib/sandbox/stats/anova.py
   trunk/Lib/signal/filter_design.py
   trunk/Lib/signal/ltisys.py
   trunk/Lib/tests/test_handy.py
Log:
Eliminate use of c_ (use r_['-1', instead).  Fix missing line-feed in quadrature.py

Modified: trunk/Lib/integrate/quadrature.py
===================================================================
--- trunk/Lib/integrate/quadrature.py	2006-09-24 06:50:14 UTC (rev 2225)
+++ trunk/Lib/integrate/quadrature.py	2006-09-24 07:09:58 UTC (rev 2226)
@@ -41,7 +41,8 @@
     """
     [x,w] = p_roots(n)
     x = real(x)
-    ainf, binf = map(isinf,(a,b)) if ainf or binf:
+    ainf, binf = map(isinf,(a,b))
+    if ainf or binf:
         raise ValueError, "Gaussian quadrature is only available for " \
               "finite limits."
     y = (b-a)*(x+1)/2.0 + a

Modified: trunk/Lib/linalg/decomp.py
===================================================================
--- trunk/Lib/linalg/decomp.py	2006-09-24 06:50:14 UTC (rev 2225)
+++ trunk/Lib/linalg/decomp.py	2006-09-24 07:09:58 UTC (rev 2226)
@@ -27,7 +27,6 @@
 
 cast = numpy.cast
 r_ = numpy.r_
-c_ = numpy.c_
 
 _I = cast['F'](1j)
 def _make_complex_eigvecs(w,vin,cmplx_tcode):
@@ -521,7 +520,7 @@
     typ = part.dtype.char
     MorN = len(s)
     if MorN == M:
-        return c_[part,zeros((M,N-M),typ)]
+        return r_['-1',part,zeros((M,N-M),typ)]
     elif MorN == N:
         return r_[part,zeros((M-N,N),typ)]
     else:

Modified: trunk/Lib/sandbox/stats/anova.py
===================================================================
--- trunk/Lib/sandbox/stats/anova.py	2006-09-24 06:50:14 UTC (rev 2225)
+++ trunk/Lib/sandbox/stats/anova.py	2006-09-24 07:09:58 UTC (rev 2226)
@@ -356,7 +356,7 @@
 
     ## Calc grand average (ga,axis=0), used for ALL effects
             ga = sum((sourceMarray*sourceNarray)/
-                            sum(sourceNarray),axis=0),axis=0))
+                            sum(sourceNarray,axis=0),axis=0)
             ga = reshape(ga,ones(len(Marray.shape)))
 
     ## If GRAND interaction, use harmonic mean of ALL cell Ns

Modified: trunk/Lib/signal/filter_design.py
===================================================================
--- trunk/Lib/signal/filter_design.py	2006-09-24 06:50:14 UTC (rev 2225)
+++ trunk/Lib/signal/filter_design.py	2006-09-24 07:09:58 UTC (rev 2226)
@@ -6,7 +6,7 @@
 import numpy
 from numpy.core.umath import *
 from numpy import atleast_1d, poly, polyval, roots, imag, real, asarray,\
-     allclose, resize, pi, concatenate, absolute, logspace, c_
+     allclose, resize, pi, concatenate, absolute, logspace
 from numpy import mintypecode, select
 from scipy import special, optimize, linalg
 from scipy.misc import comb
@@ -22,7 +22,7 @@
     if len(ep) == 0:
         ep = atleast_1d(-1000)+0j
 
-    ez = c_[numpy.compress(ep.imag >=0, ep,axis=-1), numpy.compress((abs(tz) < 1e5) & (tz.imag >=0),tz,axis=-1)]
+    ez = r_['-1',numpy.compress(ep.imag >=0, ep,axis=-1), numpy.compress((abs(tz) < 1e5) & (tz.imag >=0),tz,axis=-1)]
 
     integ = abs(ez) < 1e-10
     hfreq = numpy.around(numpy.log10(numpy.max(3*abs(ez.real + integ)+1.5*ez.imag))+0.5)

Modified: trunk/Lib/signal/ltisys.py
===================================================================
--- trunk/Lib/signal/ltisys.py	2006-09-24 06:50:14 UTC (rev 2225)
+++ trunk/Lib/signal/ltisys.py	2006-09-24 07:09:58 UTC (rev 2226)
@@ -12,7 +12,7 @@
 import scipy.interpolate as interpolate
 import scipy.integrate as integrate
 import scipy.linalg as linalg
-from numpy import r_, c_, eye, real, atleast_1d, atleast_2d, poly, \
+from numpy import r_, eye, real, atleast_1d, atleast_2d, poly, \
      squeeze, diag, asarray
 
 def tf2ss(num, den):
@@ -46,7 +46,7 @@
                array([], Float)
 
     # pad numerator to have same number of columns has denominator
-    num = c_[zeros((num.shape[0],K-M),num.dtype.char), num]
+    num = r_['-1',zeros((num.shape[0],K-M),num.dtype.char), num]
 
     if num.shape[-1] > 0:
         D = num[:,0]

Modified: trunk/Lib/tests/test_handy.py
===================================================================
--- trunk/Lib/tests/test_handy.py	2006-09-24 06:50:14 UTC (rev 2225)
+++ trunk/Lib/tests/test_handy.py	2006-09-24 07:09:58 UTC (rev 2226)
@@ -41,13 +41,13 @@
         b = ones(5)
         c = r_[b,0,0,b]
         assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1])
-        c = c_[b,0,0,b]
+        c = r_['-1',b,0,0,b]
         assert_array_equal(c,[1,1,1,1,1,0,0,1,1,1,1,1])
 
     def check_2d(self):
         b = rand(5,5)
         c = rand(5,5)
-        d = c_[b,c]  # append columns
+        d = r_['-1',b,c]  # append columns
         assert(d.shape == (5,10))
         assert_array_equal(d[:,:5],b)
         assert_array_equal(d[:,5:],c)




More information about the Scipy-svn mailing list