Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6f6fcf3

Browse files
committed
Pylab uses numpy instead of oldnumeric
svn path=/trunk/matplotlib/; revision=4176
1 parent 65b7875 commit 6f6fcf3

5 files changed

Lines changed: 60 additions & 62 deletions

File tree

CHANGELOG

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2007-11-08 Made pylab use straight numpy instead of oldnumeric
2+
by default - EF
3+
14
2007-11-08 Added additional record array utilites to mlab (rec2excel,
25
rec2gtk, rec_join, rec_append_field, rec_drop_field) - JDH
36

@@ -8,15 +11,21 @@
811
2007-11-08 Moved csv2rec to recutils and added other record array
912
utilities - JDH
1013

11-
2007-11-08 If available, use existing pyparsing installation - DSD
14+
2007-11-08 If available, use existing pyparsing installation - DSD
1215

13-
2007-11-07 Removed old enthought.traits from lib/matplotlib, added
14-
Gael Varoquaux's enthought.traits-2.6b1, which is stripped
15-
of setuptools. The package is installed to site-packages
16+
2007-11-07 Removed old enthought.traits from lib/matplotlib, added
17+
Gael Varoquaux's enthought.traits-2.6b1, which is stripped
18+
of setuptools. The package is installed to site-packages
1619
if not already available - DSD
1720

18-
2007-11-02 Commited Phil Thompson's patch 1599876, fixes to Qt4Agg
19-
backend and qt4 blitting demo - DSD
21+
2007-11-05 Added easy access to minor tick properties; slight mod
22+
of patch by Pierre G-M - EF
23+
24+
2007-11-02 Commited Phil Thompson's patch 1599876, fixes to Qt4Agg
25+
backend and qt4 blitting demo - DSD
26+
27+
2007-11-02 Commited Phil Thompson's patch 1599876, fixes to Qt4Agg
28+
backend and qt4 blitting demo - DSD
2029

2130
2007-10-31 Made log color scale easier to use with contourf;
2231
automatic level generation now works. - EF
@@ -41,7 +50,7 @@
4150
generator expressions are not supported by python-2.3 - DSD
4251

4352
2007-10-01 Made matplotlib.use() raise an exception if called after
44-
backends has been imported.
53+
backends has been imported. - EF
4554

4655
2007-09-30 Modified update* methods of Bbox and Interval so they
4756
work with reversed axes. Prior to this, trying to
@@ -201,7 +210,7 @@
201210

202211
2007-07-19 completed numpification of most trivial cases - NN
203212

204-
2007-07-19 converted non-numpy relicts troughout the code - NN
213+
2007-07-19 converted non-numpy relicts throughout the code - NN
205214

206215
2007-07-19 replaced the Python code in numerix/ by a minimal wrapper around
207216
numpy that explicitly mentions all symbols that need to be

examples/image_demo2.py

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

44
w, h = 512, 512
55
s = file('data/ct.raw', 'rb').read()
6-
A = fromstring(s, UInt16).astype(Float)
6+
A = fromstring(s, uint16).astype(float)
77
A *= 1.0/max(A)
88
A.shape = w, h
99

examples/mathtext_demo.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
latex rendering, see the text.usetex option
55
"""
66
import numpy as npy
7-
from pylab import figure, show
7+
from matplotlib.pyplot import figure, show
8+
89
fig = figure()
910
fig.subplots_adjust(bottom=0.2)
1011

@@ -21,7 +22,8 @@
2122

2223
ax.legend(("Foo", "Testing $x^2$"))
2324

24-
#title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20)
25-
fig.savefig('mathtext_demo')
25+
ax.set_title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20)
26+
#fig.savefig('mathtext_demo')
2627

2728
show()
29+

examples/mri_with_eeg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
if 1: # load the data
1616
# data are 256x256 16 bit integers
1717
dfile = 'data/s1045.ima'
18-
im = fromstring(file(dfile, 'rb').read(), UInt16).astype(Float)
18+
im = fromstring(file(dfile, 'rb').read(), uint16).astype(float)
1919
im.shape = 256, 256
2020

2121
if 1: # plot the MRI in pcolor
@@ -37,7 +37,7 @@
3737
if 1: # plot the EEG
3838
# load the data
3939
numSamples, numRows = 800,4
40-
data = fromstring(file('data/eeg.dat', 'rb').read(), Float)
40+
data = fromstring(file('data/eeg.dat', 'rb').read(), float)
4141
data.shape = numSamples, numRows
4242
t = arange(numSamples)/float(numSamples)*10.0
4343
ticklocs = []

lib/matplotlib/pylab.py

Lines changed: 35 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -230,38 +230,6 @@
230230
# bring all the symbols in so folks can import them from
231231
# pylab in one fell swoop
232232

233-
from numpy.oldnumeric import array, zeros, shape, rank, size, fromstring,\
234-
take, put, putmask, reshape, repeat, choose, searchsorted,\
235-
cumsum, product, cumproduct, alltrue, sometrue, allclose,\
236-
arrayrange, arange, asarray, convolve, swapaxes, concatenate,\
237-
transpose, sort, argsort, argmax, argmin, innerproduct, dot,\
238-
outerproduct, resize, indices, fromfunction, diagonal, trace,\
239-
ravel, nonzero, shape, where, compress, clip, zeros, ones,\
240-
identity, add, logical_or, exp, subtract, logical_xor,\
241-
log, multiply, logical_not, log10, divide, maximum, sin,\
242-
minimum, sinh, conjugate, bitwise_and, sqrt, power, bitwise_or,\
243-
tan, absolute, bitwise_xor, tanh, negative, ceil, greater, fabs,\
244-
greater_equal, floor, less, arccos, arctan2, less_equal, arcsin,\
245-
fmod, equal, arctan, hypot, not_equal, cos, around, logical_and,\
246-
cosh, arccosh, arcsinh, arctanh, cross_correlate,\
247-
pi, ArrayType, matrixmultiply
248-
249-
from numpy.oldnumeric import sum as asum
250-
251-
from numpy.oldnumeric import Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32,\
252-
Float64, Complex32, Complex64, Float, Int, Complex
253-
254-
from numpy.fft import fft # Why just fft?
255-
from numpy.linalg import inv as inverse
256-
from numpy.oldnumeric.linear_algebra import eigenvectors
257-
# not quite the same as linalg.eig
258-
259-
260-
pymin, pymax = min, max
261-
from numpy.oldnumeric.mlab import *
262-
min, max = pymin, pymax
263-
from numpy import amin, amax
264-
265233
from matplotlib.mlab import window_hanning, window_none,\
266234
conv, detrend, detrend_mean, detrend_none, detrend_linear,\
267235
polyfit, polyval, entropy, normpdf,\
@@ -271,23 +239,42 @@
271239
diagonal_matrix, base_repr, binary_repr, log2, ispower2,\
272240
bivariate_normal, load, save, stineman_interp
273241

274-
from numpy import meshgrid, linspace, logspace, corrcoef, vander
242+
from numpy import *
243+
from numpy.fft import *
244+
from numpy.random import *
245+
from numpy.linalg import *
246+
247+
# old style--if True, override standard numpy with oldnumeric
248+
if False:
249+
from numpy.oldnumeric import array, zeros, shape, rank, size, fromstring,\
250+
take, put, putmask, reshape, repeat, choose, searchsorted,\
251+
cumsum, product, cumproduct, alltrue, sometrue, allclose,\
252+
arrayrange, arange, asarray, convolve, swapaxes, concatenate,\
253+
transpose, sort, argsort, argmax, argmin, innerproduct, dot,\
254+
outerproduct, resize, indices, fromfunction, diagonal, trace,\
255+
ravel, nonzero, shape, where, compress, clip, zeros, ones,\
256+
identity, add, logical_or, exp, subtract, logical_xor,\
257+
log, multiply, logical_not, log10, divide, maximum, sin,\
258+
minimum, sinh, conjugate, bitwise_and, sqrt, power, bitwise_or,\
259+
tan, absolute, bitwise_xor, tanh, negative, ceil, greater, fabs,\
260+
greater_equal, floor, less, arccos, arctan2, less_equal, arcsin,\
261+
fmod, equal, arctan, hypot, not_equal, cos, around, logical_and,\
262+
cosh, arccosh, arcsinh, arctanh, cross_correlate,\
263+
pi, ArrayType, matrixmultiply
264+
265+
from numpy.oldnumeric import sum as asum
266+
267+
from numpy.oldnumeric import Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32,\
268+
Float64, Complex32, Complex64, Float, Int, Complex
269+
270+
pymin, pymax = min, max
271+
from numpy.oldnumeric.mlab import *
272+
min, max = pymin, pymax
273+
from numpy import amin, amax
274+
from numpy.oldnumeric.linear_algebra import eigenvectors
275+
# not quite the same as linalg.eig
276+
from numpy.linalg import inv as inverse
275277

276-
"""
277-
problem syms
278-
- cross_correlate - getting from convolve
279-
average
280-
sarray
281-
dump
282-
dumps
283-
load
284-
loads
285-
divide_safe
286-
invert
287-
left_shift
288-
right_shift
289-
sign
290-
"""
291278

292279
from matplotlib.pyplot import *
293280

0 commit comments

Comments
 (0)