Giter Club home page Giter Club logo

bitstream_python's Introduction

bitstream

At the moment mostly a drop-in replacement for the bitstream library.

The bitstream library was too slow for the purposes I needed it for, this library has better performance. Specifically I wanted to scan along for a given sequence and then start decoding from there. bitstream isn't designed to seek along, constantly saving and restoring state.

Why?

  1. You want a nice interface for dealing with things at the bit level
  2. You need to seek along your data
  3. It needs to be relatively fast

How?

from bitstream_python import BitStream
from numpy import *

stream = BitStream()
stream.write(True, bool)
stream.write(0xFF, uint8)

assert(stream.read(bool, 9) == [True] * 9)

stream.write([1,0,1,0], bool, 4)
stream.write([1,0,1,1], bool, 4)
stream.write(0xCD, uint8)

assert(stream.read(uint16) == 0xABCD)

Write one thing stream.write(value, type)

Read one thing stream.read(type)

Write many things stream.write([value, value, ...], type, length)

Read many things stream.read(type, length)

Dependencies

To run:

  • numpy

To build/install:

  • Cython
  • numpy

To test:

  • Cython
  • numpy
  • py.test
  • hypothesis
  • robber

Installing

  1. Install required dependencies
  2. Run $ python setup.py install

Testing

  1. Install required dependencies
  2. Run $ python setup.py install test

License

Licensed under the MIT License, refer to LICENSE.md for more information.

bitstream_python's People

Contributors

devast8a avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.