Skip to main content

Ring buffer implementation for numpy

Project description

Build Status codecov

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

numpy_ringbuffer-0.2.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

numpy_ringbuffer-0.2.1-py2.py3-none-any.whl (3.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file numpy_ringbuffer-0.2.1.tar.gz.

File metadata

File hashes

Hashes for numpy_ringbuffer-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ac79c60b6d92a688ad152a11d351d9efc2e0749973f71e18a8c9b3b1241a3cef
MD5 541f4263dd6194ff6a8ab26a92386f52
BLAKE2b-256 938e01693737a7a1b955137b8e45e40fedf155f031f5f824220a6a6ce887baea

See more details on using hashes here.

File details

Details for the file numpy_ringbuffer-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for numpy_ringbuffer-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cf92824565258b9d59a6fd39a7b50af08f0733f0b15c819e82eafdf28989b1d6
MD5 16ccfc13e521fcac78ab4552ec75d9f5
BLAKE2b-256 efa03f601e7a6c0a8732feca053cf0a756579e7cd2ae362f8497285d6dc1914c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page