[Numpy-discussion] Overlapping time series
RayS
rays at blue-cove.com
Tue Feb 11 08:57:25 EST 2014
> > On 11.02.2014 14:08, Daniele Nicolodi wrote:
> >> Hello,
> >>
> >> I have two time series (2xN dimensional arrays) recorded on the same
> >> time basis, but each with it's own dead times (and start and end
> >> recording times). I would like to obtain two time series containing
> >> only the time overlapping segments of the data.
> >>
> >> Does numpy or scipy offer something that may help in this?
> >>
> >> I can imagine strategies about how to approach the problem, but none
> >> that would be efficient. Ideas?
What is the gate/tach, ie pointer to start/stop?
I work with both tachometers and EKGs and do similar windowing,
usually just using gates as slices so as not to make copies.
I also found this interesting and bookmarked it
http://www.johnvinyard.com/blog/?p=268 which you might like.
Just to be clear, you have 2 2D arrays and want a 4x(N-m) shape, like
mixing two stereo tracks?
>>> a1 = np.arange(0,20).reshape((2,-1))
>>> a2 = np.arange(5,25).reshape((2,-1))
>>> np.concatenate((a1,a2))
array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
[ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
[15, 16, 17, 18, 19, 20, 21, 22, 23, 24]])
>>> st1 = 2
>>> end1 = 7
>>> st2 = 1
>>> end2 = 6
>>> np.concatenate((a1[:,st1:end1],a2[:,st2:end2]))
array([[ 2, 3, 4, 5, 6],
[12, 13, 14, 15, 16],
[ 6, 7, 8, 9, 10],
[16, 17, 18, 19, 20]])
- Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140211/15e17d40/attachment.html>
More information about the NumPy-Discussion
mailing list