Skip to content

Commit 6adc54e

Browse files
committed
Removal of numerix, stage 2.
The only vestiges are a couple method names, and a validator with a warning to catch numerix keys in matplotlibrc files. svn path=/trunk/matplotlib/; revision=6932
1 parent 830329b commit 6adc54e

16 files changed

+49
-47
lines changed

doc/api/api_changes.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ list may help describe what changes may be necessary in your code.
1919

2020
Changes for 0.98.x
2121
==================
22+
* Removed numerix package.
23+
2224
* Added new :func:`matplotlib.image.imsave` and exposed it to the
2325
:mod:`matplotlib.pyplot` interface.
2426

2527
* Remove support for pyExcelerator in exceltools -- use xlwt
26-
instead
28+
instead
2729

2830
* Changed the defaults of acorr and xcorr to use usevlines=True,
2931
maxlags=10 and normed=True since these are the best defaults

doc/devel/outline.rst

-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ config/rcparams Darren needs conversion
107107
config/rcsetup Darren needs conversion
108108
config/tconfig Darren needs conversion
109109
config/verbose Darren needs conversion
110-
numerix/__init__ needs conversion
111110
projections/__init__ Mike converted
112111
projections/geo Mike converted (not included--experimental)
113112
projections/polar Mike converted

examples/misc/rc_traits.py

-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ class PatchRC(traits.HasTraits):
131131

132132
class RC(traits.HasTraits):
133133
backend = traits.Trait(*backends)
134-
numerix = traits.Trait('Numeric', 'numarray')
135134
interactive = flexible_false_trait
136135
toolbar = traits.Trait('toolbar2', 'classic', None)
137136
timezone = traits.Trait(*timezones)

lib/matplotlib/backends/backend_ps.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def quote_ps_string(s):
112112

113113
def seq_allequal(seq1, seq2):
114114
"""
115-
seq1 and seq2 are either None or sequences or numerix arrays
115+
seq1 and seq2 are either None or sequences or arrays
116116
Return True if both are None or both are seqs with identical
117117
elements
118118
"""

lib/matplotlib/config/mplconfig.py

-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class MPLConfig(TConfig):
5858
toolbar = T.Trait('toolbar2', 'toolbar2', None)
5959
timezone = T.Trait('UTC', pytz.all_timezones)
6060
datapath = T.Trait(cutils.get_data_path())
61-
numerix = T.Trait('numpy', 'numpy', 'numeric', 'numarray')
6261
units = T.false
6362

6463
class backend(TConfig):
@@ -290,7 +289,6 @@ def __init__(self, tconfig):
290289
self.tconfig_map = {
291290
'backend' : (self.tconfig.backend, 'use'),
292291
'backend_fallback' : (self.tconfig.backend, 'fallback'),
293-
'numerix' : (self.tconfig, 'numerix'),
294292
'toolbar' : (self.tconfig, 'toolbar'),
295293
'datapath' : (self.tconfig, 'datapath'),
296294
'units' : (self.tconfig, 'units'),

lib/matplotlib/config/rcsetup.py

-5
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ def validate_fonttype(s):
7575
'QtAgg', 'Qt4Agg', 'SVG', 'Template', 'TkAgg', 'WX', 'WXAgg',
7676
], ignorecase=True)
7777

78-
validate_numerix = ValidateInStrings('numerix',[
79-
'Numeric','numarray','numpy',
80-
], ignorecase=True)
81-
8278
validate_toolbar = ValidateInStrings('toolbar',[
8379
'None','classic','toolbar2',
8480
], ignorecase=True)
@@ -298,7 +294,6 @@ def __call__(self, s):
298294
# a map from key -> value, converter
299295
defaultParams = {
300296
'backend' : ['WXAgg', validate_backend],
301-
'numerix' : ['numpy', validate_numerix],
302297
'toolbar' : ['toolbar2', validate_toolbar],
303298
'datapath' : [None, validate_path_exists], # handled by _get_data_path_cached
304299
'units' : [False, validate_bool],

lib/matplotlib/rcsetup.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,17 @@ def validate_backend(s):
106106
if s.startswith('module://'): return s
107107
else: return _validate_standard_backends(s)
108108

109-
validate_numerix = ValidateInStrings('numerix',[
110-
'Numeric','numarray','numpy',
111-
], ignorecase=True)
109+
110+
def validate_numerix(v):
111+
# 2009/02/24: start warning; later, remove all traces
112+
try:
113+
if v == 'obsolete':
114+
return v
115+
except ValueError:
116+
pass
117+
warnings.warn('rcParams key "numerix" is obsolete and has no effect;\n'
118+
' please delete it from your matplotlibrc file')
119+
112120

113121
validate_toolbar = ValidateInStrings('toolbar',[
114122
'None','classic','toolbar2',
@@ -323,7 +331,7 @@ def __call__(self, s):
323331
defaultParams = {
324332
'backend' : ['Agg', validate_backend], # agg is certainly present
325333
'backend_fallback' : [True, validate_bool], # agg is certainly present
326-
'numerix' : ['numpy', validate_numerix],
334+
'numerix' : ['obsolete', validate_numerix],
327335
'maskedarray' : ['obsolete', validate_maskedarray], #to be removed
328336
'toolbar' : ['toolbar2', validate_toolbar],
329337
'datapath' : [None, validate_path_exists], # handled by _get_data_path_cached

matplotlibrc.template

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ backend : %(backend)s
3434
# conflicts, we will automatically try and find a compatible one for
3535
# you if backend_fallback is True
3636
#backend_fallback: True
37-
numerix : %(numerix)s # numpy, Numeric or numarray
3837
#interactive : False
3938
#toolbar : toolbar2 # None | classic | toolbar2
4039
#timezone : UTC # a pytz timezone string, eg US/Central or Europe/Paris

setup.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# This dict will be updated as we try to select the best option during
1919
# the build process. However, values in setup.cfg will be used, if
2020
# defined.
21-
rc = {'backend':'Agg', 'numerix':'numpy'}
21+
rc = {'backend':'Agg'}
2222

2323
# BEFORE importing disutils, remove MANIFEST. distutils doesn't properly
2424
# update it when the contents of directories change.
@@ -52,13 +52,6 @@
5252
'matplotlib.projections',
5353
# 'matplotlib.toolkits',
5454
'mpl_toolkits',
55-
'matplotlib.numerix',
56-
'matplotlib.numerix.mlab',
57-
'matplotlib.numerix.ma',
58-
'matplotlib.numerix.npyma',
59-
'matplotlib.numerix.linear_algebra',
60-
'matplotlib.numerix.random_array',
61-
'matplotlib.numerix.fft',
6255
'matplotlib.sphinxext'
6356
]
6457

@@ -224,14 +217,12 @@ def add_dateutil():
224217

225218
# Write the default matplotlibrc file
226219
if options['backend']: rc['backend'] = options['backend']
227-
if options['numerix']: rc['numerix'] = options['numerix']
228220
template = file('matplotlibrc.template').read()
229221
file('lib/matplotlib/mpl-data/matplotlibrc', 'w').write(template%rc)
230222

231223
# Write the default matplotlib.conf file
232224
template = file('lib/matplotlib/mpl-data/matplotlib.conf.template').read()
233225
template = template.replace("datapath = ", "#datapath = ")
234-
template = template.replace("numerix = 'numpy'", "numerix = '%s'"%rc['numerix'])
235226
template = template.replace(" use = 'Agg'", " use = '%s'"%rc['backend'])
236227
file('lib/matplotlib/mpl-data/matplotlib.conf', 'w').write(template)
237228

setupext.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@
106106
'build_macosx': 'auto',
107107
'build_image': True,
108108
'build_windowing': True,
109-
'backend': None,
110-
'numerix': None}
109+
'backend': None}
111110

112111
# Based on the contents of setup.cfg, determine the build options
113112
if os.path.exists("setup.cfg"):
@@ -142,9 +141,6 @@
142141
try: options['backend'] = config.get("rc_options", "backend")
143142
except: pass
144143

145-
try: options['numerix'] = config.get("rc_options", "numerix")
146-
except: pass
147-
148144

149145
if options['display_status']:
150146
def print_line(char='='):

test/mplTest/units/UnitDblConverter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#===========================================================================
1010
# Place all imports after here.
1111
#
12+
import numpy as np
1213
import matplotlib.units as units
1314
import matplotlib.ticker as ticker
14-
import matplotlib.numerix as nx
1515
import matplotlib.projections.polar as polar
1616
from matplotlib.cbook import iterable
1717
#
@@ -27,7 +27,7 @@
2727
# This was copied from matplotlib example code.
2828
def rad_fn(x, pos = None ):
2929
"""Radian function formatter."""
30-
n = int((x / nx.pi) * 2.0 + 0.25)
30+
n = int((x / np.pi) * 2.0 + 0.25)
3131
if n == 0:
3232
return str(x)
3333
elif n == 1:

test/test_backends/TestAgg.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import sys, time, os
1313
from matplotlib.ft2font import FT2Font
14-
from matplotlib.numerix import rand
14+
from numpy.random import rand
1515
from matplotlib.backend_bases import GraphicsContextBase
1616
from matplotlib.backends._backend_agg import RendererAgg
1717

@@ -89,7 +89,7 @@ def DISABLED_memleak( self ):
8989
font.set_size( 12, 72 )
9090
o.draw_text_image( font.get_image(), 30, 40, gc )
9191

92-
92+
9393
o.write_png( fname % i )
9494
val = report_memory( i )
9595
if i==1: start = val

unit/agg_memleak.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
"""
2+
And another broken test...
3+
"""
4+
15
import sys, time, os
26
from matplotlib.ft2font import FT2Font
3-
from matplotlib.numerix import rand
7+
from numpy.random import rand
48
from matplotlib.backend_bases import GraphicsContextBase
59
from matplotlib.backends._backend_agg import RendererAgg
610

@@ -23,7 +27,7 @@ def report_memory(i):
2327
ys = [400*int(rand()) for k in range(8)]
2428
rgb = (1,0,0)
2529
pnts = zip(xs, ys)
26-
o.draw_polygon(gc, rgb, pnts)
30+
o.draw_polygon(gc, rgb, pnts) # no such method??
2731
o.draw_polygon(gc, None, pnts)
2832

2933
for j in range(50):

unit/ft2font_memleak.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
"""
2+
This appears to be obsolete as of 2009/02/24; a key import fails.
3+
"""
14
import sys, time, os
2-
from matplotlib.numerix import rand
5+
from numpy.random import rand
36
from matplotlib.ft2font import FT2Font
4-
from matplotlib.backends.backend_ps import encodeTTFasPS
7+
from matplotlib.backends.backend_ps import encodeTTFasPS # doesn't exist...
58

69
fname = '/usr/local/share/matplotlib/Vera.ttf'
710

unit/inside_poly_memleak.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/env python
2+
"""
3+
Another broken test...
4+
"""
25

36
import os, sys, time
47
import matplotlib.nxutils as nxutils
5-
import matplotlib.numerix as nx
8+
from numpy.random import rand
69

710
def report_memory(i):
811
pid = os.getpid()
@@ -14,12 +17,12 @@ def report_memory(i):
1417

1518
for i in range(500):
1619
report_memory(i)
17-
verts = nx.mlab.rand(100, 2)
18-
b = nxutils.pnpoly(x, y, verts)
20+
verts = rand(100, 2)
21+
b = nxutils.pnpoly(x, y, verts) # x, y don't exist
1922

2023
for i in range(500):
2124
report_memory(i)
22-
verts = nx.mlab.rand(100, 2)
23-
points = nx.mlab.rand(10000,2)
25+
verts = rand(100, 2)
26+
points = rand(10000,2)
2427
mask = nxutils.points_inside_poly(points, verts)
2528

unit/inside_poly_profile.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
"""
2+
Broken.
3+
"""
4+
15
import os, sys, time
26

37
import matplotlib.nxutils as nxutils
4-
import matplotlib.numerix as nx
8+
from numpy.random import rand
59
import matplotlib.mlab
610
import matplotlib.patches as patches
711
if 1:
@@ -10,13 +14,14 @@
1014

1115
t0 = time.time()
1216
for i in range(numtrials):
13-
points = nx.mlab.rand(numpoints,2)
17+
points = rand(numpoints,2)
1418
mask = matplotlib.mlab._inside_poly_deprecated(points, verts)
19+
### no such thing
1520
told = time.time() - t0
1621

1722
t0 = time.time()
1823
for i in range(numtrials):
19-
points = nx.mlab.rand(numpoints,2)
24+
points = rand(numpoints,2)
2025
mask = nxutils.points_inside_poly(points, verts)
2126
tnew = time.time() - t0
2227
print numverts, numpoints, told, tnew, told/tnew

0 commit comments

Comments
 (0)