[Scipy-svn] r3174 - trunk/Lib/sandbox/maskedarray

scipy-svn at scipy.org scipy-svn at scipy.org
Wed Jul 18 23:52:16 EDT 2007


Author: pierregm
Date: 2007-07-18 22:52:07 -0500 (Wed, 18 Jul 2007)
New Revision: 3174

Modified:
   trunk/Lib/sandbox/maskedarray/morestats.py
Log:
MA:
morestats      : fixed hdquantiles for empty dataset
TS:
tseries        : fixed compressed w/ 2D series with one date
                 added support for optional arguments/paremeters in convert
mpl_timeseries : added .set_datelimits()

Modified: trunk/Lib/sandbox/maskedarray/morestats.py
===================================================================
--- trunk/Lib/sandbox/maskedarray/morestats.py	2007-07-18 13:12:12 UTC (rev 3173)
+++ trunk/Lib/sandbox/maskedarray/morestats.py	2007-07-19 03:52:07 UTC (rev 3174)
@@ -58,13 +58,15 @@
     """
     def _hd_1D(data,prob,var):
         "Computes the HD quantiles for a 1D array."
-        xsorted = numpy.sort(data.compressed().view(ndarray))
+        xsorted = numpy.squeeze(numpy.sort(data.compressed().view(ndarray)))
         n = len(xsorted)
         #.........
         hd = empty((2,len(prob)), float_)
         if n < 2:
             hd.flat = numpy.nan
-            return hd
+            if var:
+                return hd
+            return hd[0]
         #......... 
         v = arange(n+1) / float(n)
         betacdf = beta.cdf
@@ -87,7 +89,7 @@
     p = numpy.array(prob, copy=False, ndmin=1)
     # Computes quantiles along axis (or globally)
     if (axis is None): 
-        result = _hd_1D(data.compressed(), p, var)
+        result = _hd_1D(data, p, var)
     else:
         assert data.ndim <= 2, "Array should be 2D at most !"
         result = apply_along_axis(_hd_1D, axis, data, p, var)




More information about the Scipy-svn mailing list