Skip to content

Commit 90d6db5

Browse files
committed
Changed from scipy to numpy
svn path=/trunk/matplotlib/; revision=1932
1 parent bb53c0a commit 90d6db5

22 files changed

+60
-60
lines changed

CHANGELOG

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2006-1-4 Changed to support numpy (new name for scipy_core) - TEO
2+
13
2006-1-4 Added Mark's scaled axes patch for shared axis
24

35
2005-12-28 Added Chris Barker's build_wxagg patch - JDH

INSTALL

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ COMPILING
6666
WINDOWS
6767

6868
If you don't already have python installed, you may want to consider
69-
using the enthought edition of python, which has scipy, Numeric, and
69+
using the enthought edition of python, which has (old) scipy, Numeric, and
7070
wxpython, plus a lot of other goodies, preinstalled -
7171
http://www.enthought.com/python . With the enthought edition of
7272
python + matplotlib installer, the following backends should work

lib/matplotlib/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ def validate_numerix(s):
461461
sl = s.lower()
462462
if sl=='numeric': return 'Numeric'
463463
elif sl=='numarray': return 'numarray'
464-
elif sl=='scipy': return 'scipy'
464+
elif sl=='numpy': return 'numpy'
465465
else:
466-
raise ValueError('Numerix must be Numeric, numarray, or scipy')
466+
raise ValueError('Numerix must be Numeric, numarray, or numpy')
467467

468468
def validate_toolbar(s):
469469
"""

lib/matplotlib/_contour.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
except ImportError:
1313
numerix._import_fail_message("_contour", "_nc")
1414
raise
15-
else: # Must be scipy
15+
else: # Must be numpy
1616
try:
1717
from matplotlib._ns_cntr import *
1818
except ImportError:

lib/matplotlib/_image.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
except ImportError:
1313
numerix._import_fail_message("_image", "_nc")
1414
raise
15-
else: # Must be scipy
15+
else: # Must be numpy
1616
try:
1717
from matplotlib._ns_image import *
1818
except ImportError:

lib/matplotlib/_transforms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
except ImportError:
1313
numerix._import_fail_message("_transforms", "_nc")
1414
raise
15-
else: # Must be scipy
15+
else: # Must be numpy
1616
try:
1717
from matplotlib._ns_transforms import *
1818
except ImportError:

lib/matplotlib/colors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def __call__(self, X, alpha=1.0):
518518
rgba = take(self._lut, xa)
519519
if vtype == 'scalar':
520520
rgba = tuple(rgba[0,:])
521-
#print rgba[0,1:10,:] # Now the same for scipy, numeric...
521+
#print rgba[0,1:10,:] # Now the same for numpy, numeric...
522522
return rgba
523523

524524
def set_bad(self, color = 'k', alpha = 0.0):

lib/matplotlib/enthought/util/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ def test(level=1,verbosity=1):
3434

3535
# returns a test suite for use elsewhere
3636
def test_suite(level=1):
37-
import scipy_test.testing
37+
import numpy.testing
3838
import matplotlib.enthought.util
39-
return scipy_test.testing.harvest_test_suites(enthought.util,level=level)
39+
return numpy.testing.harvest_test_suites(enthought.util,level=level)

lib/matplotlib/numerix/__init__.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
for a in sys.argv:
2828
if a in ["--Numeric", "--numeric", "--NUMERIC",
2929
"--Numarray", "--numarray", "--NUMARRAY",
30-
"--SciPy", "--scipy", "--SCIPY", "--Scipy",
30+
"--NumPy", "--numpy", "--NUMPY", "--Numpy",
3131
]:
3232
which = a[2:], "command line"
3333
break
@@ -44,8 +44,8 @@
4444
which = "numeric", "defaulted"
4545

4646
which = which[0].strip().lower(), which[1]
47-
if which[0] not in ["numeric", "numarray", "scipy"]:
48-
raise ValueError("numerix selector must be either 'Numeric', 'numarray', or 'scipy' but the value obtained from the %s was '%s'." % (which[1], which[0]))
47+
if which[0] not in ["numeric", "numarray", "numpy"]:
48+
raise ValueError("numerix selector must be either 'Numeric', 'numarray', or 'numpy' but the value obtained from the %s was '%s'." % (which[1], which[0]))
4949

5050
if which[0] == "numarray":
5151
#from na_imports import *
@@ -62,17 +62,17 @@
6262
from Matrix import Matrix
6363
import Numeric
6464
version = 'Numeric %s'%Numeric.__version__
65-
elif which[0] == "scipy":
66-
import scipy
67-
from scipy import *
65+
elif which[0] == "numpy":
66+
import numpy
67+
from numpy import *
6868
from _sp_imports import nx, infinity
6969
from _sp_imports import UInt8, UInt16, UInt32
7070
Matrix = matrix
71-
version = 'scipy' # Don't know how to get scipy version
71+
version = 'numpy %s' % numpy.__version__
7272
else:
7373
raise RuntimeError("invalid numerix selector")
7474

75-
# Some changes are only applicable to the new scipy:
75+
# Some changes are only applicable to the new numpy:
7676
if (which[0] == 'numarray' or
7777
which[0] == 'numeric'):
7878
def typecode(a):
@@ -86,16 +86,16 @@ def itemsize(a):
8686

8787
else:
8888
# We've already checked for a valid numerix selector,
89-
# so assume scipy.
89+
# so assume numpy.
9090
def typecode(a):
9191
return a.dtypechar
9292
def iscontiguous(a):
93-
return a.flags['CONTIGUOUS']
93+
return a.flags.contiguous
9494
def byteswapped(a):
9595
return a.byteswap()
9696
def itemsize(a):
9797
return a.itemsize
98-
# resize function is already defined by scipy
98+
# resize function is already defined by numpy
9999
# Fix typecode->dtype
100100
def fixkwargs(kwargs):
101101
if 'typecode' in kwargs:
@@ -104,13 +104,13 @@ def fixkwargs(kwargs):
104104
kwargs['dtype'] = val
105105
def array(*args, **kwargs):
106106
fixkwargs(kwargs)
107-
return scipy.array(*args, **kwargs)
107+
return numpy.array(*args, **kwargs)
108108
def zeros(*args, **kwargs):
109109
fixkwargs(kwargs)
110-
return scipy.zeros(*args, **kwargs)
110+
return numpy.zeros(*args, **kwargs)
111111
def ones(*args, **kwargs):
112112
fixkwargs(kwargs)
113-
return scipy.ones(*args, **kwargs)
113+
return numpy.ones(*args, **kwargs)
114114

115115

116116
verbose.report('numerix %s'%version)

lib/matplotlib/numerix/_sp_imports.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Not sure why all the equivalences don't exist ...
2-
from scipy import Int8, UInt8, \
1+
from numpy import Int8, UInt8, \
32
Int16, UInt16, \
43
Int32, UInt32, \
54
Float32, Float64, \
@@ -21,5 +20,5 @@ class _TypeNamespace:
2120

2221
nx = _TypeNamespace()
2322

24-
from scipy import inf, infty, Infinity
23+
from numpy import inf, infty, Infinity
2524
infinity = Infinity

lib/matplotlib/numerix/fft/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from numarray.fft import *
55
elif which[0] == "numeric":
66
from FFT import *
7-
elif which[0] == "scipy":
8-
from scipy.corefft import *
7+
elif which[0] == "numpy":
8+
from numpy.dft import *
99
else:
1010
raise RuntimeError("invalid numerix selector")

lib/matplotlib/numerix/linear_algebra/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from numarray.linear_algebra import *
55
elif which[0] == "numeric":
66
from LinearAlgebra import *
7-
elif which[0] == "scipy":
8-
from scipy.corelinalg import *
7+
elif which[0] == "numpy":
8+
from numpy.linalg import *
99
else:
1010
raise RuntimeError("invalid numerix selector")

lib/matplotlib/numerix/ma/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from numarray.ma import *
55
elif which[0] == "numeric":
66
from MA import *
7-
elif which[0] == "scipy":
8-
from scipy.base.ma import *
7+
elif which[0] == "numpy":
8+
from numpy.core.ma import *
99
else:
1010
raise RuntimeError("invalid numerix selector")

lib/matplotlib/numerix/mlab/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from numarray.linear_algebra.mlab import *
55
elif which[0] == "numeric":
66
from MLab import *
7-
elif which[0] == "scipy":
8-
from scipy.base.mlab import *
7+
elif which[0] == "numpy":
8+
from numpy.lib.mlab import *
99
else:
1010
raise RuntimeError("invalid numerix selector")
1111

lib/matplotlib/numerix/random_array/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from numarray.random_array import *
55
elif which[0] == "numeric":
66
from RandomArray import *
7-
elif which[0] == "scipy":
8-
from scipy.random import *
7+
elif which[0] == "numpy":
8+
from numpy.random import *
99
else:
1010
raise RuntimeError("invalid numerix selector")

setup.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,13 @@
137137
except ImportError:
138138
pass
139139
try:
140-
import scipy
141-
if hasattr(scipy,'__core_version__'):
142-
NUMERIX.append('scipy')
140+
import numpy
141+
NUMERIX.append('numpy')
143142
except ImportError:
144143
pass
145144

146145
if not NUMERIX:
147-
raise RuntimeError("You must install the new scipy, Numeric, numarray, or both to build matplotlib")
146+
raise RuntimeError("You must install one or more of numpy, Numeric, and numarray to build matplotlib")
148147

149148

150149
rc['numerix'] = NUMERIX[-1]
@@ -280,7 +279,7 @@ def add_dateutil():
280279

281280
# packagers: set rc['numerix'] and rc['backend'] here to override the auto
282281
# defaults, eg
283-
#rc['numerix'] = scipy
282+
#rc['numerix'] = numpy
284283
#rc['backend'] = GTKAgg
285284
template = file('matplotlibrc.template').read()
286285
file('matplotlibrc', 'w').write(template%rc)

setupext.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ def getoutput(s):
115115
ret = os.popen(s).read().strip()
116116
return ret
117117

118-
def add_scipy_flags(module):
119-
"Add the modules flags to build extensions which use scipy"
120-
import scipy
121-
module.include_dirs.append(scipy.get_scipy_include())
118+
def add_numpy_flags(module):
119+
"Add the modules flags to build extensions which use numpy"
120+
import numpy
121+
module.include_dirs.append(numpy.get_numpy_include())
122122

123123
def add_agg_flags(module):
124124
'Add the module flags to build extensions which use agg'
@@ -592,7 +592,7 @@ def build_agg(ext_modules, packages, numerix):
592592
add_agg_flags(module)
593593
add_ft2font_flags(module)
594594
ext_modules.append(module)
595-
if 'scipy' in numerix: # Build for scipy
595+
if 'numpy' in numerix: # Build for numpy
596596
deps = ['%s/src/%s'%(AGG_VERSION, name) for name in agg]
597597
deps.extend(('src/_image.cpp', 'src/ft2font.cpp', 'src/mplutils.cpp'))
598598
deps.extend(glob.glob('CXX/*.cxx'))
@@ -606,7 +606,7 @@ def build_agg(ext_modules, packages, numerix):
606606
include_dirs=numeric_inc_dirs,
607607
)
608608

609-
add_scipy_flags(module)
609+
add_numpy_flags(module)
610610
module.extra_compile_args.append('-DSCIPY=1')
611611

612612
add_agg_flags(module)
@@ -658,7 +658,7 @@ def build_image(ext_modules, packages, numerix):
658658
add_agg_flags(module)
659659
ext_modules.append(module)
660660

661-
if 'scipy' in numerix: # Build for scipy
661+
if 'numpy' in numerix: # Build for numpy
662662
temp_copy('src/_image.cpp', 'src/_ns_image.cpp')
663663
deps = ['src/_ns_image.cpp', 'src/mplutils.cpp']
664664
deps.extend(['%s/src/%s'%(AGG_VERSION,name) for name in agg])
@@ -671,7 +671,7 @@ def build_image(ext_modules, packages, numerix):
671671
include_dirs=numeric_inc_dirs,
672672
)
673673

674-
add_scipy_flags(module)
674+
add_numpy_flags(module)
675675
module.extra_compile_args.append('-DSCIPY=1')
676676
add_agg_flags(module)
677677
ext_modules.append(module)
@@ -735,7 +735,7 @@ def build_transforms(ext_modules, packages, numerix):
735735
add_base_flags(module)
736736
ext_modules.append(module)
737737

738-
if 'scipy' in numerix: # Build for scipy
738+
if 'numpy' in numerix: # Build for numpy
739739
cxx = glob.glob('CXX/*.cxx')
740740
cxx.extend(glob.glob('CXX/*.c'))
741741
temp_copy("src/_transforms.cpp","src/_ns_transforms.cpp")
@@ -747,7 +747,7 @@ def build_transforms(ext_modules, packages, numerix):
747747
)
748748

749749

750-
add_scipy_flags(module)
750+
add_numpy_flags(module)
751751
module.extra_compile_args.append("-DSCIPY=1")
752752
add_base_flags(module)
753753
ext_modules.append(module)
@@ -794,15 +794,15 @@ def build_contour(ext_modules, packages, numerix):
794794
module.extra_compile_args.append('-DNUMERIC=1')
795795
add_base_flags(module)
796796
ext_modules.append(module)
797-
if 'scipy' in numerix: # Build for scipy
797+
if 'numpy' in numerix: # Build for numpy
798798
temp_copy('src/cntr.c', 'src/_ns_cntr.c')
799799
module = Extension(
800800
'matplotlib._ns_cntr',
801801
[ 'src/_ns_cntr.c'],
802802
#libraries = ['stdc++'],
803803
include_dirs=numeric_inc_dirs,
804804
)
805-
add_scipy_flags(module)
805+
add_numpy_flags(module)
806806
module.extra_compile_args.append('-DSCIPY=1')
807807
add_base_flags(module)
808808
ext_modules.append(module)
@@ -842,7 +842,7 @@ def build_gdk(ext_modules, packages, numerix):
842842
add_pygtk_flags(module)
843843
ext_modules.append(module)
844844

845-
if 'scipy' in numerix:# Build for scipy
845+
if 'numpy' in numerix:# Build for numpy
846846
temp_copy('src/_backend_gdk.c', 'src/_ns_backend_gdk.c')
847847
module = Extension(
848848
'matplotlib.backends._ns_backend_gdk',
@@ -851,7 +851,7 @@ def build_gdk(ext_modules, packages, numerix):
851851
include_dirs=numeric_inc_dirs,
852852
)
853853

854-
add_scipy_flags(module)
854+
add_numpy_flags(module)
855855
module.extra_compile_args.append('-DSCIPY=1')
856856
add_base_flags(module)
857857
add_pygtk_flags(module)

src/_backend_agg.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#ifdef NUMERIC
3131
#include "Numeric/arrayobject.h"
3232
#else
33-
#include "scipy/arrayobject.h"
33+
#include "numpy/arrayobject.h"
3434
#endif
3535
#endif
3636

src/_backend_gdk.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifdef NUMERIC
1010
#include "Numeric/arrayobject.h"
1111
#else
12-
#include "scipy/arrayobject.h"
12+
#include "numpy/arrayobject.h"
1313
#endif
1414
#endif
1515

src/_image.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#ifdef NUMERIC
1313
#include "Numeric/arrayobject.h"
1414
#else
15-
#include "scipy/arrayobject.h"
15+
#include "numpy/arrayobject.h"
1616
#endif
1717
#endif
1818

src/_transforms.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# ifdef NUMERIC
1010
# include "Numeric/arrayobject.h"
1111
# else
12-
# include "scipy/arrayobject.h"
12+
# include "numpy/arrayobject.h"
1313
# endif
1414
#endif
1515

src/cntr.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#ifdef NUMERIC
2626
#include "Numeric/arrayobject.h"
2727
#else
28-
#include "scipy/arrayobject.h"
28+
#include "numpy/arrayobject.h"
2929
#endif
3030
#endif
3131

0 commit comments

Comments
 (0)