Pack and unpack 1, 2 and 4 bit data to/from 8-bit numpy arrays.
Project description
numbits
Pack and unpack 1, 2 and 4 bit data to/from 8-bit numpy arrays
Motivated by radio astronomy, where low bitwidths are common.
Project built with pybind11. Pack/unpack code based on sigpyproc.
Installation
On Unix (Linux, OS X)
You can either:
-
Install numbits from PyPI with:
pip install numbits
or you can:
-
Clone this repository. and then:
-
Build shared object .so locally, using:
python setup.py build_ext -i
-
Or install the package globally, using:
python -m pip install .
or:
python setup.py install
-
Test call
import numpy as np
import numbits
a = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8], dtype='uint8')
b = numbits.unpack(a, nbits=2)
>>> array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0,
1, 1, 0, 0, 1, 2, 0, 0, 1, 3, 0, 0, 2, 0], dtype=uint8)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file numbits-0.0.1.tar.gz.
File metadata
- Download URL: numbits-0.0.1.tar.gz
- Upload date:
- Size: 62.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be07e05245ced1d8081b60a0bd10dbde2cab50c3b155ed4047c03536b1ee8d00
|
|
| MD5 |
4a49c08d2b4e274826dce0bd75dd57ab
|
|
| BLAKE2b-256 |
963ca80333ba4bbfaeb94cd0fb493879dff9887fcfd93742b86096d6fb389d81
|
File details
Details for the file numbits-0.0.1-cp39-cp39-macosx_10_9_x86_64.whl.
File metadata
- Download URL: numbits-0.0.1-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 55.6 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cb83a61a7e96c54adc7a0dc8ba46085d87ef3718155e9903f9ce571ee52e895
|
|
| MD5 |
8db01a14f6984e35ba187877e3bd3060
|
|
| BLAKE2b-256 |
6283f8a8256ba525b0f88ae312a9c7b3a3763a44c47d593c6deb14aceb3f57c2
|