Revision: 7790
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7790&view=rev
Author:   efiring
Date:     2009-09-19 06:28:43 +0000 (Sat, 19 Sep 2009)

Log Message:
-----------
Fix bug in mlab.demean, with axis = -1

Modified Paths:
--------------
    branches/v0_99_maint/lib/matplotlib/mlab.py

Modified: branches/v0_99_maint/lib/matplotlib/mlab.py
===================================================================
--- branches/v0_99_maint/lib/matplotlib/mlab.py 2009-09-19 03:05:24 UTC (rev 
7789)
+++ branches/v0_99_maint/lib/matplotlib/mlab.py 2009-09-19 06:28:43 UTC (rev 
7790)
@@ -173,11 +173,11 @@
 def demean(x, axis=0):
     "Return x minus its mean along the specified axis"
     x = np.asarray(x)
-    if axis:
-        ind = [slice(None)] * axis
-        ind.append(np.newaxis)
-        return x - x.mean(axis)[ind]
-    return x - x.mean(axis)
+    if axis == 0 or axis is None or x.ndim <= 1:
+        return x - x.mean(axis)
+    ind = [slice(None)] * x.ndim
+    ind[axis] = np.newaxis
+    return x - x.mean(axis)[ind]
 
 def detrend_mean(x):
     "Return x minus the mean(x)"


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to