[SciPy-user] incompatible sizes when correlating two timeseries
Thu Dec 18 12:33:32 CST 2008
Timmie <timmichelsen <at> gmx-topmail.de> writes:
> 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.
Pierre, I think we should probably up-cast the TimeSeries to a plain MaskedArray
when _update_from is called with dates of a different size than the data. I'm
sure other functions in numpy crash on TimeSeries objects for the same reason.
What do you think?
More information about the SciPy-user