This is a Python wrapper for the NDI Compression tools.
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate -
Install requirements:
pip install -r requirements.txt
This package requires the NDI compression C executables to be present.
By default, it looks for them in ../../C/bin relative to the ndi_compress package file.
You can override this by setting the NDI_BIN_PATH environment variable.
import ndi_compress
import numpy as np
# Create some data
data = np.random.randint(0, 2, size=(100, 10)).astype(np.uint8)
# Compress
ndi_compress.compress_digital(data, "my_data")
# Expand
data_out, ratio, output_files = ndi_compress.expand_digital("my_data.nbf.tgz")