Bioleptic
Fast, lossy wavelet compression for physiological signals — ECG, PPG, and accelerometry — with Rust, Python, and JavaScript/WebAssembly bindings.
Bioleptic is a biosignal compression library that shrinks physiological time-series data — electrocardiogram (ECG), photoplethysmogram (PPG), and accelerometer streams — at high compression ratios with low reconstruction error (PRD). It combines a multi-level discrete wavelet transform (DWT) with scalar quantization and adaptive entropy coding, and runs natively in Rust or from Python (NumPy) and the browser (WebAssembly). That makes it a good fit for wearables, remote patient monitoring, medical-device storage, and large physiological datasets where bandwidth and disk are tight.
Features
- Wavelet-based — CDF 9/7, CDF 5/3, Daubechies-4, and Symlet-4 transforms
- Tunable rate–distortion — pick a quantization scale (or an explicit multiplier) to trade size against fidelity for a target PRD
- Multiple entropy coders — Deflate, an adaptive binary rANS, and a significance-map coefficient model
- Float32 and Float64 input — f64 is downcast to f32 internally
- Cross-platform — one core, with Rust, Python/NumPy, and JavaScript/WASM frontends
- Lightweight & dependency-light — small footprint, suitable for embedded and edge use
Algorithm
- Non-finite substitution (
NaN→ 0,±inf→ 0/1) - Mean-centering + range normalization
- Multi-level DWT (CDF 9/7, CDF 5/3, Daubechies-4, or Symlet-4; depth scales with signal length)
- Quantization to
i16with a configurable scale - Detail-coefficient thresholding
- Entropy coding (Deflate, adaptive rANS, or a significance-map coefficient model)
Installation & Usage
Rust
let compressed = compress?;
let recovered = decompress?;
Python
=
=
JavaScript
import from "bioleptic-js";
const signal = ;
const options = ;
const compressed = ; // Uint8Array
const recovered = ; // Float32Array
console.info;
License
This project is licensed under either of
at your option.