Skip to content

eric-wieser/numpy_ringbuffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numpy_ringbuffer

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=bool)
r.append(True)
r.appendleft(False)
print(np.array(r))  # array([False, True])

About

Ring-buffer implementation that thinly wraps a numpy array

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy