[SciPy-dev] Timeseries Unusual Behaviour

David Huard david.huard@gmail....
Fri Oct 31 08:53:50 CDT 2008


On Wed, Oct 29, 2008 at 12:47 PM, Pierre GM <pgmdevlist@gmail.com> wrote:

> David,
> Thanks for reporting. Would you mind sending me a self-contained example ?
> That would really make things easier for debugging/testing.
> Cheers.
> P.
>

Pierre,

here you are:

"""Test for recordarrays ordering at instantiation."""

import numpy as np
import scikits.timeseries as TS
from numpy.testing import *

# Arrays a and b are ordered in descending order, and the dates are in the
# inverse chronological order.
# Once the dates are ordered in chronological order, we expect the arrays a
and
# b to be in ascending order.

a = np.array([4,3,2,1])
b = np.array([14,13,12,11])
date_str = ['2000-01-01 04:00', '2000-01-01 03:00', '2000-01-01 02:00',
'2000-01-01 01:00']
dates = [TS.Date('S', date) for date in date_str]

trec = TS.fromrecords(zip(a,b), dates, names=['a', 'b'])

assert_array_equal(np.diff(trec.dates), 3600)   # dates are in chronological
order
assert_array_equal(np.diff(trec['a']), 1)  # This fails
assert_array_equal(np.diff(trec['b']), 1)  # This fails.




>
>
> On Wednesday 29 October 2008 12:41:08 David Huard wrote:
> > Pierre,
> >
> > A similar problem occurs with fromrecords. Dates are ordered but not
> > the data that is passed.
> >
> >
> > Regards,
> >
> > David
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20081031/0bed2ef4/attachment.html 


More information about the Scipy-dev mailing list