• Stars
    star
    7
  • Rank 2,294,772 (Top 46 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created about 9 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Python NumPy implementation of ring buffer (aka circular buffer)

Build Status

Numpy Buffer

A Python NumPy implementation of buffer.

Install

$ pip install git+https://github.com/scls19fr/numpy-buffer/

Ring Buffer

Description

See description of a ring buffer (or circular buffer).

Usage

In [1]: from numpy_buffer import RingBuffer

In [2]: N = 10

In [3]: ring = RingBuffer(size_max=10, default_value=0.0, dtype=float)

In [4]: ring
Out[4]:
<RingBuffer
    all:     array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])
    partial: array([], dtype=float64)
    size/size_max: 0 / 10
>

In [5]: ring.append(1.2)

In [6]: ring
Out[6]:
<RingBuffer
    all:     array([ 1.2 ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0.])
    partial: array([ 1.2])
    size/size_max: 1 / 10
>

In [7]: ring.append(2.1)

In [8]: ring
Out[8]:
<RingBuffer
    all:     array([ 2.1 ,  1.2 ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0.,  0.])
    partial: array([ 2.1 ,  1.2])
    size/size_max: 2 / 10
>

In [9]: ring.all
Out[9]: array([ 2.1,  1.2,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ,  0. ])

In [10]: ring.partial
Out[10]: array([ 2.1,  1.2])

In [11]: ring.partial[::-1]
Out[11]: array([ 1.2,  2.1])

Development

You can help to develop this library.

Issues

You can submit issues using https://github.com/scls19fr/numpy-buffer/issues

Clone

You can clone repository to try to fix issues yourself using:

$ git clone https://github.com/scls19fr/numpy-buffer

Run unit tests

Run all unit tests

$ nosetests -s -v

Run a given test

$ nosetests tests/test_ring.py:test_ring -s -v

Install development version

$ python setup.py install

or

$ sudo pip install git+https://github.com/scls19fr/numpy-buffer

Collaborating

  • Fork repository
  • Create a branch which fix a given issue
  • Submit pull requests

https://help.github.com/categories/collaborating/

Examples

see samples directory

http://img.youtube.com/vi/MjuWUF0ibYk/0.jpg

More Repositories

1

pyade

Unofficial Python library to use ADE Web API for ADE Planning from Adesoft
Python
14
star
2

pandas_degreedays

A Python package to calculate degree days (DD or in french DJU - degré jour unifié) from measured outdoor temperatures and to make it possible to quantify drift of energy consumption for heating (or cooling)
Python
12
star
3

pandas-helper-calc

Helper methods for Pandas Series and DataFrames to calculate numerically derivative and integral
Python
9
star
4

ExtensibleScheduler.jl

An advanced and extensible Julia events scheduler. https://scls19fr.github.io/ExtensibleScheduler.jl/dev/
Julia
8
star
5

python-lms-tools

Python library to manage quiz format(s) used by differents Learning management system (LMS) especially Moodle (currently only Aiken format is supported)
Python
6
star
6

openweathermap_requests

Python package to fetch data from OpenWeatherMap.org with requests and requests-cache
Python
5
star
7

pycondor

Python script to manage Condor Soaring files such as tasks (flight plans)
Python
5
star
8

GPX.jl

A Julia GPX parser (ie reader) and creator (ie writer). GPX (GPS eXchange Format) is an XML based file format for GPS tracks.
Julia
5
star
9

Pushover.jl

A simple Pushover client for Julia https://scls19fr.github.io/Pushover.jl/dev
Julia
4
star
10

Sched.jl

A Julia event scheduler inspired by Python sched. https://scls19fr.github.io/Sched.jl/dev/
Julia
4
star
11

pandas-anonymizer

Some functions to anonymize data with Python Pandas
Python
4
star
12

wnb

Weight and balance progressive web application for light aircrafts (SEP, gliders...)
TypeScript
2
star
13

morse-listen

[WIP] Decoding morse code using Python, Machine Learning...
Python
2
star
14

arduino_libraries_search

Python Pandas script to search for Arduino libraries matching some keywords and to output to Excel file
Python
2
star
15

KMLTracks.jl

A Julia library to parse KML files or strings (ie read them) with gx:Track extension
Julia
2
star
16

simulator_keypad

C++
1
star
17

CakeLocale

Project containing a translation effort for the CakePHP core
1
star
18

python-airac

Python library to deal with AIRAC cycle dates
Python
1
star
19

AIRAC.jl

Julia library to deal with AIRAC cycle dates
Julia
1
star
20

openphysic

PHP
1
star
21

polaires_excel

Fichier Excel polaire des vitesses (planeur)
1
star
22

email-verif

A Python email validator. Verify if an email address is valid and really exists.
Python
1
star
23

tkinter_matplotlib_sample

A Python Tkinter example with Matplotlib integration
Python
1
star
24

JuliaVagrant

A Vagrant environment for Julia development (Linux Ubuntu host)
1
star
25

BulkSMS.jl

A Julia package to send SMS (Short Message Service) using BulkSMS API https://scls19fr.github.io/BulkSMS.jl/dev
Julia
1
star
26

web_scraping_sia_python

Unofficial Python library to scrape SIA (Service de l'information aéronautique) website
Python
1
star
27

sia_lua

Unofficial Lua library to download VAC from SIA (Service de l'information aéronautique) website
Lua
1
star
28

Nextion.jl

An unofficial Julia library to communicate with Itead Nextion display
Julia
1
star