distancematrix.ringbuffer
¶
Module Contents¶
Classes¶
A data structure that represents a sliding window over a data stream. Data can be pushed onto the buffer, |
- class distancematrix.ringbuffer.RingBuffer(data, shape=None, dtype=None, scaling_factor=2.0)¶
Bases:
object
A data structure that represents a sliding window over a data stream. Data can be pushed onto the buffer, thereby discarding the oldest data. The buffer is not resizable.
Data is pushed onto the last dimension (in case of multidimensional data).
Users should always reference the buffer instance, not the buffer view, as the view will be replaced as data is pushed onto the buffer. For user comfort, indexing and slicing on the buffer instance will immediately access the buffer view.
- push(self, data) int ¶
Appends the given data to the buffer, discarding the oldest values. Data is appended to the last dimension of the data window.
- Parameters
data – the data to append, all dimensions except the last should match those of the window
- Returns
The number of data points (per dimension) dropped from the sliding window by this operation