[SciPy-user] time series analysis

Matt Knox mattknox_ca@hotmail....
Tue Nov 6 05:38:17 CST 2007


> Some things I can imagine are the following:
> create a tools directory under the timeseries tree.

There is a "lib" sub-directory for stuff that falls outside the core 
Date/TimeSeries classes. It currently includes a sub-module for "moving 
functions" (moving average, etc...), and interpolation.

> * common frequency conversions: reduce to hourly values

Frequency conversions are simple to do using the "convert" method of the 
TimeSeries class. Here is an example converting an hourly frequency series to 
daily...

>>> import numpy as np
>>> import maskedarray as ma
>>> import timeseries as ts
>>> h = ts.time_series(np.arange(50, dtype=np.float32), start_date=ts.today
('hourly'))
>>> h
timeseries([  0.   1.   2.   3.   4.   5.   6.   7.   8.   9.  10.  11.  12.  
13.  14.
  15.  16.  17.  18.  19.  20.  21.  22.  23.  24.  25.  26.  27.  28.  29.
  30.  31.  32.  33.  34.  35.  36.  37.  38.  39.  40.  41.  42.  43.  44.
  45.  46.  47.  48.  49.],
           dates = [06-Nov-2007 06:00 ... 08-Nov-2007 07:00],
           freq  = H)

>>> d = h.convert('daily')
>>> d
timeseries(
 [[-- -- -- -- -- -- 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0
  13.0 14.0 15.0 16.0 17.0]
 [18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 31.0
  32.0 33.0 34.0 35.0 36.0 37.0 38.0 39.0 40.0 41.0]
 [42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 -- -- -- -- -- -- -- -- -- -- --
  -- -- -- -- --]],
           dates =
 [06-Nov-2007 ... 08-Nov-2007],
           freq  = D)

>>> d_avg = h.convert('daily', ma.average)
>>> d_avg
timeseries([  8.5  29.5  45.5],
           dates = [06-Nov-2007 ... 08-Nov-2007],
           freq  = D)

===============================================
If any of the above seems mysterious, let me know and I can offer a more 
detailed explanation.

> * error checking of measurement data: statistically and logically

Some data error checking algorithms could be useful, yes. I won't likely be 
working on them in the near future though.

> Is it safe for me to replace/patch my current maskarray?

Generally speaking, the maskedarray package is mostly backwards compatible 
with the current numpy.ma package , and thus the api is very stable so you 
should be able to update it without any problems.

> I have experience in compiling on linux but have
> to work on a windows box.
> Therefore an advice on that would be useful.

If you are using Python 2.5 on windows, it is easy to do using mingw. If you 
are using an earlier version of Python, Visual studio 2003 is the easiest way 
to go.

> Is there a possibility to subscibe to SVN to get an email on chnages?

I don't know of any svn clients that have a built in way to do this, but it 
likely wouldn't be difficult to write your own script to do this since 
subversion has a command line interface.

- Matt



More information about the SciPy-user mailing list