Skip to content

Commit a02c493

Browse files
committed
refactored numerix
svn path=/trunk/matplotlib/; revision=880
1 parent ff897d8 commit a02c493

31 files changed

+420
-208
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
New entries should be added at the top
22

3+
2005-01-21 Refactored numerix to solve vexing namespace issues - JDH
4+
5+
2005-01-21 Applied Nadia's contour bug fix - JDH
6+
37
2005-01-20 Made some changes to the contour routine - particularly
48
region=1 seems t fix a lot of the zigzag strangeness.
59
Added colormaps as default for contour - JDH

MANIFEST

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
INSTALL
55
INTERACTIVE
66
KNOWN_BUGS
7+
MANIFEST
78
MANIFEST.in
89
Makefile
910
README
@@ -246,6 +247,7 @@ agg22/svg/win32_api/svg_test.dsp
246247
agg22/svg/win32_api/svg_test.dsw
247248
examples/README
248249
examples/__init__.py
250+
examples/accented_text.py
249251
examples/alignment_test.py
250252
examples/anim.py
251253
examples/anim_tk.py
@@ -262,6 +264,7 @@ examples/break.py
262264
examples/color_demo.py
263265
examples/colours.py
264266
examples/contour_demo.py
267+
examples/contour_demo2.py
265268
examples/coords_demo.py
266269
examples/coords_report.py
267270
examples/csd_demo.py
@@ -524,9 +527,6 @@ lib/matplotlib/lines.py
524527
lib/matplotlib/mathtext.py
525528
lib/matplotlib/matlab.py
526529
lib/matplotlib/mlab.py
527-
lib/matplotlib/na_imports.py
528-
lib/matplotlib/nc_imports.py
529-
lib/matplotlib/numerix.py
530530
lib/matplotlib/patches.py
531531
lib/matplotlib/pylab.py
532532
lib/matplotlib/pyparsing.py
@@ -553,6 +553,13 @@ lib/matplotlib/backends/backend_tkagg.py
553553
lib/matplotlib/backends/backend_wx.py
554554
lib/matplotlib/backends/backend_wxagg.py
555555
lib/matplotlib/backends/tkagg.py
556+
lib/matplotlib/numerix/__init__.py
557+
lib/matplotlib/numerix/_na_imports.py
558+
lib/matplotlib/numerix/_nc_imports.py
559+
lib/matplotlib/numerix/fft/__init__.py
560+
lib/matplotlib/numerix/linear_algebra/__init__.py
561+
lib/matplotlib/numerix/mlab/__init__.py
562+
lib/matplotlib/numerix/random_array/__init__.py
556563
lib/pytz/__init__.py
557564
lib/pytz/reference.py
558565
lib/pytz/test_tzinfo.py

examples/anscombe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def fit(x):
2121

2222

2323

24-
xfit = array( [min(x), max(x) ] )
24+
xfit = array( [amin(x), amax(x) ] )
2525

2626
subplot(221)
2727
plot(x,y1,'ks', xfit, fit(xfit), 'r-', lw=2)
@@ -43,7 +43,7 @@ def fit(x):
4343

4444
subplot(224)
4545

46-
xfit = array([min(x4),max(x4)])
46+
xfit = array([amin(x4),amax(x4)])
4747
plot(x4,y4,'ks', xfit, fit(xfit), 'r-', lw=2)
4848
axis([2,20,2,14])
4949
set(gca(), yticklabels=[], yticks=(4,8,12), xticks=(0,10,20))

examples/axes_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# the main axes is subplot(111) by default
1313
plot(t, s)
14-
axis([0, 1, 1.1*min(s), 2*max(s) ])
14+
axis([0, 1, 1.1*amin(s), 2*amax(s) ])
1515
xlabel('time (s)')
1616
ylabel('current (nA)')
1717
title('Gaussian colored noise')

examples/backend_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def drive(backend, python='python2.3'):
106106
#backends = ['Agg', 'Cairo', 'GDK', 'PS', 'SVG', 'Template']
107107
backends = ['Agg', 'PS', 'SVG', 'Template']
108108
#backends = [ 'GTK', 'WX', 'TkAgg']
109-
109+
#backends = ['Agg']
110110
python = 'python2.3'
111111
for backend in backends:
112112
print 'testing %s' % backend

examples/colours.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
Some simple functions to generate colours.
44
"""
5-
from matplotlib.numerix import asarray
5+
from matplotlib.numerix import asarray, asum
66
from matplotlib.mlab import linspace
77
from matplotlib.colors import colorConverter
88
from matplotlib.numerix import sum
@@ -17,7 +17,7 @@ def pastel(colour, weight=2.4):
1717
scale = 1.0 / maxc
1818
rgb = rgb * scale
1919
# now decrease saturation
20-
total = sum(rgb)
20+
total = asum(rgb)
2121
slack = 0
2222
for x in rgb:
2323
slack += 1.0 - x

examples/embedding_in_wx3.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
2828
from matplotlib.figure import Figure
2929
import matplotlib.numerix as numerix
30+
import matplotlib.numerix.mlab as mlab
3031
from matplotlib.mlab import meshgrid
3132

3233
from wxPython.wx import *
@@ -66,7 +67,7 @@ def init_plot_data(self):
6667
z = numerix.sin(self.x) + numerix.cos(self.y)
6768
self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
6869

69-
zmax = numerix.max(numerix.max(z))-ERR_TOL
70+
zmax = mlab.max(mlab.max(z))-ERR_TOL
7071

7172
ymax_i, xmax_i = numerix.nonzero(
7273
numerix.greater_equal(z, zmax))
@@ -87,7 +88,7 @@ def OnWhiz(self,evt):
8788
z = numerix.sin(self.x) + numerix.cos(self.y)
8889
self.im.set_array(z)
8990

90-
zmax = numerix.max(numerix.max(z))-ERR_TOL
91+
zmax = mlab.max(mlab.max(z))-ERR_TOL
9192
ymax_i, xmax_i = numerix.nonzero(
9293
numerix.greater_equal(z, zmax))
9394
if self.im.origin == 'upper':

examples/image_demo2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
title('CT density')
2424

2525
if 0:
26-
x = sum(A,0)
26+
x = asum(A,0)
2727
subplot(212)
2828
bar(arange(w), x)
2929
xlim(0,h-1)

examples/layer_images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def func3(x,y):
2323
# for the images their apparent extent could be different due to
2424
# interpolation edge effects
2525

26-
xmin, xmax, ymin, ymax = min(x), max(x), min(y), max(y)
26+
xmin, xmax, ymin, ymax = amin(x), amax(x), amin(y), amax(y)
2727
extent = xmin, xmax, ymin, ymax
2828
Z1 = array(([0,1]*4 + [1,0]*4)*4); Z1.shape = 8,8 # chessboard
2929
im1 = imshow(Z1, cmap=cm.gray, interpolation='nearest',

examples/object_picker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from __future__ import division
1212
from matplotlib.numerix import sin, pi, arange, absolute, sqrt
13+
from matplotlib.numerix.mlab import amin, amax
1314

1415
import matplotlib
1516
matplotlib.use('GTKAgg')
@@ -248,7 +249,7 @@ def over_line(line):
248249
xdata, ydata = trans.numerix_x_y(line.get_xdata(),
249250
line.get_ydata())
250251
distances = sqrt((x-xdata)**2 + (y-ydata)**2)
251-
return min(distances)<epsilon
252+
return amin(distances)<epsilon
252253

253254
for ax in self.figure.axes:
254255

0 commit comments

Comments
 (0)