From: <ef...@us...> - 2009-02-25 07:37:02
|
Revision: 6933 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6933&view=rev Author: efiring Date: 2009-02-25 07:36:55 +0000 (Wed, 25 Feb 2009) Log Message: ----------- Restore a stripped-down numerix with a deprecation warning. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/setup.py Added Paths: ----------- trunk/matplotlib/lib/matplotlib/numerix/ trunk/matplotlib/lib/matplotlib/numerix/__init__.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/__init__.py trunk/matplotlib/lib/matplotlib/numerix/random_array/ trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-02-24 21:56:19 UTC (rev 6932) +++ trunk/matplotlib/CHANGELOG 2009-02-25 07:36:55 UTC (rev 6933) @@ -1,4 +1,5 @@ -2009-02-25 Remove numerix; it remains in the maintenance branches. - EF +2009-02-25 Deprecate numerix, and strip out all but the numpy + part of the code. - EF 2009-02-21 Improve scatter argument handling; add an early error message, allow inputs to have more than one dimension. - EF Added: trunk/matplotlib/lib/matplotlib/numerix/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/__init__.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,84 @@ +""" +numerix imports numpy with some compatibility adjustments for old +code that had been based on Numeric. + +It is deprecated and will go away soon. +""" + +import sys, os, struct +from matplotlib import rcParams, verbose + +import warnings +msg = """ +********************************************************** +matplotlib.numerix and all its subpackages are deprecated. +They will be removed soon. Please use numpy instead. +********************************************************** +""" +warnings.warn(msg, DeprecationWarning) + +which = "numpy", "defaulted" # This is now the only choice + +try: + import numpy.oldnumeric as numpy + from numpy.oldnumeric import * +except ImportError: + import numpy + from numpy import * + print 'except asarray', asarray +from _sp_imports import nx, infinity, rand, randn, isnan, all, any +from _sp_imports import UInt8, UInt16, UInt32, Infinity +try: + from numpy.oldnumeric.matrix import Matrix +except ImportError: + Matrix = matrix +version = 'numpy %s' % numpy.__version__ +from numpy import nan + + +from mlab import amin, amax +newaxis = NewAxis +from numpy import angle +def typecode(a): + return a.dtype.char +def iscontiguous(a): + return a.flags.contiguous +def byteswapped(a): + return a.byteswap() +def itemsize(a): + return a.itemsize + +verbose.report('numerix %s'%version) +# a bug fix for blas numeric suggested by Fernando Perez +matrixmultiply=dot +asum = sum + + +def _import_fail_message(module, version): + """Prints a message when the array package specific version of an extension + fails to import correctly. + """ + _dict = { "which" : which[0], + "module" : module, + "specific" : version + module + } + print """ +The import of the %(which)s version of the %(module)s module, +%(specific)s, failed. This is is either because %(which)s was +unavailable when matplotlib was compiled, because a dependency of +%(specific)s could not be satisfied, or because the build flag for +this module was turned off in setup.py. If it appears that +%(specific)s was not built, make sure you have a working copy of +%(which)s and then re-install matplotlib. Otherwise, the following +traceback gives more details:\n""" % _dict + +g = globals() +l = locals() +__import__('ma', g, l) +__import__('fft', g, l) +__import__('linear_algebra', g, l) +__import__('random_array', g, l) +__import__('mlab', g, l) + +la = linear_algebra +ra = random_array Added: 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 2009-02-25 07:36:55 UTC (rev 6933) @@ -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 Added: 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 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,4 @@ +try: + from numpy.oldnumeric.fft import * +except ImportError: + from numpy.dft.old import * Added: 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 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,4 @@ +try: + from numpy.oldnumeric.linear_algebra import * +except ImportError: + from numpy.linalg.old import * Added: 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 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,9 @@ +try: + from numpy.ma import * # numpy 1.05 and later +except ImportError: + from numpy.core.ma import * # earlier +def getmaskorNone(obj): + _msk = getmask(obj) + if _msk is nomask: + return None + return _msk Added: 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 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,7 @@ +try: + from numpy.oldnumeric.mlab import * +except ImportError: + from numpy.lib.mlab import * + +amin = min +amax = max Added: 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 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,4 @@ +try: + from numpy.oldnumeric.random_array import * +except ImportError: + from numpy.random import * Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2009-02-24 21:56:19 UTC (rev 6932) +++ trunk/matplotlib/setup.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -52,7 +52,15 @@ 'matplotlib.projections', # 'matplotlib.toolkits', 'mpl_toolkits', - 'matplotlib.sphinxext' + 'matplotlib.sphinxext', + # The following are deprecated and will be removed. + 'matplotlib.numerix', + 'matplotlib.numerix.mlab', + 'matplotlib.numerix.ma', + 'matplotlib.numerix.linear_algebra', + 'matplotlib.numerix.random_array', + 'matplotlib.numerix.fft', + ] py_modules = ['pylab'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |