[Scipy-svn] r2997 - trunk/Lib/sandbox/timeseries

scipy-svn at scipy.org scipy-svn at scipy.org
Mon May 14 16:35:47 EDT 2007


Author: mattknox_ca
Date: 2007-05-14 15:35:36 -0500 (Mon, 14 May 2007)
New Revision: 2997

Modified:
   trunk/Lib/sandbox/timeseries/tdates.py
   trunk/Lib/sandbox/timeseries/tseries.py
Log:
eliminated "include_last" paramter from various functions

Modified: trunk/Lib/sandbox/timeseries/tdates.py
===================================================================
--- trunk/Lib/sandbox/timeseries/tdates.py	2007-05-14 13:57:50 UTC (rev 2996)
+++ trunk/Lib/sandbox/timeseries/tdates.py	2007-05-14 20:35:36 UTC (rev 2997)
@@ -541,7 +541,7 @@
 
 
 def date_array(dlist=None, start_date=None, end_date=None, length=None,
-               include_last=True, freq=None):
+               freq=None):
     """Constructs a DateArray from:
     - a starting date and either an ending date or a given length.
     - a list of dates.
@@ -583,9 +583,7 @@
     else:
         if not isDate(end_date):
             raise DateError, "Ending date should be a valid Date instance!"
-        length = int(end_date - start_date)
-        if include_last:
-            length += 1
+        length = int(end_date - start_date) + 1
 #    dlist = [(start_date+i).value for i in range(length)]
     dlist = numeric.arange(length, dtype=int_)
     dlist += start_date.value
@@ -599,11 +597,11 @@
     return date_array(dlist=dlist, freq=freq)
 
 def date_array_fromrange(start_date, end_date=None, length=None,
-                         include_last=True, freq=None):
+                         freq=None):
     """Constructs a DateArray from a starting date and either an ending date or
     a length."""
     return date_array(start_date=start_date, end_date=end_date,
-                      length=length, include_last=include_last, freq=freq)
+                      length=length, freq=freq)
 
 #####---------------------------------------------------------------------------
 #---- --- Definition of functions from the corresponding methods ---

Modified: trunk/Lib/sandbox/timeseries/tseries.py
===================================================================
--- trunk/Lib/sandbox/timeseries/tseries.py	2007-05-14 13:57:50 UTC (rev 2996)
+++ trunk/Lib/sandbox/timeseries/tseries.py	2007-05-14 20:35:36 UTC (rev 2997)
@@ -951,7 +951,7 @@
 #---- --- TimeSeries creator ---
 ##### -------------------------------------------------------------------------
 def time_series(data, dates=None, freq=None, observed=None,
-                start_date=None, end_date=None, length=None, include_last=True,
+                start_date=None, end_date=None, length=None,
                 mask=nomask,
                 dtype=None, copy=False, fill_value=None,
                 keep_mask=True, small_mask=True, hard_mask=False):
@@ -971,8 +971,7 @@
                 length = dshape[0]
         if len(dshape) > 0:
             dates = date_array(start_date=start_date, end_date=end_date,
-                               length=length, include_last=include_last,
-                               freq=freq)
+                               length=length, freq=freq)
         else:
             dates = date_array([], freq=freq)
     elif not isinstance(dates, DateArray):
@@ -1435,7 +1434,7 @@
         return time_series(data, dflat)
     # ...and now, fill it ! ......
     (tstart, tend) = dflat[[0,-1]]
-    newdates = date_array(start_date=tstart, end_date=tend, include_last=True)
+    newdates = date_array(start_date=tstart, end_date=tend)
     nsize = newdates.size
     #.............................
     # Get the steps between consecutive data.




More information about the Scipy-svn mailing list