Ringbuffer and downsampling buffer with numpy array backend
Project description
numpy_array_buffer
Library for buffers used in real-time computation:
- RingBuffer: when full overwrites oldest row
- DownsamplingBuffer: when full downsamples full buffer
Example
ring_buffer = RingBuffer(3,2, column_names=["x", "y"])
for i in range(6):
ring_buffer.append([i, i + 10])
print(f"{i=}, y: {ring_buffer.get_col('x')}")
output:
i=0, y: [0.]
i=1, y: [0. 1.]
i=2, y: [0. 1. 2.]
i=3, y: [1. 2. 3.]
i=4, y: [2. 3. 4.]
i=5, y: [3. 4. 5.]
Downsampled array
downsampling_buffer = DownsamplingBuffer(4, 2)
for i in range(9):
data_object = [i, i + 10]
downsampling_buffer.append(data_object)
print(f"{i=}, Arr: {downsampling_buffer.get_array()[:,0]}")
output:
i=0, Arr: [0.]
i=1, Arr: [0. 1.]
i=2, Arr: [0. 1. 2.]
i=3, Arr: [0. 2.]
i=4, Arr: [0. 2. 4.]
i=5, Arr: [0. 4.]
i=6, Arr: [0. 4.]
i=7, Arr: [0. 4.]
i=8, Arr: [0. 4. 8.]
Similar packages:
Look at if functionality is the same, or compare benchmark:
- https://github.com/eric-wieser/numpy_ringbuffer/blob/master/numpy_ringbuffer/__init__.py
- https://stackoverflow.com/questions/8908998/ring-buffer-with-numpy-ctypes
Develop:
pip install -e .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for numpy_array_buffer-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2061d0007194c95ecd5c6020b07d8ecbc9d267008255b8da36a9d5ec53ed3cc8 |
|
MD5 | 213856d9d5253335e5664907efe7d7ef |
|
BLAKE2b-256 | f2c30347364e4f0fb943a425728b0670a1e6b039b0cea4d3f5b23aec83351ef0 |