def update(self, x):
"""Update the buffer.
Args:
x (numpy.ndarray): array of shape
(n_new_samples, n_channels(, n_points))
"""
if x.ndim != self.buffer.ndim:
raise ValueError('x has not the same number of dimensions as '
'the buffer.')
nw = x.shape[0]
# Determine index at which new values should be put into array
ind = np.arange(self.ind, self.ind + nw, dtype=np.int16) % self.n
self.buffer[ind, :] = x
# Set self.ind = to the index at which new locations were put.
# Separately defined here to allow new data to be an array rather
# than just one row
self.ind = (ind[-1] + 1) % self.n
self.pts += nw
评论列表
文章目录