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
File details
Details for the file numpy_array_buffer-0.1.2.tar.gz
.
File metadata
- Download URL: numpy_array_buffer-0.1.2.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bca20a1c3ca32cc8ba5c8b3d741790c3d2029a673082a3559e37174b38a0b7e8 |
|
MD5 | e884ed98a9286179bd3a5b62b8cf0066 |
|
BLAKE2b-256 | 0f9888f65df345b3697d2bd415989fa891caf75b6ff88dccf2ac155631baec31 |
File details
Details for the file numpy_array_buffer-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: numpy_array_buffer-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2061d0007194c95ecd5c6020b07d8ecbc9d267008255b8da36a9d5ec53ed3cc8 |
|
MD5 | 213856d9d5253335e5664907efe7d7ef |
|
BLAKE2b-256 | f2c30347364e4f0fb943a425728b0670a1e6b039b0cea4d3f5b23aec83351ef0 |