[Scipy-svn] r3510 - trunk/scipy/sandbox/timeseries

scipy-svn@scip... scipy-svn@scip...
Wed Nov 7 21:42:42 CST 2007


Author: mattknox_ca
Date: 2007-11-07 21:42:40 -0600 (Wed, 07 Nov 2007)
New Revision: 3510

Modified:
   trunk/scipy/sandbox/timeseries/tseries.py
Log:
added check for '._series' attribute in __call__ method of _tsmathmethod class to make TimeSeries objects work better with functions that aren't coded with TimeSeries in mind. In particular, this fixes a problem with calling numpy.median on a TimeSeries with an even number of elements.

Modified: trunk/scipy/sandbox/timeseries/tseries.py
===================================================================
--- trunk/scipy/sandbox/timeseries/tseries.py	2007-11-08 03:39:56 UTC (rev 3509)
+++ trunk/scipy/sandbox/timeseries/tseries.py	2007-11-08 03:42:40 UTC (rev 3510)
@@ -268,7 +268,11 @@
             result = func(other, *args).view(type(instance))
             result._dates = instance._dates
         else:
-            result = func(other, *args)._series
+            _result = func(other, *args)
+            if hasattr(_result, '_series'):
+                result = _result._series
+            else:
+                result = _result
         return result
 
 class _tsarraymethod(object):



More information about the Scipy-svn mailing list