|
From: <ef...@us...> - 2007-07-20 08:56:18
|
Revision: 3584
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3584&view=rev
Author: efiring
Date: 2007-07-20 01:56:16 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
Revert numerix to 3573, second try
Added Paths:
-----------
trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py
trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py
trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py
trunk/matplotlib/lib/matplotlib/numerix/fft/
trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/
trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/ma/
trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/mlab/
trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore
trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/npyma/
trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/random_array/
trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py
Removed Paths:
-------------
trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/fft.py
trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/linear_algebra.py
trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/ma.py
trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore
trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/mlab.py
trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/npyma.py
trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py
trunk/matplotlib/lib/matplotlib/numerix/random_array.py
Copied: trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1,76 @@
+"""Imports from numarray for numerix, the numarray/Numeric interchangeability
+module. These array functions are used when numarray is chosen.
+"""
+from numarray import Int8, UInt8, Int16, UInt16, Int32, UInt32, \
+ Float32, Float64, Complex32, Complex64, Float, Int, Complex,\
+ typecode
+import numarray.ieeespecial as _ieee
+inf = infinity = infty = Infinity = _ieee.inf
+isnan = _ieee.isnan
+
+class _TypeNamespace:
+ """Numeric compatible type aliases for use with extension functions."""
+ Int8 = typecode[Int8]
+ UInt8 = typecode[UInt8]
+ Int16 = typecode[Int16]
+ UInt16 = typecode[UInt16]
+ Int32 = typecode[Int32]
+ #UInt32 = typecode[UInt32] # Todd: this appears broken
+ Float32 = typecode[Float32]
+ Float64 = typecode[Float64]
+ Complex32 = typecode[Complex32]
+ Complex64 = typecode[Complex64]
+
+nx = _TypeNamespace()
+
+from numarray import asarray, dot, fromlist, NumArray, shape, alltrue
+from numarray import all as _all
+
+def all(a, axis=None):
+ '''Numpy-compatible version of all()'''
+ if axis is None:
+ return _all(a)
+ return alltrue(a, axis)
+
+class _Matrix(NumArray):
+ """_Matrix is a ported, stripped down version of the Numeric Matrix
+ class which supplies only matrix multiplication.
+ """
+ def _rc(self, a):
+ if len(shape(a)) == 0:
+ return a
+ else:
+ return Matrix(a)
+
+ def __mul__(self, other):
+ aother = asarray(other)
+ #if len(aother.shape) == 0:
+ # return self._rc(self*aother)
+ #else:
+ # return self._rc(dot(self, aother))
+ #return self._rc(dot(self, aother))
+ return dot(self, aother)
+
+ def __rmul__(self, other):
+ aother = asarray(other)
+ if len(aother.shape) == 0:
+ return self._rc(aother*self)
+ else:
+ return self._rc(dot(aother, self))
+
+ def __imul__(self,other):
+ aother = asarray(other)
+ self[:] = dot(self, aother)
+ return self
+
+def Matrix(data, typecode=None, copy=1, savespace=0):
+ """Matrix constructs new matrices from 2D nested lists of numbers"""
+ if isinstance(data, type("")):
+ raise TypeError("numerix Matrix does not support Numeric matrix string notation. Use nested lists.")
+ a = fromlist(data, type=typecode)
+ if a.rank == 0:
+ a.shape = (1,1)
+ elif a.rank == 1:
+ a.shape = (1,) + a.shape
+ a.__class__ = _Matrix
+ return a
Copied: trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1,42 @@
+from Numeric import array, ravel, reshape, shape, alltrue, sometrue
+from Numeric import Int8, UInt8, Int16, UInt16, Int32, UInt32, \
+ Float32, Float64, Complex32, Complex64, Float, Int, Complex
+from numpy import isnan as _isnan
+
+class _TypeNamespace:
+ """Numeric compatible type aliases for use with extension functions."""
+ Int8 = Int8
+ UInt8 = UInt8
+ Int16 = Int16
+ UInt16 = UInt16
+ Int32 = Int32
+ UInt32 = UInt32
+ Float32 = Float32
+ Float64 = Float64
+ Complex32 = Complex32
+ Complex64 = Complex64
+
+nx = _TypeNamespace()
+
+def isnan(a):
+ """y = isnan(x) returns True where x is Not-A-Number"""
+ return reshape(array([_isnan(i) for i in ravel(a)],'b'), shape(a))
+
+def all(a, axis=None):
+ '''Numpy-compatible version of all()'''
+ if axis is None:
+ return alltrue(ravel(a))
+ else:
+ return alltrue(a, axis)
+
+def any(a, axis=None):
+ if axis is None:
+ return sometrue(ravel(a))
+ else:
+ return sometrue(a, axis)
+
+
+# inf is useful for testing infinities in results of array divisions
+# (which don't raise exceptions)
+
+inf = infty = infinity = Infinity = (array([1])/0.0)[0]
Copied: trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1,34 @@
+try:
+ from numpy.oldnumeric import Int8, UInt8, \
+ Int16, UInt16, \
+ Int32, UInt32, \
+ Float32, Float64, \
+ Complex32, Complex64, \
+ Float, Int, Complex
+except ImportError:
+ from numpy import Int8, UInt8, \
+ Int16, UInt16, \
+ Int32, UInt32, \
+ Float32, Float64, \
+ Complex32, Complex64, \
+ Float, Int, Complex
+
+class _TypeNamespace:
+ """Numeric compatible type aliases for use with extension functions."""
+ Int8 = Int8
+ UInt8 = UInt8
+ Int16 = Int16
+ UInt16 = UInt16
+ Int32 = Int32
+ UInt32 = UInt32
+ Float32 = Float32
+ Float64 = Float64
+ Complex32 = Complex32
+ Complex64 = Complex64
+
+nx = _TypeNamespace()
+
+from numpy import inf, infty, Infinity
+from numpy.random import rand, randn
+infinity = Infinity
+from numpy import all, isnan, any
Copied: trunk/matplotlib/lib/matplotlib/numerix/fft (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/fft)
Deleted: trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py 2007-07-19 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1,13 +0,0 @@
-from matplotlib.numerix import which
-
-if which[0] == "numarray":
- from numarray.fft import *
-elif which[0] == "numeric":
- from FFT import *
-elif which[0] == "numpy":
- try:
- from numpy.oldnumeric.fft import *
- except ImportError:
- from numpy.dft.old import *
-else:
- raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1,13 @@
+from matplotlib.numerix import which
+
+if which[0] == "numarray":
+ from numarray.fft import *
+elif which[0] == "numeric":
+ from FFT import *
+elif which[0] == "numpy":
+ try:
+ from numpy.oldnumeric.fft import *
+ except ImportError:
+ from numpy.dft.old import *
+else:
+ raise RuntimeError("invalid numerix selector")
Deleted: trunk/matplotlib/lib/matplotlib/numerix/fft.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/fft.py 2007-07-20 08:49:00 UTC (rev 3583)
+++ trunk/matplotlib/lib/matplotlib/numerix/fft.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1 +0,0 @@
-from numpy.oldnumeric.fft import *
Copied: trunk/matplotlib/lib/matplotlib/numerix/linear_algebra (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/linear_algebra)
Deleted: trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py 2007-07-19 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1,13 +0,0 @@
-from matplotlib.numerix import which
-
-if which[0] == "numarray":
- from numarray.linear_algebra import *
-elif which[0] == "numeric":
- from LinearAlgebra import *
-elif which[0] == "numpy":
- try:
- from numpy.oldnumeric.linear_algebra import *
- except ImportError:
- from numpy.linalg.old import *
-else:
- raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1,13 @@
+from matplotlib.numerix import which
+
+if which[0] == "numarray":
+ from numarray.linear_algebra import *
+elif which[0] == "numeric":
+ from LinearAlgebra import *
+elif which[0] == "numpy":
+ try:
+ from numpy.oldnumeric.linear_algebra import *
+ except ImportError:
+ from numpy.linalg.old import *
+else:
+ raise RuntimeError("invalid numerix selector")
Deleted: trunk/matplotlib/lib/matplotlib/numerix/linear_algebra.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/linear_algebra.py 2007-07-20 08:49:00 UTC (rev 3583)
+++ trunk/matplotlib/lib/matplotlib/numerix/linear_algebra.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1 +0,0 @@
-from numpy.oldnumeric.linear_algebra import *
Copied: trunk/matplotlib/lib/matplotlib/numerix/ma (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/ma)
Deleted: trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py 2007-07-19 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1,24 +0,0 @@
-from matplotlib.numerix import which, use_maskedarray
-
-if which[0] == "numarray":
- from numarray.ma import *
- nomask = None
- getmaskorNone = getmask
-elif which[0] == "numeric":
- from MA import *
- nomask = None
- getmaskorNone = getmask
-elif which[0] == "numpy":
- if use_maskedarray:
- from maskedarray import *
- print "using maskedarray"
- else:
- from numpy.core.ma import *
- #print "using ma"
- def getmaskorNone(obj):
- _msk = getmask(obj)
- if _msk is nomask:
- return None
- return _msk
-else:
- raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1,24 @@
+from matplotlib.numerix import which, use_maskedarray
+
+if which[0] == "numarray":
+ from numarray.ma import *
+ nomask = None
+ getmaskorNone = getmask
+elif which[0] == "numeric":
+ from MA import *
+ nomask = None
+ getmaskorNone = getmask
+elif which[0] == "numpy":
+ if use_maskedarray:
+ from maskedarray import *
+ print "using maskedarray"
+ else:
+ from numpy.core.ma import *
+ #print "using ma"
+ def getmaskorNone(obj):
+ _msk = getmask(obj)
+ if _msk is nomask:
+ return None
+ return _msk
+else:
+ raise RuntimeError("invalid numerix selector")
Deleted: trunk/matplotlib/lib/matplotlib/numerix/ma.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/ma.py 2007-07-20 08:49:00 UTC (rev 3583)
+++ trunk/matplotlib/lib/matplotlib/numerix/ma.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1,16 +0,0 @@
-from matplotlib.numerix import use_maskedarray
-
-from numpy.core.ma import *
-
-if use_maskedarray:
- from maskedarray import *
- print "using maskedarray"
-else:
- from numpy.core.ma import *
- #print "using ma"
-
-def getmaskorNone(obj):
- _msk = getmask(obj)
- if _msk is nomask:
- return None
- return _msk
Copied: trunk/matplotlib/lib/matplotlib/numerix/mlab (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/mlab)
Property changes on: trunk/matplotlib/lib/matplotlib/numerix/mlab
___________________________________________________________________
Name: svn:ignore
+ *.pyc
Deleted: trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore 2007-07-19 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1 +0,0 @@
-*.pyc
Copied: trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1 @@
+*.pyc
Deleted: trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py 2007-07-19 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1,16 +0,0 @@
-from matplotlib.numerix import which
-
-if which[0] == "numarray":
- from numarray.linear_algebra.mlab import *
-elif which[0] == "numeric":
- from MLab import *
-elif which[0] == "numpy":
- try:
- from numpy.oldnumeric.mlab import *
- except ImportError:
- from numpy.lib.mlab import *
-else:
- raise RuntimeError("invalid numerix selector")
-
-amin = min
-amax = max
Copied: trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1,16 @@
+from matplotlib.numerix import which
+
+if which[0] == "numarray":
+ from numarray.linear_algebra.mlab import *
+elif which[0] == "numeric":
+ from MLab import *
+elif which[0] == "numpy":
+ try:
+ from numpy.oldnumeric.mlab import *
+ except ImportError:
+ from numpy.lib.mlab import *
+else:
+ raise RuntimeError("invalid numerix selector")
+
+amin = min
+amax = max
Deleted: trunk/matplotlib/lib/matplotlib/numerix/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/mlab.py 2007-07-20 08:49:00 UTC (rev 3583)
+++ trunk/matplotlib/lib/matplotlib/numerix/mlab.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1,4 +0,0 @@
-from numpy.oldnumeric.mlab import *
-
-amin = min
-amax = max
Copied: trunk/matplotlib/lib/matplotlib/numerix/npyma (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/npyma)
Deleted: trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py 2007-07-19 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1,8 +0,0 @@
-from matplotlib.numerix import use_maskedarray
-
-if use_maskedarray:
- from maskedarray import *
- print "using maskedarray"
-else:
- from numpy.core.ma import *
- #print "using ma"
Copied: trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1,8 @@
+from matplotlib.numerix import use_maskedarray
+
+if use_maskedarray:
+ from maskedarray import *
+ print "using maskedarray"
+else:
+ from numpy.core.ma import *
+ #print "using ma"
Deleted: trunk/matplotlib/lib/matplotlib/numerix/npyma.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/npyma.py 2007-07-20 08:49:00 UTC (rev 3583)
+++ trunk/matplotlib/lib/matplotlib/numerix/npyma.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1,10 +0,0 @@
-from matplotlib.numerix import use_maskedarray
-
-from numpy.core.ma import *
-
-if use_maskedarray:
- from maskedarray import *
- print "using maskedarray"
-else:
- from numpy.core.ma import *
- #print "using ma"
Copied: trunk/matplotlib/lib/matplotlib/numerix/random_array (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/random_array)
Deleted: trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py 2007-07-19 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1,13 +0,0 @@
-from matplotlib.numerix import which
-
-if which[0] == "numarray":
- from numarray.random_array import *
-elif which[0] == "numeric":
- from RandomArray import *
-elif which[0] == "numpy":
- try:
- from numpy.oldnumeric.random_array import *
- except ImportError:
- from numpy.random import *
-else:
- raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py)
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -0,0 +1,13 @@
+from matplotlib.numerix import which
+
+if which[0] == "numarray":
+ from numarray.random_array import *
+elif which[0] == "numeric":
+ from RandomArray import *
+elif which[0] == "numpy":
+ try:
+ from numpy.oldnumeric.random_array import *
+ except ImportError:
+ from numpy.random import *
+else:
+ raise RuntimeError("invalid numerix selector")
Deleted: trunk/matplotlib/lib/matplotlib/numerix/random_array.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/random_array.py 2007-07-20 08:49:00 UTC (rev 3583)
+++ trunk/matplotlib/lib/matplotlib/numerix/random_array.py 2007-07-20 08:56:16 UTC (rev 3584)
@@ -1 +0,0 @@
-from numpy.oldnumeric.random_array import *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|