Chimp time-series floating point compression for Python
Project description
chimp-encoding
Chimp time-series floating point compression for Python.
A Python port of the Chimp algorithm for lossless compression of floating-point time-series data. Supports both 64-bit (double) and 32-bit (float) variants, in base mode and history-based (Chimp128/ChimpN) mode.
Installation
pip install chimp-encoding
Usage
Encoding and decoding 64-bit doubles
from chimp_encoding import ChimpEncoder, ChimpDecoder
# Encode
encoder = ChimpEncoder()
for value in [23.5, 23.6, 23.4, 24.0, 22.9]:
encoder.add_value(value)
encoder.close()
compressed = encoder.get_bytes()
print(f"Compressed to {len(compressed)} bytes")
# Decode
decoder = ChimpDecoder(compressed)
values = decoder.get_values()
print(values) # [23.5, 23.6, 23.4, 24.0, 22.9]
Using Chimp128 (history-based, better compression)
from chimp_encoding import ChimpNEncoder, ChimpNDecoder
encoder = ChimpNEncoder(previous_values=128)
for value in data:
encoder.add_value(value)
encoder.close()
decoder = ChimpNDecoder(encoder.get_bytes(), previous_values=128)
values = decoder.get_values()
32-bit float variants
from chimp_encoding import Chimp32Encoder, Chimp32Decoder
from chimp_encoding import ChimpN32Encoder, ChimpN32Decoder
CLI
# Encode values to hex
chimp encode 23.5 23.6 23.4 24.0 22.9
# Encode to file
chimp encode 23.5 23.6 23.4 -o compressed.bin
# Decode from hex
chimp decode --hex "4037800000000000..."
# Decode from file
chimp decode compressed.bin
# Use different variants
chimp encode --variant chimp128 23.5 23.6 23.4
chimp decode --variant chimp128 --hex "..."
Variants
| Variant | Class | Description |
|---|---|---|
| Chimp | ChimpEncoder / ChimpDecoder |
Base 64-bit, XOR with previous value |
| Chimp32 | Chimp32Encoder / Chimp32Decoder |
Base 32-bit |
| ChimpN | ChimpNEncoder / ChimpNDecoder |
64-bit with N-value history (default N=128) |
| ChimpN32 | ChimpN32Encoder / ChimpN32Decoder |
32-bit with N-value history (default N=64) |
License
MIT
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 chimp_encoding-0.2.0.tar.gz.
File metadata
- Download URL: chimp_encoding-0.2.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96c2d6698bb92d0a1bd80edc8ebec59722af538f31552d1aaf2ec675956b2ccf
|
|
| MD5 |
aa2e33cb62ba3da83b81c041df6eed94
|
|
| BLAKE2b-256 |
ad418d727e1d5408d2957ab5c532dbb8d846201914eb4881aae2687f2c35eebe
|
File details
Details for the file chimp_encoding-0.2.0-py3-none-any.whl.
File metadata
- Download URL: chimp_encoding-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ae9d118a2840d8b9f3244ae44bca82372972883ccd2e6fd2c7649372455c3e1
|
|
| MD5 |
83e0ca8183dae9aa46ea37dd0d79f3dc
|
|
| BLAKE2b-256 |
bc10af4848281b24af1800f71ef6ac1304f4c28c85f7b6d521b739204405ebe0
|