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)
Metadata
Release files for numbits 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| numbits-0.0.1.tar.gz | 62.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| numbits-0.0.1-cp39-cp39-macosx_10_9_x86_64.whl | CPython 3.9 | CPython 3.9 | macOS 10.9+ x86-64 | Details |
Total release size: 118.5 kB
Release files / numbits-0.0.1.tar.gz
| Download URL | numbits-0.0.1.tar.gz |
|---|---|
| Size | 62.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be07e05245ced1d8081b60a0bd10dbde2cab50c3b155ed4047c03536b1ee8d00
|
|
BLAKE2b-256 checksum How to use checksums |
963ca80333ba4bbfaeb94cd0fb493879dff9887fcfd93742b86096d6fb389d81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / numbits-0.0.1-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | numbits-0.0.1-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 55.6 kB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
9cb83a61a7e96c54adc7a0dc8ba46085d87ef3718155e9903f9ce571ee52e895
|
|
BLAKE2b-256 checksum How to use checksums |
6283f8a8256ba525b0f88ae312a9c7b3a3763a44c47d593c6deb14aceb3f57c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|