[SciPy-user] incompatible sizes when correlating two timeseries

Timmie timmichelsen at gmx-topmail.de
Thu Dec 18 10:29:23 EST 2008


Hello,
I try to correlate two timeseries.

I don not understand, why I get an error for incompatile size.

both have the same frequencies.


In [54]: x = series_01

In [55]: y = series_02

In [56]: diff = y.size-x.size

In [57]: diff
Out[57]: 0

In [58]: x.shape
Out[58]: (15360,)

In [59]: y.shape
Out[59]: (15360,)

In [60]: np.correlate(x, y)
---------------------------------------------------------------------------
TimeSeriesCompatibilityError              Traceback (most recent call last)

D:\python\test.py
in <module>()
----> 1
      2
      3
      4
      5

C:\Programme\pythonxy\python\lib\site-packages\numpy\core\numeric.pyc in
correlate(a, v, mode)
    513     """
    514     mode = _mode_from_name(mode)
--> 515     return multiarray.correlate(a,v,mode)
    516
    517

C:\Programme\pythonxy\python\lib\site-packages\scikits\timeseries\tseries.pyc in
__array_finalize__(self, obj)
    459     def __array_finalize__(self,obj):
    460         self._varshape = getattr(obj, '_varshape', ())
--> 461         MaskedArray.__array_finalize__(self, obj)
    462
    463     def _update_from(self, obj):

C:\Programme\pythonxy\python\lib\site-packages\numpy\ma\core.pyc in
__array_finalize__(self, obj)
   1383         """
   1384         # Get main attributes .........
-> 1385         self._update_from(obj)
   1386         if isinstance(obj, ndarray):
   1387             odtype = obj.dtype

C:\Programme\pythonxy\python\lib\site-packages\scikits\timeseries\tseries.pyc in
_update_from(self, obj)
    466         # Only update the dates if we don't have any
    467         if not getattr(_dates, 'size', 0):
--> 468             self.__setdates__(newdates)
    469         MaskedArray._update_from(self, obj)
    470

C:\Programme\pythonxy\python\lib\site-packages\scikits\timeseries\tseries.pyc in
__setdates__(self, value)
    662         if not varshape:
    663             # We may be using the default: retry
--> 664             varshape = self._varshape = get_varshape(self, value)
    665         # Get the data length (independently of the nb of variables)
    666         dsize = self.size // int(np.prod(varshape))

C:\Programme\pythonxy\python\lib\site-packages\scikits\timeseries\tseries.pyc in
get_varshape(data, dates)
    260     # More dates than data: not good
    261     if (dates.size > data.size) or (data.ndim == 1):
--> 262         raise TimeSeriesCompatibilityError(*err_args)
    263     #....................
    264     dcumulshape = np.cumprod(dshape).tolist()

TimeSeriesCompatibilityError: Incompatible sizes! (data: (1,) <> dates: (15360,))

Please give me a hint here.


Timmie






More information about the SciPy-User mailing list