A Python interface for the TRPX compression algorithm
Project description
Pyterse
Python package of next generation TERSE/PROLIX diffraction data compression algorithm
The pyterse python package uses the c++ TERSE/PROLIX(TRPX) compression algorithm scheme (https://github.com/senikm/trpx) and adds python binders to it's main class.
Before you consider pyterse
- Your data is signed or unsigned integral type.
- Your data is grayscale.
- Preferably has high dynamic range.
How to install the package
Create a virtual environment
conda create -n pyterse python pip numpy pillow
Install the package
pip install pyterse
Testing the functionality of the library
Basic commands
- Create terse object:
import pyterse
#Allow for multithreading
pyterse.set_parallelism(1.0) #0 means no parallelism, while 1.0 uses all available cores
# Constructor 1
terse = pyterse.Terse()
pyterse.compress(data, terse)
# Constructor 2
terse = pyterse.Terse(data) #nD NumPy array or slice from an array
# Constructor 3
terse = Terse(data, block_size) #Provide the costum block size: default is 12
- Example:
terse = Terse(data, 12)
- Add additional entry to Terse object:
terse.push_back(data) #The NumPy array or slice from a nD array should correspond to existing set shape (terse.shape).
- Save compressed data to a file:
terse.save('filename.trpx')
- Load compressed data from a file:
loaded_terse = Terse.load('filename.trpx')
- Decompress the data:
decompressed_frame = pyterse.decompress(loaded_terse)
- Decompress a specific entry:
decompressed_frame = pyterse.decompress(loaded_terse.at(0))
# You can check the number of entries by terse.number_of_entries()
- Add and retrieve metadata to the terse object:
terse.set_metadata("Some metadata", frame=0)
metadata = terse.get_metadata(frame=0)
metadata
- Additional functionality:
terse.size() #unique elements in the data
terse.shape #dimension of one frame
terse.number_of_frames()
terse.number_of_bytes()
terse.erase(0)
terse.insert(0, data)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 pyterse-0.1.4-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: pyterse-0.1.4-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 161.6 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
129c941d9699f5d9bb102af90bce57d314b4f997409bba75d8a1084e292ae9bb
|
|
| MD5 |
f77afabc26cea7eb4983f9cb05fefa2a
|
|
| BLAKE2b-256 |
4c5c021382ea7da9601d44efe7b436e7cbfe3389e2a82918201cead0d8158d40
|
File details
Details for the file pyterse-0.1.4-cp311-cp311-win32.whl.
File metadata
- Download URL: pyterse-0.1.4-cp311-cp311-win32.whl
- Upload date:
- Size: 140.1 kB
- Tags: CPython 3.11, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b54a6408fc785a5bc4bf7475ef84b53bc68faf72db630cde9a428b11a997175f
|
|
| MD5 |
766b8501c7f5b69d06f4ad06641a5422
|
|
| BLAKE2b-256 |
aec04fb3e8716303ff661cb11a52c8ab9e92ed60cc853616227b694ce91aa926
|
File details
Details for the file pyterse-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyterse-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 225.5 kB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
235b0b1387588471ad1ede4171135e0190731155f94400fb339fbf77c5f56c09
|
|
| MD5 |
7981de7380551039bc28d71803297e31
|
|
| BLAKE2b-256 |
6422fd0555c2f787ba25c9ec83849be776eabec97e9f85b7394abca927a2bc83
|
File details
Details for the file pyterse-0.1.4-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyterse-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 156.8 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
307e0ae244fe7581c2c1c98a91e8167543883a758908ed1a2005e362e4687e64
|
|
| MD5 |
28252955f0b8bacf2e2cf3b1728ad2b8
|
|
| BLAKE2b-256 |
d054e3865ca6107689a0abdeb99d36784aeee1186fff2ca09ee493d0140289a8
|
File details
Details for the file pyterse-0.1.4-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: pyterse-0.1.4-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 160.4 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
716e02fc7a8505c238d34feaf5296115c62387031bf49cfa5bc9d96e7a989670
|
|
| MD5 |
8e746d310f53abe63cb5a38b84ec77a8
|
|
| BLAKE2b-256 |
5f46526072a0fb841c529637c24895a4bb972d4a45fb92a06347252301a48d3a
|
File details
Details for the file pyterse-0.1.4-cp310-cp310-win32.whl.
File metadata
- Download URL: pyterse-0.1.4-cp310-cp310-win32.whl
- Upload date:
- Size: 139.3 kB
- Tags: CPython 3.10, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37cd194dcb38339ed33fc96cd807ae6f8ed7874983f9717b92c139868b3edaa3
|
|
| MD5 |
186090e40c6489c8179a1fca988330da
|
|
| BLAKE2b-256 |
552f8acc2a437168421635485fbffc41811b1ca8f16efe64b9c5040fc01f75b6
|
File details
Details for the file pyterse-0.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyterse-0.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 223.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e13403fffe088062c089c02b1a7ff729c5573361134ca913f15cf97a7dcbb60a
|
|
| MD5 |
77854fe0de6f7e19236887211f60dcf7
|
|
| BLAKE2b-256 |
48d45dfc3e9b9045eb6f24fe10552afb5732e4a09670049a847f8cb6cf2629bc
|
File details
Details for the file pyterse-0.1.4-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyterse-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 155.1 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70206501acaaf6c276539c40350f4a40b285614ae4b94530219b309f1a6adbb5
|
|
| MD5 |
a3f11551745fc085f2d7e39fa23ad378
|
|
| BLAKE2b-256 |
45bff9187b757710d1c24649bfb21c30556c26baa8b0a5cd84d8a6e73395ad6d
|
File details
Details for the file pyterse-0.1.4-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: pyterse-0.1.4-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 158.9 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb9416aa30934f08152ee3fa4becab3bc05d436b68faca7147b244341e950407
|
|
| MD5 |
1b9a2a26956757f4255480573d7f30ba
|
|
| BLAKE2b-256 |
a108195127b384b52f65b4feec62bf787ea0fa7f0f975ab626faa266c1f7a44b
|
File details
Details for the file pyterse-0.1.4-cp39-cp39-win32.whl.
File metadata
- Download URL: pyterse-0.1.4-cp39-cp39-win32.whl
- Upload date:
- Size: 139.1 kB
- Tags: CPython 3.9, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b43aecfc154666905e8cbe93bcd3e7114be6b4b592a4f5228ffeec36b64c2ce4
|
|
| MD5 |
2d4fcae506499699a2822a3cb8a1c21e
|
|
| BLAKE2b-256 |
d73eb1dd5b5ffcc643fb87d974738c9ef26de1bfbe57aebc648a5d7e4b02fff5
|
File details
Details for the file pyterse-0.1.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyterse-0.1.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 224.2 kB
- Tags: CPython 3.9, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08915762630dfc1d0104f033fda3719a63477a9bba836242c1d3719ca32f6c8f
|
|
| MD5 |
a69edcf719bdd2b60713f567c0a9c047
|
|
| BLAKE2b-256 |
f0eb708a04f696ca28bdfb7cf7cef2deb6fafeda505ae6baf0e45872bc989fb8
|
File details
Details for the file pyterse-0.1.4-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyterse-0.1.4-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 155.2 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1822112ff286fe1d34a9967218c7a6e107178cd95abd1e26c2daac2877f10d3
|
|
| MD5 |
92eb52f4e392d2a804c1ac970a82549b
|
|
| BLAKE2b-256 |
515babf8943f7f671c669ee472825b756f4cf45c5e2aa104b6e1c3a6fdc0ec6e
|