SF.net SVN: matplotlib: [4990] trunk/matplotlib/lib/matplotlib/mlab.py

2008-02-29 Thread mdboom
Revision: 4990
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4990&view=rev
Author:   mdboom
Date: 2008-02-29 05:13:27 -0800 (Fri, 29 Feb 2008)

Log Message:
---
Removing duplicate code from a faulty merge.

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/mlab.py

Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-02-25 20:27:51 UTC (rev 
4989)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-02-29 13:13:27 UTC (rev 
4990)
@@ -46,7 +46,6 @@
 
 = record array helper functions =
* rec2txt  : pretty print a record array
-   * rec2txt  : pretty print a record array
* rec2csv  : store record array in CSV file
* csv2rec  : import record array from CSV file with type inspection
* rec_append_field : add a field/array to record array
@@ -2114,139 +2113,6 @@
 return newrec.view(npy.recarray)
 
 
-def rec_groupby(r, groupby, stats):
-"""
-r is a numpy record array
-
-groupby is a sequence of record array attribute names that
-together form the grouping key.  eg ('date', 'productcode')
-
-stats is a sequence of (attr, func, outname) which will call x =
-func(attr) and assign x to the record array output with attribute
-outname.
-Eg,  stats = ( ('sales', len, 'numsales'), ('sales', npy.mean, 'avgsale') )
-
-return record array has dtype names for each attribute name in in
-the the 'groupby' argument, with the associated group values, and
-for each outname name in the stats argument, with the associated
-stat summary output
-"""
-# build a dictionary from groupby keys-> list of indices into r with
-# those keys
-rowd = dict()
-for i, row in enumerate(r):
-key = tuple([row[attr] for attr in groupby])
-rowd.setdefault(key, []).append(i)
-
-# sort the output by groupby keys
-keys = rowd.keys()
-keys.sort()
-
-rows = []
-for key in keys:
-row = list(key)
-# get the indices for this groupby key
-ind = rowd[key]
-thisr = r[ind]
-# call each stat function for this groupby slice
-row.extend([func(thisr[attr]) for attr, func, outname in stats])
-rows.append(row)
-
-# build the output record array with groupby and outname attributes
-attrs, funcs, outnames = zip(*stats)
-names = list(groupby)
-names.extend(outnames)
-return npy.rec.fromrecords(rows, names=names)
-
-
-
-def rec_summarize(r, summaryfuncs):
-"""
-r is a numpy record array
-
-summaryfuncs is a list of (attr, func, outname) which will
-apply codefunc to the the array r[attr] and assign the output
-to a new attribute name outname.  The returned record array is
-identical to r, with extra arrays for each element in summaryfuncs
-"""
-
-names = list(r.dtype.names)
-arrays = [r[name] for name in names]
-
-for attr, func, outname in summaryfuncs:
-names.append(outname)
-arrays.append(npy.asarray(func(r[attr])))
-
-return npy.rec.fromarrays(arrays, names=names)
-
-def rec_join(key, r1, r2):
-"""
-join record arrays r1 and r2 on key; key is a tuple of field
-names.  if r1 and r2 have equal values on all the keys in the key
-tuple, then their fields will be merged into a new record array
-containing the intersection of the fields of r1 and r2
-"""
-
-for name in key:
-if name not in r1.dtype.names:
-raise ValueError('r1 does not have key field %s'%name)
-if name not in r2.dtype.names:
-raise ValueError('r2 does not have key field %s'%name)
-
-def makekey(row):
-return tuple([row[name] for name in key])
-
-r1d = dict([(makekey(row),i) for i,row in enumerate(r1)])
-r2d = dict([(makekey(row),i) for i,row in enumerate(r2)])
-
-r1keys = set(r1d.keys())
-r2keys = set(r2d.keys())
-
-keys = r1keys & r2keys
-
-r1ind = npy.array([r1d[k] for k in keys])
-r2ind = npy.array([r2d[k] for k in keys])
-
-# Make sure that the output rows have the same relative order as r1
-sortind = r1ind.argsort()
-
-r1 = r1[r1ind[sortind]]
-r2 = r2[r2ind[sortind]]
-
-r2 = rec_drop_fields(r2, r1.dtype.names)
-
-
-def key_desc(name):
-'if name is a string key, use the larger size of r1 or r2 before 
merging'
-dt1 = r1.dtype[name]
-if dt1.type != npy.string_:
-return (name, dt1.descr[0][1])
-
-dt2 = r1.dtype[name]
-assert dt2==dt1
-if dt1.num>dt2.num:
-return (name, dt1.descr[0][1])
-else:
-return (name, dt2.descr[0][1])
-
-
-
-keydesc = [key_desc(name) for name in key]
-
-newdtype = npy.dtype(keydesc +
- [desc for desc in r1.dtype.descr if desc[0] not in 
key ] +
- [desc for desc 

SF.net SVN: matplotlib: [4991] branches/v0_91_maint

2008-02-29 Thread mdboom
Revision: 4991
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4991&view=rev
Author:   mdboom
Date: 2008-02-29 06:04:48 -0800 (Fri, 29 Feb 2008)

Log Message:
---
Fix classic Wx toolbar pan and zoom functions (Thanks Jeff Peery)

Modified Paths:
--
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py

Modified: branches/v0_91_maint/CHANGELOG
===
--- branches/v0_91_maint/CHANGELOG  2008-02-29 13:13:27 UTC (rev 4990)
+++ branches/v0_91_maint/CHANGELOG  2008-02-29 14:04:48 UTC (rev 4991)
@@ -1,3 +1,6 @@
+2008-02-29 Fix class Wx toolbar pan and zoom functions (Thanks Jeff
+   Peery) - MGD
+
 2008-02-16 Added some new rec array functionality to mlab
(rec_summarize, rec2txt and rec_groupby).  See
examples/rec_groupby_demo.py.  Thanks to Tim M for rec2txt.

Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py
===
--- branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py  2008-02-29 
13:13:27 UTC (rev 4990)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_wx.py  2008-02-29 
14:04:48 UTC (rev 4991)
@@ -999,7 +999,7 @@
 
 def print_bmp(self, filename, *args, **kwargs):
 return self._print_image(filename, wx.BITMAP_TYPE_BMP, *args, **kwargs)
-
+
 def print_jpeg(self, filename, *args, **kwargs):
 return self._print_image(filename, wx.BITMAP_TYPE_JPEG, *args, 
**kwargs)
 print_jpg = print_jpeg
@@ -1009,14 +1009,14 @@
 
 def print_png(self, filename, *args, **kwargs):
 return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs)
-
+
 def print_tiff(self, filename, *args, **kwargs):
 return self._print_image(filename, wx.BITMAP_TYPE_TIF, *args, **kwargs)
 print_tif = print_tiff
 
 def print_xpm(self, filename, *args, **kwargs):
 return self._print_image(filename, wx.BITMAP_TYPE_XPM, *args, **kwargs)
-
+
 def _print_image(self, filename, filetype, *args, **kwargs):
 origBitmap   = self.bitmap
 
@@ -1055,7 +1055,7 @@
 
 def get_default_filetype(self):
 return 'png'
-
+
 def realize(self):
 """
 This method will be called when the system is ready to draw,
@@ -1890,28 +1890,28 @@
 
 DEBUG_MSG("panx()", 1, self)
 for a in self._active:
-a.panx(direction)
+a.xaxis.pan(direction)
 self.canvas.draw()
 self.canvas.Refresh(eraseBackground=False)
 
 def pany(self, direction):
 DEBUG_MSG("pany()", 1, self)
 for a in self._active:
-a.pany(direction)
+a.yaxis.pan(direction)
 self.canvas.draw()
 self.canvas.Refresh(eraseBackground=False)
 
 def zoomx(self, in_out):
 DEBUG_MSG("zoomx()", 1, self)
 for a in self._active:
-a.zoomx(in_out)
+a.xaxis.zoom(in_out)
 self.canvas.draw()
 self.canvas.Refresh(eraseBackground=False)
 
 def zoomy(self, in_out):
 DEBUG_MSG("zoomy()", 1, self)
 for a in self._active:
-a.zoomy(in_out)
+a.yaxis.zoom(in_out)
 self.canvas.draw()
 self.canvas.Refresh(eraseBackground=False)
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins