|
From: <nn...@us...> - 2007-07-19 16:53:43
|
Revision: 3575
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3575&view=rev
Author: nnemec
Date: 2007-07-19 09:53:36 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
converted many non-numpy relicts
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/axes3d.py
trunk/matplotlib/lib/matplotlib/axis.py
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py
trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
trunk/matplotlib/lib/matplotlib/colors.py
trunk/matplotlib/lib/matplotlib/image.py
trunk/matplotlib/lib/matplotlib/legend.py
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/lib/matplotlib/mlab.py
trunk/matplotlib/lib/matplotlib/numerix/__init__.py
trunk/matplotlib/lib/matplotlib/patches.py
trunk/matplotlib/lib/matplotlib/proj3d.py
trunk/matplotlib/lib/matplotlib/table.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/CHANGELOG 2007-07-19 16:53:36 UTC (rev 3575)
@@ -1,3 +1,5 @@
+2007-07-19 converted non-numpy relicts troughout the code
+
2007-07-19 replaced the Python code in numerix/ by a minimal wrapper around
numpy that explicitly mentions all symbols that need to be
addressed for further numpification - NN
Modified: trunk/matplotlib/lib/matplotlib/axes3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes3d.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/axes3d.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -309,8 +309,8 @@
viewM = proj3d.view_transformation(E,R,V)
perspM = proj3d.persp_transformation(zfront,zback)
- M0 = nx.matrixmultiply(viewM,worldM)
- M = nx.matrixmultiply(perspM,M0)
+ M0 = nx.dot(viewM,worldM)
+ M = nx.dot(perspM,M0)
return M
def mouse_init(self):
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/axis.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -8,7 +8,7 @@
import sys
from numerix import arange, array, asarray, ones, zeros, \
- nonzero, take, Float, log10, logical_and, \
+ nonzero, take, log10, logical_and, \
dot, sin, cos, tan, pi, sqrt
from artist import Artist, setp
@@ -118,7 +118,7 @@
def contains(self, mouseevent):
"""Test whether the mouse event occured in the Tick marks.
-
+
This function always returns false. It is more useful to test if the
axis as a whole contains the mouse rather than the set of tick marks.
"""
@@ -492,7 +492,7 @@
LABELPAD = 5
OFFSETTEXTPAD = 3
- def __str__(self):
+ def __str__(self):
return str(self.__class__).split('.')[-1] \
+ "(%d,%d)"%self.axes.transAxes.xy_tup((0,0))
@@ -657,7 +657,7 @@
def get_offset_text(self):
'Return the axis offsetText as a Text instance'
return self.offsetText
-
+
def get_pickradius(self):
'Return the depth of the axis used by the picker'
return self.pickradius
@@ -901,11 +901,11 @@
self.minor.locator = locator
self.minor.locator.set_view_interval( self.get_view_interval() )
self.minor.locator.set_data_interval( self.get_data_interval() )
-
+
def set_pickradius(self, pickradius):
"""
Set the depth of the axis used by the picker
-
+
ACCEPTS: a distance in points
"""
self.pickradius = pickradius
@@ -967,12 +967,12 @@
class XAxis(Axis):
__name__ = 'xaxis'
-
+
def contains(self,mouseevent):
"""Test whether the mouse event occured in the x axis.
"""
if callable(self._contains): return self._contains(self,mouseevent)
-
+
xpixel,ypixel = mouseevent.x,mouseevent.y
try:
xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
@@ -1155,11 +1155,11 @@
def contains(self,mouseevent):
"""Test whether the mouse event occurred in the y axis.
-
+
Returns T/F, {}
"""
if callable(self._contains): return self._contains(self,mouseevent)
-
+
xpixel,ypixel = mouseevent.x,mouseevent.y
try:
xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -73,7 +73,7 @@
import os, sys
import matplotlib
from matplotlib import verbose, rcParams
-from matplotlib.numerix import array, Float, zeros, transpose
+from numpy import array, zeros, transpose
from matplotlib._image import fromarray
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import RendererBase,\
@@ -154,8 +154,8 @@
point in x, y
"""
if __debug__: verbose.report('RendererAgg.draw_line', 'debug-annoying')
- x = array([x1,x2], typecode=Float)
- y = array([y1,y2], typecode=Float)
+ x = array([x1,x2], float)
+ y = array([y1,y2], float)
self._renderer.draw_lines(gc, x, y)
@@ -273,7 +273,7 @@
def func(x):
return transpose(fliplr(x))
- Z = zeros((n,m,4), typecode=Float)
+ Z = zeros((n,m,4), float)
Z[:,:,0] = func(r)
Z[:,:,1] = func(g)
Z[:,:,2] = func(b)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -8,7 +8,7 @@
import matplotlib.agg as agg
from matplotlib import verbose
-from matplotlib.numerix import array, Float
+from numpy import array
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import RendererBase,\
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -38,7 +38,7 @@
from matplotlib.cbook import enumerate, izip
from matplotlib.figure import Figure
from matplotlib.mathtext import math_parse_s_ft2font
-import matplotlib.numerix as numx
+import numpy as npy
from matplotlib.transforms import Bbox
from matplotlib import rcParams
@@ -137,8 +137,8 @@
ctx.rotate(rotation)
ctx.scale(width / 2.0, height / 2.0)
ctx.new_sub_path()
- ctx.arc(0.0, 0.0, 1.0, numx.pi * angle1 / 180.,
- numx.pi * angle2 / 180.)
+ ctx.arc(0.0, 0.0, 1.0, npy.pi * angle1 / 180.,
+ npy.pi * angle2 / 180.)
ctx.restore()
self._fill_and_stroke (ctx, rgbFace)
@@ -243,7 +243,7 @@
# render by drawing a 0.5 radius circle
ctx = gc.ctx
ctx.new_path()
- ctx.arc (x, self.height - y, 0.5, 0, 2*numx.pi)
+ ctx.arc (x, self.height - y, 0.5, 0, 2*npy.pi)
self._fill_and_stroke (ctx, gc.get_rgb())
@@ -294,7 +294,7 @@
ctx.save()
if angle:
- ctx.rotate (-angle * numx.pi / 180)
+ ctx.rotate (-angle * npy.pi / 180)
ctx.set_font_size (size)
ctx.show_text (s)
ctx.restore()
@@ -304,7 +304,7 @@
if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
# mathtext using the gtk/gdk method
- #if numx.which[0] == "numarray":
+ #if npy.which[0] == "numarray":
# warnings.warn("_draw_mathtext() currently works for numpy, but "
# "not numarray")
# return
@@ -327,21 +327,21 @@
N = imw*imh
# a numpixels by num fonts array
- Xall = numx.zeros((N,len(fonts)), typecode=numx.UInt8)
+ Xall = npy.zeros((N,len(fonts)), npy.uint8)
for i, font in enumerate(fonts):
if angle == 90:
font.horiz_image_to_vert_image() # <-- Rotate
imw, imh, s = font.image_as_str()
- Xall[:,i] = numx.fromstring(s, numx.UInt8)
+ Xall[:,i] = npy.fromstring(s, npy.uint8)
# get the max alpha at each pixel
- Xs = numx.mlab.max (Xall,1)
+ Xs = npy.mlab.max (Xall,1)
# convert it to it's proper shape
Xs.shape = imh, imw
- pa = numx.zeros(shape=(imh,imw,4), typecode=numx.UInt8)
+ pa = npy.zeros((imh,imw,4), npy.uint8)
rgb = gc.get_rgb()
pa[:,:,0] = int(rgb[0]*255)
pa[:,:,1] = int(rgb[1]*255)
@@ -469,7 +469,7 @@
self.ctx.set_dash([], 0) # switch dashes off
else:
self.ctx.set_dash (
- self.renderer.points_to_pixels (numx.asarray(dashes)), offset)
+ self.renderer.points_to_pixels (npy.asarray(dashes)), offset)
def set_foreground(self, fg, isRGB=None):
@@ -593,7 +593,7 @@
ctx = renderer.ctx
if orientation == 'landscape':
- ctx.rotate (numx.pi/2)
+ ctx.rotate (npy.pi/2)
ctx.translate (0, -height_in_points)
# cairo/src/cairo_ps_surface.c
# '%%Orientation: Portrait' is always written to the file header
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gd.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gd.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -115,8 +115,8 @@
point in x, y
"""
- x = x.astype(nx.Int16)
- y = self.height*ones(y.shape, nx.Int16) - y.astype(nx.Int16)
+ x = x.astype(nx.int16)
+ y = self.height*ones(y.shape, nx.int16) - y.astype(nx.int16)
style = self._set_gd_style(gc)
self.im.lines( zip(x,y), style)
self.flush_clip()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -24,7 +24,7 @@
from matplotlib.figure import Figure
from matplotlib.mathtext import math_parse_s_ft2font
import matplotlib.numerix as numerix
-from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
+from matplotlib.numerix import asarray, fromstring, uint8, zeros, \
where, transpose, nonzero, indices, ones, nx
@@ -106,7 +106,7 @@
im.flipud_out()
rows, cols, image_str = im.as_rgba_str()
- image_array = fromstring(image_str, UInt8)
+ image_array = fromstring(image_str, uint8)
image_array.shape = rows, cols, 4
pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
@@ -144,8 +144,8 @@
def draw_lines(self, gc, x, y, transform=None):
if gc.gdkGC.line_width > 0:
- x = x.astype(nx.Int16)
- y = self.height - y.astype(nx.Int16)
+ x = x.astype(nx.int16)
+ y = self.height - y.astype(nx.int16)
self.gdkDrawable.draw_lines(gc.gdkGC, zip(x,y))
@@ -213,13 +213,13 @@
N = imw*imh
# a numpixels by num fonts array
- Xall = zeros((N,len(fonts)), typecode=UInt8)
+ Xall = zeros((N,len(fonts)), uint8)
for i, font in enumerate(fonts):
if angle == 90:
font.horiz_image_to_vert_image() # <-- Rotate
imw, imh, image_str = font.image_as_str()
- Xall[:,i] = fromstring(image_str, UInt8)
+ Xall[:,i] = fromstring(image_str, uint8)
# get the max alpha at each pixel
Xs = numerix.mlab.max(Xall,1)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -22,9 +22,8 @@
from matplotlib.cbook import is_string_like, enumerate
from matplotlib.colors import colorConverter
from matplotlib.figure import Figure
-import matplotlib.numerix as numerix
-from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
- where, transpose, nonzero, indices, ones, nx
+from numpy import asarray, fromstring, zeros, \
+ where, transpose, nonzero, indices, ones
from matplotlib.widgets import SubplotTool
from matplotlib import lines
@@ -156,7 +155,7 @@
gdk.LEAVE_NOTIFY_MASK |
gdk.POINTER_MOTION_MASK |
gdk.POINTER_MOTION_HINT_MASK)
-
+
def __init__(self, figure):
if _debug: print 'FigureCanvasGTK.%s' % fn_name()
FigureCanvasBase.__init__(self, figure)
@@ -1087,7 +1086,7 @@
hbox.show_all()
self.set_extra_widget(hbox)
-
+
def get_filename_from_user (self):
while True:
filename = None
@@ -1137,7 +1136,7 @@
def __init__(self, lines):
import gtk.glade
-
+
datadir = matplotlib.get_data_path()
gladefile = os.path.join(datadir, 'lineprops.glade')
if not os.path.exists(gladefile):
@@ -1279,7 +1278,7 @@
# Unfortunately, the SVG renderer (rsvg) leaks memory under earlier
# versions of pygtk, so we have to use a PNG file instead.
try:
-
+
if gtk.pygtk_version < (2, 8, 0):
icon_filename = 'matplotlib.png'
else:
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -28,7 +28,7 @@
from matplotlib.dviread import Dvi
from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE
from matplotlib.mathtext import math_parse_s_pdf
-from matplotlib.numerix import Float32, UInt8, fromstring, arange, infinity, isnan, asarray
+from numpy import float32, uint8, fromstring, arange, infinity, isnan, asarray
from matplotlib.transforms import Bbox
from matplotlib import ttconv
@@ -543,13 +543,13 @@
fontdict['FontMatrix'] = [ .001, 0, 0, .001, 0, 0 ]
fontdict['CharProcs'] = charprocsObject
fontdict['Encoding'] = {
- 'Type': Name('Encoding'),
+ 'Type': Name('Encoding'),
'Differences': differencesArray}
elif fonttype == 42:
fontdict['Subtype'] = Name('TrueType')
fontdict['Encoding'] = Name('WinAnsiEncoding')
-
+
flags = 0
symbolic = False #ps_name.name in ('Cmsy10', 'Cmmi10', 'Cmex10')
if ff & FIXED_WIDTH: flags |= 1 << 0
@@ -632,7 +632,7 @@
self.beginStream(charprocObject.id,
None,
{'Length': len(stream)})
- self.currentstream.write(stream)
+ self.currentstream.write(stream)
self.endStream()
charprocs[charname] = charprocObject
self.writeObject(charprocsObject, charprocs)
@@ -755,20 +755,20 @@
def _rgb(self, im):
h,w,s = im.as_rgba_str()
- rgba = fromstring(s, UInt8)
+ rgba = fromstring(s, uint8)
rgba.shape = (h, w, 4)
rgb = rgba[:,:,:3]
return h, w, rgb.tostring()
def _gray(self, im, rc=0.3, gc=0.59, bc=0.11):
rgbat = im.as_rgba_str()
- rgba = fromstring(rgbat[2], UInt8)
+ rgba = fromstring(rgbat[2], uint8)
rgba.shape = (rgbat[0], rgbat[1], 4)
- rgba_f = rgba.astype(Float32)
+ rgba_f = rgba.astype(float32)
r = rgba_f[:,:,0]
g = rgba_f[:,:,1]
b = rgba_f[:,:,2]
- gray = (r*rc + g*gc + b*bc).astype(UInt8)
+ gray = (r*rc + g*gc + b*bc).astype(uint8)
return rgbat[0], rgbat[1], gray.tostring()
def writeImages(self):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -26,7 +26,7 @@
from matplotlib.transforms import get_vec6_scales
-from matplotlib.numerix import UInt8, Float32, alltrue, array, ceil, equal, \
+from matplotlib.numerix import uint8, float32, alltrue, array, ceil, equal, \
fromstring, nonzero, ones, put, take, where, isnan
import binascii
import re
@@ -336,20 +336,20 @@
def _rgb(self, im):
h,w,s = im.as_rgba_str()
- rgba = fromstring(s, UInt8)
+ rgba = fromstring(s, uint8)
rgba.shape = (h, w, 4)
rgb = rgba[:,:,:3]
return h, w, rgb.tostring()
def _gray(self, im, rc=0.3, gc=0.59, bc=0.11):
rgbat = im.as_rgba_str()
- rgba = fromstring(rgbat[2], UInt8)
+ rgba = fromstring(rgbat[2], uint8)
rgba.shape = (rgbat[0], rgbat[1], 4)
- rgba_f = rgba.astype(Float32)
+ rgba_f = rgba.astype(float32)
r = rgba_f[:,:,0]
g = rgba_f[:,:,1]
b = rgba_f[:,:,2]
- gray = (r*rc + g*gc + b*bc).astype(UInt8)
+ gray = (r*rc + g*gc + b*bc).astype(uint8)
return rgbat[0], rgbat[1], gray.tostring()
def _hex_lines(self, s, chars_per_line=128):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -5,9 +5,8 @@
import matplotlib
from matplotlib import verbose
-from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
- where, transpose, nonzero, indices, ones, nx
-import matplotlib.numerix as numerix
+from numpy import asarray, fromstring, zeros, \
+ where, transpose, nonzero, indices, ones
from matplotlib.cbook import is_string_like, enumerate, onetrue
from matplotlib.font_manager import fontManager
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
@@ -323,7 +322,7 @@
for text, tooltip_text, image_file, callback in self.toolitems:
if text is not None:
qt.QObject.disconnect( self.buttons[ text ],
- qt.SIGNAL( 'clicked()' ),
+ qt.SIGNAL( 'clicked()' ),
getattr( self, callback ) )
def pan( self, *args ):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -5,9 +5,8 @@
import matplotlib
from matplotlib import verbose
-from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
- where, transpose, nonzero, indices, ones, nx
-import matplotlib.numerix as numerix
+from numpy import asarray, fromstring, zeros, \
+ where, transpose, nonzero, indices, ones
from matplotlib.cbook import is_string_like, enumerate, onetrue
from matplotlib.font_manager import fontManager
from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -432,7 +432,7 @@
mask_bad = ma.getmask(xma)
if xa.dtype.char in npy.typecodes['Float']:
npy.putmask(xa, xa==1.0, 0.9999999) #Treat 1.0 as slightly less than 1.
- xa = (xa * self.N).astype(npy.int)
+ xa = (xa * self.N).astype(int)
# Set the over-range indices before the under-range;
# otherwise the under-range values get converted to over-range.
npy.putmask(xa, xa>self.N-1, self._i_over)
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/image.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -11,7 +11,7 @@
import cm
import numerix
import numerix.ma as ma
-from numerix import arange, asarray, UInt8, Float32, repeat, NewAxis, typecode
+from numerix import arange, asarray, uint8, float32, repeat, newaxis
import _image
@@ -117,7 +117,7 @@
raise RuntimeError('You must first set the image array or the image attribute')
if self._imcache is None:
- if typecode(self._A) == UInt8 and len(self._A.shape) == 3:
+ if self._A.dtype == uint8 and len(self._A.shape) == 3:
im = _image.frombyte(self._A, 0)
im.is_grayscale = False
else:
@@ -186,7 +186,7 @@
"""Test whether the mouse event occured within the image.
"""
if callable(self._contains): return self._contains(self,mouseevent)
- # TODO: make sure this is consistent with patch and patch
+ # TODO: make sure this is consistent with patch and patch
# collection on nonlinear transformed coordinates.
# TODO: consider returning image coordinates (shouldn't
# be too difficult given that the image is rectilinear
@@ -197,7 +197,7 @@
inside = xdata>=xmin and xdata<=xmax and ydata>=ymin and ydata<=ymax
else:
inside = False
-
+
return inside,{}
def write_png(self, fname, noscale=False):
@@ -333,8 +333,8 @@
return im
def set_data(self, x, y, A):
- x = asarray(x).astype(Float32)
- y = asarray(y).astype(Float32)
+ x = asarray(x,float32)
+ y = asarray(y,float32)
A = asarray(A)
if len(x.shape) != 1 or len(y.shape) != 1\
or A.shape[0:2] != (y.shape[0], x.shape[0]):
@@ -346,16 +346,16 @@
if len(A.shape) == 3 and A.shape[2] == 1:
A.shape = A.shape[0:2]
if len(A.shape) == 2:
- if typecode(A) != UInt8:
- A = (self.cmap(self.norm(A))*255).astype(UInt8)
+ if A.dtype != uint8:
+ A = (self.cmap(self.norm(A))*255).astype(uint8)
else:
- A = repeat(A[:,:,NewAxis], 4, 2)
+ A = repeat(A[:,:,newaxis], 4, 2)
A[:,:,3] = 255
else:
- if typecode(A) != UInt8:
- A = (255*A).astype(UInt8)
+ if A.dtype != uint8:
+ A = (255*A).astype(uint8)
if A.shape[2] == 3:
- B = zeros(tuple(list(A.shape[0:2]) + [4]), UInt8)
+ B = zeros(tuple(list(A.shape[0:2]) + [4]), uint8)
B[:,:,0:3] = A
B[:,:,3] = 255
A = B
@@ -428,7 +428,7 @@
inside = xdata>=xmin and xdata<=xmax and ydata>=ymin and ydata<=ymax
else:
inside = False
-
+
return inside,{}
def get_size(self):
@@ -441,7 +441,7 @@
def get_extent(self):
'get the image extent: left, right, bottom, top'
numrows, numcols = self.get_size()
- return (-0.5+self.ox, numcols-0.5+self.ox,
+ return (-0.5+self.ox, numcols-0.5+self.ox,
-0.5+self.oy, numrows-0.5+self.oy)
def make_image(self, magnification=1.0):
@@ -504,6 +504,6 @@
raise RuntimeError('Unknown image mode')
x_str = im.tostring('raw',im.mode,0,-1)
- x = numerix.fromstring(x_str,numerix.UInt8)
+ x = numerix.fromstring(x_str,numerix.uint8)
x.shape = im.size[1], im.size[0], 4
return x
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/legend.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -22,7 +22,7 @@
"""
from __future__ import division
import sys, warnings
-from numerix import array, ones, Float
+from numerix import array, ones
from matplotlib import verbose, rcParams
@@ -280,7 +280,7 @@
x, y = label.get_position()
x -= self.handlelen + self.handletextsep
if isinstance(handle, Line2D):
- ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
+ ydata = (y-HEIGHT/2)*ones(self._xdata.shape, float)
legline = Line2D(self._xdata, ydata)
legline.update_from(handle)
self._set_artist_props(legline) # after update
@@ -298,7 +298,7 @@
p.set_clip_box(None)
ret.append(p)
elif isinstance(handle, LineCollection):
- ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
+ ydata = (y-HEIGHT/2)*ones(self._xdata.shape, float)
legline = Line2D(self._xdata, ydata)
self._set_artist_props(legline)
legline.set_clip_box(None)
@@ -555,7 +555,7 @@
for handle, tup in zip(self.legendHandles, hpos):
y,h = tup
if isinstance(handle, Line2D):
- ydata = y*ones(self._xdata.shape, Float)
+ ydata = y*ones(self._xdata.shape, float)
handle.set_ydata(ydata+h/2)
elif isinstance(handle, Rectangle):
handle.set_y(y+1/4*h)
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -9,10 +9,10 @@
import sys, math, warnings
import agg
-from numerix import Float, alltrue, arange, array, logical_and, \
+from numerix import alltrue, arange, array, logical_and, \
nonzero, searchsorted, take, asarray, ones, where, less, ravel, \
greater, cos, sin, pi, sqrt, less_equal, \
- compress, zeros, concatenate, cumsum, typecode, NewAxis
+ compress, zeros, concatenate, cumsum, newaxis
import numerix.ma as ma
from matplotlib import verbose
import artist
@@ -64,12 +64,12 @@
if len(i1) == 0:
return None
if not compressed:
- return concatenate((i0[:, NewAxis], i1[:, NewAxis]), axis=1)
+ return concatenate((i0[:, newaxis], i1[:, newaxis]), axis=1)
seglengths = i1 - i0
breakpoints = cumsum(seglengths)
ic0 = concatenate(((0,), breakpoints[:-1]))
ic1 = breakpoints
- return concatenate((ic0[:, NewAxis], ic1[:, NewAxis]), axis=1)
+ return concatenate((ic0[:, newaxis], ic1[:, newaxis]), axis=1)
def segment_hits(cx,cy,x,y,radius):
"""Determine if any line segments are within radius of a point. Returns
@@ -88,7 +88,7 @@
u = ( (cx-xr)*dx + (cy-yr)*dy )/Lnorm_sq
candidates = (u>=0) & (u<=1)
#if any(candidates): print "candidates",xr[candidates]
-
+
# Note that there is a little area near one side of each point
# which will be near neither segment, and another which will
# be near both, depending on the angle of the lines. The
@@ -96,7 +96,7 @@
point_hits = (cx - x)**2 + (cy - y)**2 <= radius**2
#if any(point_hits): print "points",xr[candidates]
candidates = candidates & ~point_hits[:-1] & ~point_hits[1:]
-
+
# For those candidates which remain, determine how far they lie away
# from the line.
px,py = xr+u*dx,yr+u*dy
@@ -164,7 +164,7 @@
else:
return "Line2D(%s)"\
%(",".join(["(%g,%g)"%(x,y) for x,y in zip(self._x,self._y)]))
-
+
def __init__(self, xdata, ydata,
linewidth = None, # all Nones default to rc
linestyle = None,
@@ -274,25 +274,25 @@
self.set_data(xdata, ydata)
self._logcache = None
-
+
# TODO: do we really need 'newstyle'
self._newstyle = False
def contains(self, mouseevent):
"""Test whether the mouse event occurred on the line. The pick radius determines
the precision of the location test (usually within five points of the value). Use
- get/set pickradius() to view or modify it.
-
- Returns True if any values are within the radius along with {'ind': pointlist},
+ get/set pickradius() to view or modify it.
+
+ Returns True if any values are within the radius along with {'ind': pointlist},
where pointlist is the set of points within the radius.
-
+
TODO: sort returned indices by distance
"""
if callable(self._contains): return self._contains(self,mouseevent)
-
+
if not is_numlike(self.pickradius):
raise ValueError,"pick radius should be a distance"
-
+
if self._newstyle:
# transform in backend
x = self._x
@@ -308,7 +308,7 @@
pixels = self.pickradius
else:
pixels = self.figure.dpi.get()/72. * self.pickradius
-
+
if self._linestyle == 'None':
# If no line, return the nearby point(s)
d = sqrt((xt-mouseevent.x)**2 + (yt-mouseevent.y)**2)
@@ -322,21 +322,21 @@
print 'd', (xt-mouseevent.x)**2., (yt-mouseevent.y)**2.
print d, pixels, ind
return len(ind)>0,dict(ind=ind)
-
+
def get_pickradius(self):
'return the pick radius used for containment tests'
return self.pickradius
- def set_pickradius(self,d):
+ def set_pickradius(self,d):
"""Sets the pick radius used for containment tests
-
+
Accepts: float distance in points.
"""
self.pickradius = d
-
+
def set_picker(self,p):
"""Sets the event picker details for the line.
-
+
Accepts: float distance in points or callable pick function fn(artist,event)
"""
if callable(p):
@@ -344,7 +344,7 @@
else:
self.pickradius = p
self._picker = p
-
+
def get_window_extent(self, renderer):
self._newstyle = hasattr(renderer, 'draw_markers')
if self._newstyle:
@@ -398,15 +398,15 @@
def recache(self):
#if self.axes is None: print 'recache no axes'
#else: print 'recache units', self.axes.xaxis.units, self.axes.yaxis.units
- x = ma.asarray(self.convert_xunits(self._xorig), Float)
- y = ma.asarray(self.convert_yunits(self._yorig), Float)
+ x = ma.asarray(self.convert_xunits(self._xorig), float)
+ y = ma.asarray(self.convert_yunits(self._yorig), float)
x = ma.ravel(x)
y = ma.ravel(y)
if len(x)==1 and len(y)>1:
- x = x * ones(y.shape, Float)
+ x = x * ones(y.shape, float)
if len(y)==1 and len(x)>1:
- y = y * ones(x.shape, Float)
+ y = y * ones(x.shape, float)
if len(x) != len(y):
raise RuntimeError('xdata and ydata must be the same length')
@@ -421,8 +421,8 @@
else:
self._segments = None
- self._x = asarray(x, Float)
- self._y = asarray(y, Float)
+ self._x = asarray(x, float)
+ self._y = asarray(y, float)
self._logcache = None
@@ -557,7 +557,7 @@
else:
return self._markerfacecolor
-
+
def get_markersize(self): return self._markersize
def get_xdata(self, orig=True):
@@ -708,9 +708,9 @@
def _draw_steps(self, renderer, gc, xt, yt):
siz=len(xt)
if siz<2: return
- xt2=ones((2*siz,), typecode(xt))
+ xt2=ones((2*siz,), xt.dtype)
xt2[0:-1:2], xt2[1:-1:2], xt2[-1]=xt, xt[1:], xt[-1]
- yt2=ones((2*siz,), typecode(yt))
+ yt2=ones((2*siz,), yt.dtype)
yt2[0:-1:2], yt2[1::2]=yt, yt
gc.set_linestyle('solid')
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -71,7 +71,7 @@
multiply, transpose, ravel, repeat, resize, reshape, floor, ceil,\
absolute, matrixmultiply, power, take, where, Float, Int, asum,\
dot, convolve, pi, Complex, ones, zeros, diagonal, Matrix, nonzero, \
- log, searchsorted, concatenate, sort, ArrayType, clip, size, indices,\
+ log, searchsorted, concatenate, sort, ArrayType, ndarray, clip, size, indices,\
conjugate, typecode, iscontiguous
@@ -184,7 +184,7 @@
# for real x, ignore the negative frequencies
- if typecode(x)==Complex: numFreqs = NFFT
+ if npy.iscomplexobj(x): numFreqs = NFFT
else: numFreqs = NFFT//2+1
if iterable(window):
@@ -195,7 +195,7 @@
step = NFFT-noverlap
ind = range(0,len(x)-NFFT+1,step)
n = len(ind)
- Pxx = zeros((numFreqs,n), Float)
+ Pxx = zeros((numFreqs,n), float)
# do the ffts of the slices
for i in range(n):
thisX = x[ind[i]:ind[i]+NFFT]
@@ -243,7 +243,7 @@
if NFFT % 2:
raise ValueError, 'NFFT must be a power of 2'
-
+
x = asarray(x) # make sure we're dealing with a numpy array
y = asarray(y) # make sure we're dealing with a numpy array
@@ -258,7 +258,7 @@
y[n:] = 0
# for real x, ignore the negative frequencies
- if typecode(x)==Complex: numFreqs = NFFT
+ if npy.iscomplexobj(x): numFreqs = NFFT
else: numFreqs = NFFT//2+1
if iterable(window):
@@ -269,7 +269,7 @@
step = NFFT-noverlap
ind = range(0,len(x)-NFFT+1,step)
n = len(ind)
- Pxy = zeros((numFreqs,n), Complex)
+ Pxy = zeros((numFreqs,n), complex)
# do the ffts of the slices
for i in range(n):
@@ -542,7 +542,7 @@
del seen
# for real X, ignore the negative frequencies
- if typecode(X)==Complex: numFreqs = NFFT
+ if npy.iscomplexobj(X): numFreqs = NFFT
else: numFreqs = NFFT//2+1
# cache the FFT of every windowed, detrended NFFT length segement
@@ -562,7 +562,7 @@
normVal = norm(windowVals)**2
for iCol in allColumns:
progressCallback(i/Ncols, 'Cacheing FFTs')
- Slices = zeros( (numSlices,numFreqs), Complex)
+ Slices = zeros( (numSlices,numFreqs), complex)
for iSlice in slices:
thisSlice = X[ind[iSlice]:ind[iSlice]+NFFT, iCol]
thisSlice = windowVals*detrend(thisSlice)
@@ -618,7 +618,7 @@
n,bins = hist(y, bins)
- n = n.astype(Float)
+ n = n.astype(float)
n = take(n, nonzero(n)) # get the positive
@@ -691,14 +691,14 @@
dx = x[1]-x[0]
- f = 1/(N*dx)*arange(-N/2, N/2, Float)
+ f = 1/(N*dx)*arange(-N/2, N/2, float)
- ind = concatenate([arange(N/2, N, Int),
- arange(N/2,Int)])
+ ind = concatenate([arange(N/2, N, int),
+ arange(0, N/2, int)])
df = f[1]-f[0]
cfl = exp(-gamma*absolute(2*pi*f)**alpha)
- px = fft(take(cfl,ind)*df).astype(Float)
+ px = fft(take(cfl,ind)*df).astype(float)
return take(px, ind)
@@ -758,7 +758,7 @@
if len(ind)==0: return arange(len(x))
if len(ind)==len(x): return array([])
- y = zeros( (len(x)+2,), Int)
+ y = zeros( (len(x)+2,), int)
y[1:-1] = x
d = diff(y)
#print 'd', d
@@ -811,7 +811,7 @@
return x[int(p*Nx/100.0)]
p = multiply(array(p), Nx/100.0)
- ind = p.astype(Int)
+ ind = p.astype(int)
ind = where(ind>=Nx, Nx-1, ind)
return take(x, ind)
@@ -846,7 +846,7 @@
# todo: implement this w/o loop. Allow optional arg to specify
# dimension to remove the mean from
if dim==1: M = transpose(M)
- M = array(M, Float)
+ M = array(M, float)
if len(M.shape)==1 or M.shape[0]==1 or M.shape[1]==1:
M = M-mean(M)
sigma = std(M)
@@ -938,9 +938,9 @@
try: Ny = len(y0)
except TypeError:
- yout = zeros( (len(t),), Float)
+ yout = zeros( (len(t),), float)
else:
- yout = zeros( (len(t), Ny), Float)
+ yout = zeros( (len(t), Ny), float)
yout[0] = y0
@@ -997,7 +997,7 @@
# for real x, ignore the negative frequencies
- if typecode(x)==Complex: numFreqs=NFFT
+ if npy.iscomplexobj(x): numFreqs=NFFT
else: numFreqs = NFFT//2+1
if iterable(window):
@@ -1008,7 +1008,7 @@
step = NFFT-noverlap
ind = arange(0,len(x)-NFFT+1,step)
n = len(ind)
- Pxx = zeros((numFreqs,n), Float)
+ Pxx = zeros((numFreqs,n), float)
# do the ffts of the slices
for i in range(n):
@@ -1021,7 +1021,7 @@
t = 1/Fs*(ind+NFFT/2)
freqs = Fs/NFFT*arange(numFreqs)
- if typecode(x) == Complex:
+ if npy.iscomplexobj(x):
freqs = concatenate((freqs[NFFT/2:]-Fs,freqs[:NFFT/2]))
Pxx = concatenate((Pxx[NFFT/2:,:],Pxx[:NFFT/2,:]),0)
@@ -1092,9 +1092,9 @@
This algorithm from
http://softsurfer.com/Archive/algorithm_0102/algorithm_0102.htm#Distance%20to%20Ray%20or%20Segment
"""
- p = asarray(p, Float)
- s0 = asarray(s0, Float)
- s1 = asarray(s1, Float)
+ p = asarray(p, float)
+ s0 = asarray(s0, float)
+ s1 = asarray(s1, float)
v = s1 - s0
w = p - s0
@@ -1178,10 +1178,10 @@
"""
def __init__(self, nmax):
'buffer up to nmax points'
- self._xa = nx.zeros((nmax,), typecode=nx.Float)
- self._ya = nx.zeros((nmax,), typecode=nx.Float)
- self._xs = nx.zeros((nmax,), typecode=nx.Float)
- self._ys = nx.zeros((nmax,), typecode=nx.Float)
+ self._xa = nx.zeros((nmax,), typecode=float)
+ self._ya = nx.zeros((nmax,), typecode=float)
+ self._xs = nx.zeros((nmax,), typecode=float)
+ self._ys = nx.zeros((nmax,), typecode=float)
self._ind = 0
self._nmax = nmax
self.dataLim = None
@@ -1242,7 +1242,7 @@
n = int(n)
N = len(x)
assert(N>n)
- y = zeros(N-(n-1),Float)
+ y = zeros(N-(n-1),float)
for i in range(n):
y += x[i:N-(n-1)+i]
y /= float(n)
@@ -1363,7 +1363,7 @@
thisLen = len(row)
X.append(row)
- X = array(X, nx.Float)
+ X = array(X, float)
r,c = X.shape
if r==1 or c==1:
X.shape = max([r,c]),
@@ -1397,15 +1397,15 @@
converterd, if not None, is a dictionary mapping column number or
munged column name to a converter function
-
+
See examples/loadrec.py
"""
-
+
if converterd is None:
converterd = dict()
-
+
import dateutil.parser
parsedate = dateutil.parser.parse
@@ -1423,8 +1423,8 @@
process_skiprows(reader)
-
+
def get_func(item, func):
# promote functions in this order
funcmap = {int:float, float:dateutil.parser.parse, dateutil.parser.parse:str}
@@ -1434,7 +1434,7 @@
raise ValueError('Could not find a working conversion function')
else: return get_func(item, funcmap[func]) # recurse
else: return func
-
+
def get_converters(reader):
converters = None
@@ -1534,10 +1534,10 @@
Icelandic Meteorological Office, March 2006 halldor at vedur.is)
"""
# Cast key variables as float.
- x=nx.asarray(x, nx.Float)
- y=nx.asarray(y, nx.Float)
+ x=nx.asarray(x, float)
+ y=nx.asarray(y, float)
- yp=nx.zeros(y.shape, nx.Float)
+ yp=nx.zeros(y.shape, float)
dx=x[1:] - x[:-1]
dy=y[1:] - y[:-1]
@@ -1592,18 +1592,18 @@
"""
# Cast key variables as float.
- x=nx.asarray(x, nx.Float)
- y=nx.asarray(y, nx.Float)
+ x=nx.asarray(x, float)
+ y=nx.asarray(y, float)
assert x.shape == y.shape
N=len(y)
if yp is None:
yp = slopes(x,y)
else:
- yp=nx.asarray(yp, nx.Float)
+ yp=nx.asarray(yp, float)
- xi=nx.asarray(xi, nx.Float)
- yi=nx.zeros(xi.shape, nx.Float)
+ xi=nx.asarray(xi, float)
+ yi=nx.zeros(xi.shape, float)
# calculate linear slopes
dx = x[1:] - x[:-1]
@@ -1633,7 +1633,7 @@
# does more calculations than necessary but exploiting the power
# of numpy, this is far more efficient than coding a loop by hand
# in Python
- yi = yo + dy1dy2 * nx.choose(nx.array(nx.sign(dy1dy2), nx.Int32)+1,
+ yi = yo + dy1dy2 * nx.choose(nx.array(nx.sign(dy1dy2), nx.int32)+1,
((2*xi-xidx-xidxp1)/((dy1-dy2)*(xidxp1-xidx)),
0.0,
1/(dy1+dy2),))
@@ -1662,11 +1662,11 @@
d = nx.where(nx.less(d, 0), twopi + d, d)
return nx.where(nx.greater(d,nx.pi), d-twopi, d)
- angles = nx.zeros((Nxy,), nx.Float)
- x1 = nx.zeros((Nxy,), nx.Float)
- y1 = nx.zeros((Nxy,), nx.Float)
- x2 = nx.zeros((Nxy,), nx.Float)
- y2 = nx.zeros((Nxy,), nx.Float)
+ angles = nx.zeros((Nxy,), float)
+ x1 = nx.zeros((Nxy,), float)
+ y1 = nx.zeros((Nxy,), float)
+ x2 = nx.zeros((Nxy,), float)
+ y2 = nx.zeros((Nxy,), float)
x = xys[:,0]
y = xys[:,1]
for i in range(Nv):
@@ -1726,7 +1726,7 @@
Nx = len(x)
if not iterable(ylower):
ylower = ylower*npy.ones(Nx)
-
+
if not iterable(yupper):
yupper = yupper*npy.ones(Nx)
@@ -1796,7 +1796,7 @@
floating point exception handling with access to the underlying
hardware."""
- if type(x) is ArrayType:
+ if type(x) is ndarray:
return exp(clip(x,exp_safe_MIN,exp_safe_MAX))
else:
return math.exp(x)
Modified: trunk/matplotlib/lib/matplotlib/numerix/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -22,16 +22,18 @@
#########################
+# the following is exclusively used and/or reexported by pylab.py and mlab.py:
+
asum = sum
matrixmultiply = dot
-#from numpy.oldnumeric import *
from numpy.oldnumeric import \
- ArrayType, cross_correlate, NewAxis, \
- arrayrange, innerproduct, outerproduct
+ ArrayType, \
+ cross_correlate, \
+ arrayrange, \
+ innerproduct, \
+ outerproduct
-newaxis = NewAxis
-
from numpy.oldnumeric import Int8, UInt8, \
Int16, UInt16, \
Int32, UInt32, \
@@ -48,7 +50,3 @@
return a.dtype.char
def iscontiguous(a):
return a.flags.contiguous
-def byteswapped(a):
- return a.byteswap()
-def itemsize(a):
- return a.itemsize
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -46,7 +46,7 @@
zorder = 1
def __str__(self):
return str(self.__class__).split('.')[-1]
-
+
def __init__(self,
edgecolor=None,
facecolor=None,
@@ -78,12 +78,12 @@
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
def contains(self, mouseevent):
- """Test whether the mouse event occurred in the patch.
-
+ """Test whether the mouse event occurred in the patch.
+
Returns T/F, {}
"""
if callable(self._contains): return self._contains(self,mouseevent)
-
+
try:
# TODO: make this consistent with patch collection algorithm
x, y = self.get_transform().inverse_xy_tup((mouseevent.x, mouseevent.y))
@@ -268,7 +268,7 @@
class Shadow(Patch):
def __str__(self):
return "Shadow(%s)"%(str(self.patch))
-
+
def __init__(self, patch, ox, oy, props=None, **kwargs):
"""
Create a shadow of the patch offset by ox, oy. props, if not None is
@@ -321,7 +321,7 @@
def __str__(self):
return str(self.__class__).split('.')[-1] \
+ "(%g,%g;%gx%g)"%(self.xy[0],self.xy[1],self.width,self.height)
-
+
def __init__(self, xy, width, height,
**kwargs):
"""
@@ -424,7 +424,7 @@
"""
def __str__(self):
return "Poly%d(%g,%g)"%(self.numVertices,self.xy[0],self.xy[1])
-
+
def __init__(self, xy, numVertices, radius=5, orientation=0,
**kwargs):
"""
@@ -470,7 +470,7 @@
"""
def __str__(self):
return "Poly(%g,%g)"%self.xy[0]
-
+
def __init__(self, xy, **kwargs):
"""
xy is a sequence of (x,y) 2 tuples
@@ -529,7 +529,7 @@
x2,y2 = self.xy[1]
cx,cy = (x1+x2)/2.,(y1+y2)/2.
return "Arrow(%g,%g)"%(cx,cy)
-
+
def __init__( self, x, y, dx, dy, width=1.0, **kwargs ):
"""Draws an arrow, starting at (x,y), direction and length
given by (dx,dy) the width of the arrow is scaled by width
@@ -548,7 +548,7 @@
cx = float(dx)/L
sx = float(dy)/L
M = npy.array( [ [ cx, sx],[ -sx, cx ] ] )
- verts = npy.matrixmultiply( arrow, M )+ [x,y]
+ verts = npy.dot( arrow, M )+ [x,y]
Polygon.__init__( self, [ tuple(t) for t in verts ], **kwargs )
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
@@ -560,7 +560,7 @@
x2,y2 = self.xy[1]
cx,cy = (x1+x2)/2.,(y1+y2)/2.
return "FancyArrow(%g,%g)"%(cx,cy)
-
+
def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False, \
head_width=None, head_length=None, shape='full', overhang=0, \
head_starts_at_zero=False,**kwargs):
@@ -622,7 +622,7 @@
cx = float(dx)/distance
sx = float(dy)/distance
M = npy.array([[cx, sx],[-sx,cx]])
- verts = npy.matrixmultiply(coords, M) + (x+dx, y+dy)
+ verts = npy.dot(coords, M) + (x+dx, y+dy)
Polygon.__init__(self, map(tuple, verts), **kwargs)
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
@@ -639,7 +639,7 @@
x2,y2 = self.xy[1]
cx,cy = (x1+x2)/2.,(y1+y2)/2.
return "YAArrow(%g,%g)"%(cx,cy)
-
+
def __init__(self, dpi, xytip, xybase, width=4, frac=0.1, headwidth=12, **kwargs):
"""
xytip : (x,y) location of arrow tip
@@ -768,7 +768,7 @@
self.center = xy
self.width, self.height = width, height
self.angle = angle
-
+
def contains(self,ev):
if ev.xdata is None or ev.ydata is None: return False,{}
inside = inellipse(ev.xdata,ev.ydata,
Modified: trunk/matplotlib/lib/matplotlib/proj3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/proj3d.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/proj3d.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -146,7 +146,7 @@
[0, 0, 0, 1]]
## end old
- return nx.matrixmultiply(Mr,Mt)
+ return nx.dot(Mr,Mt)
def persp_transformation(zfront,zback):
a = (zfront+zback)/(zfront-zback)
@@ -158,14 +158,14 @@
])
def proj_transform_vec(vec, M):
- vecw = nx.matrixmultiply(M,vec)
+ vecw = nx.dot(M,vec)
w = vecw[3]
# clip here..
txs,tys,tzs = vecw[0]/w,vecw[1]/w,vecw[2]/w
return txs,tys,tzs
def proj_transform_vec_clip(vec, M):
- vecw = nx.matrixmultiply(M,vec)
+ vecw = nx.dot(M,vec)
w = vecw[3]
# clip here..
txs,tys,tzs = vecw[0]/w,vecw[1]/w,vecw[2]/w
@@ -177,7 +177,7 @@
def inv_transform(xs,ys,zs,M):
iM = linear_algebra.inverse(M)
vec = vec_pad_ones(xs,ys,zs)
- vecr = nx.matrixmultiply(iM,vec)
+ vecr = nx.dot(iM,vec)
try:
vecr = vecr/vecr[3]
except OverflowError:
@@ -242,7 +242,7 @@
V = nx.array([0,0,1])
viewM = view_transformation(E,R,V)
perspM = persp_transformation(100,-100)
- M = nx.matrixmultiply(perspM,viewM)
+ M = nx.dot(perspM,viewM)
return M
def test_proj():
@@ -274,7 +274,7 @@
[0,sina,cosa,0],
[0,0,0,0]])
#
- return nx.matrixmultiply(M1,V)
+ return nx.dot(M1,V)
def test_rot():
V = [1,0,0,1]
Modified: trunk/matplotlib/lib/matplotlib/table.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/table.py 2007-07-19 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/table.py 2007-07-19 16:53:36 UTC (rev 3575)
@@ -22,7 +22,7 @@
from __future__ import division
import sys, warnings
from matplotlib import verbose
-from numerix import ones, Float, add, asarray
+from numpy import ones, add, asarray
import artist
from artist import Artist
@@ -248,10 +248,10 @@
bbox = bbox_all(boxes)
return inverse_transform_bbox(self.get_transform(), bbox)
-
+
def contains(self,mouseevent):
- """Test whether the mouse event occurred in the table.
-
+ """Test whether the mouse event occurred in the table.
+
Returns T/F, {}
"""
if callable(self._contains): return self._contains(self,mouseevent)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|