[SciPy-user] incompatible sizes when correlating two timeseries

josef.pktd at gmail.com josef.pktd at gmail.com
Thu Dec 18 15:04:10 EST 2008


On Thu, Dec 18, 2008 at 1:33 PM, Matt Knox <mattknox.ca at gmail.com> wrote:
> Timmie <timmichelsen <at> gmx-topmail.de> writes:
>
>>
>> Hello,
>> I try to correlate two timeseries.
>>
>> I don not understand, why I get an error for incompatile size.
>
> I would say this is a bug. Although I am not 100% certain the cause of it at the
> moment. I think it happens when the correlate function tries to create a new
> TimeSeries to store the result in and somehow the dates of the input TimeSeries
> get passed along to create the resulting TimeSeries (which will be of size 1).
>
> A simple work around for now is to just call np.correlate on the underlying raw
> array (using the .data attribute of the TimeSeries). Note that np.correlate will
> NOT work properly with MaskedArray's that contain masked value. In general you
> should assume functions from the top level numpy namespace will not work
> properly with masked values.

Tim, if you need them, there are some statistical functions that work
for masked arrays in scipy.stats.mstats. They are not yet included in
the new docs. But you can see what is available with

import scipy.stats
dir(scipy.stats.mstats)

I don't know how well they work with TimeSeries.

Josef



More information about the SciPy-User mailing list