Ring buffer implementation for numpy
Project description
numpy_ringbuffer
Ring (aka circular) buffers backed by a numpy array, supporting:
- Operations from
collections.deque
b.append(val)
b.appendleft(val)
b.extend(val)
b.extendleft(val)
b.pop(val)
b.popleft(val)
- The
collections.Sequence
protocol (unoptimized) - C-side unwrapping into an array with
np.array(b)
- Arbitrary element dtypes, including extra dimensions like
RingBuffer(N, dtype=(int, 3))
For example:
import numpy as np
from numpy_ringbuffer import RingBuffer
r = RingBuffer(capacity=4, dtype=np.bool)
r.append(True)
r.appendleft(False)
print(np.array(r)) # array([False, True])
Project details
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_ringbuffer-0.2.2.tar.gz
.
File metadata
- Download URL: numpy_ringbuffer-0.2.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b55e1ff473e3d8807067a3ea42b8d6957f6b6239fc0516527252280edb18fa6 |
|
MD5 | 533a8b79130757d8d6a92978ec81a09f |
|
BLAKE2b-256 | 3a0b08bc9f01677daa58059325e6a1efb18e79c93fbe5d3ffe910349bfbbdea0 |
File details
Details for the file numpy_ringbuffer-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: numpy_ringbuffer-0.2.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8393d82d0a75b4fce2890674a278c28289bc9e10fe0428c24bc1e1176cfe18d7 |
|
MD5 | eb8ed21405bbc594978afeffca05bf82 |
|
BLAKE2b-256 | 39fd78135ec3fd81fe9ebb44bfc5ae92c2120729008c96fd2be6c2af0dca8126 |