Skip to main content

bitsy

This project provides a Python library to access/modify a numpy array bit-wise, like a stream of bits which can be accessed in FIFO manner only.

Getting Started

Prerequisites

The prerequisites are :

  • Python 3 (or more)
  • Numpy

You can download python from here. And to install numpy run the following command in command prompt.

pip intall numpy

Installing

To install the package on your machine use the following command.

pip install bitsy

Examples

To use the library you need to import it. And then you can declare an empty bitstream object or instantiate it with a numpy array.

import numpy 
import bitsy 

The numpy array used must be of dtype = 'uint8'/ 'uint16'/ 'uint32'.

arr = numpy.array([255,5,31], dtype='uint8')

Declare the bit streams.

bs = bitsy.bitstream(arr) #bitstream initialized with arr
bs2 = bitsy.bitstream() #empty bitstream

Print the bit streams.

bs.show()

Output :

0b11111111
0b101
0b11111

Read from bitstream and write in other.

five_bits = bs.read(5)
print(bin(five_bits))
bs2.write(5,five_bits)

Output :

0b11111

Now the bit streams are :

bs.show()
print(" ")
bs2.show()

Output:

0b111
0b101
0b11111

0b11111

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Release files for bitsy 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitsy 0.0.1
File Size Uploaded
bitsy-0.0.1.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bitsy 0.0.1
File Interpreter ABI Platform
bitsy-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / bitsy-0.0.1.tar.gz

Download URL bitsy-0.0.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2bb4ad7b586092c8d3a24febae19570d94477d40badf91ab7bb7ca0b23a69211
BLAKE2b-256 checksum
How to use checksums
96ee04331eb87a21e42a134708773abaf869e7bddab3aeadb6ca77d747f051b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.2

Release files / bitsy-0.0.1-py3-none-any.whl

Download URL bitsy-0.0.1-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ef1dc5eebc0e2b8988bea7dd0b91aaec8b50a820b7b46341c8cd957d5e78a09
BLAKE2b-256 checksum
How to use checksums
51b5506dee9761012c35c88fbb5ad8036ab130e7faf3f37b9b410acef0e456f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page