Skip to main content

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyterse-0.1.4-cp311-cp311-win_amd64.whl (161.6 kB view details)

Uploaded CPython 3.11Windows x86-64

pyterse-0.1.4-cp311-cp311-win32.whl (140.1 kB view details)

Uploaded CPython 3.11Windows x86

pyterse-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (225.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyterse-0.1.4-cp311-cp311-macosx_11_0_arm64.whl (156.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyterse-0.1.4-cp310-cp310-win_amd64.whl (160.4 kB view details)

Uploaded CPython 3.10Windows x86-64

pyterse-0.1.4-cp310-cp310-win32.whl (139.3 kB view details)

Uploaded CPython 3.10Windows x86

pyterse-0.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (223.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyterse-0.1.4-cp310-cp310-macosx_11_0_arm64.whl (155.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyterse-0.1.4-cp39-cp39-win_amd64.whl (158.9 kB view details)

Uploaded CPython 3.9Windows x86-64

pyterse-0.1.4-cp39-cp39-win32.whl (139.1 kB view details)

Uploaded CPython 3.9Windows x86

pyterse-0.1.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (224.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyterse-0.1.4-cp39-cp39-macosx_11_0_arm64.whl (155.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

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

Hashes for pyterse-0.1.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 129c941d9699f5d9bb102af90bce57d314b4f997409bba75d8a1084e292ae9bb
MD5 f77afabc26cea7eb4983f9cb05fefa2a
BLAKE2b-256 4c5c021382ea7da9601d44efe7b436e7cbfe3389e2a82918201cead0d8158d40

See more details on using hashes here.

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

Hashes for pyterse-0.1.4-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 b54a6408fc785a5bc4bf7475ef84b53bc68faf72db630cde9a428b11a997175f
MD5 766b8501c7f5b69d06f4ad06641a5422
BLAKE2b-256 aec04fb3e8716303ff661cb11a52c8ab9e92ed60cc853616227b694ce91aa926

See more details on using hashes here.

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

File hashes

Hashes for pyterse-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 235b0b1387588471ad1ede4171135e0190731155f94400fb339fbf77c5f56c09
MD5 7981de7380551039bc28d71803297e31
BLAKE2b-256 6422fd0555c2f787ba25c9ec83849be776eabec97e9f85b7394abca927a2bc83

See more details on using hashes here.

File details

Details for the file pyterse-0.1.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyterse-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 307e0ae244fe7581c2c1c98a91e8167543883a758908ed1a2005e362e4687e64
MD5 28252955f0b8bacf2e2cf3b1728ad2b8
BLAKE2b-256 d054e3865ca6107689a0abdeb99d36784aeee1186fff2ca09ee493d0140289a8

See more details on using hashes here.

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

Hashes for pyterse-0.1.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 716e02fc7a8505c238d34feaf5296115c62387031bf49cfa5bc9d96e7a989670
MD5 8e746d310f53abe63cb5a38b84ec77a8
BLAKE2b-256 5f46526072a0fb841c529637c24895a4bb972d4a45fb92a06347252301a48d3a

See more details on using hashes here.

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

Hashes for pyterse-0.1.4-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 37cd194dcb38339ed33fc96cd807ae6f8ed7874983f9717b92c139868b3edaa3
MD5 186090e40c6489c8179a1fca988330da
BLAKE2b-256 552f8acc2a437168421635485fbffc41811b1ca8f16efe64b9c5040fc01f75b6

See more details on using hashes here.

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

File hashes

Hashes for pyterse-0.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e13403fffe088062c089c02b1a7ff729c5573361134ca913f15cf97a7dcbb60a
MD5 77854fe0de6f7e19236887211f60dcf7
BLAKE2b-256 48d45dfc3e9b9045eb6f24fe10552afb5732e4a09670049a847f8cb6cf2629bc

See more details on using hashes here.

File details

Details for the file pyterse-0.1.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyterse-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70206501acaaf6c276539c40350f4a40b285614ae4b94530219b309f1a6adbb5
MD5 a3f11551745fc085f2d7e39fa23ad378
BLAKE2b-256 45bff9187b757710d1c24649bfb21c30556c26baa8b0a5cd84d8a6e73395ad6d

See more details on using hashes here.

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

Hashes for pyterse-0.1.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fb9416aa30934f08152ee3fa4becab3bc05d436b68faca7147b244341e950407
MD5 1b9a2a26956757f4255480573d7f30ba
BLAKE2b-256 a108195127b384b52f65b4feec62bf787ea0fa7f0f975ab626faa266c1f7a44b

See more details on using hashes here.

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

Hashes for pyterse-0.1.4-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 b43aecfc154666905e8cbe93bcd3e7114be6b4b592a4f5228ffeec36b64c2ce4
MD5 2d4fcae506499699a2822a3cb8a1c21e
BLAKE2b-256 d73eb1dd5b5ffcc643fb87d974738c9ef26de1bfbe57aebc648a5d7e4b02fff5

See more details on using hashes here.

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

File hashes

Hashes for pyterse-0.1.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 08915762630dfc1d0104f033fda3719a63477a9bba836242c1d3719ca32f6c8f
MD5 a69edcf719bdd2b60713f567c0a9c047
BLAKE2b-256 f0eb708a04f696ca28bdfb7cf7cef2deb6fafeda505ae6baf0e45872bc989fb8

See more details on using hashes here.

File details

Details for the file pyterse-0.1.4-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyterse-0.1.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f1822112ff286fe1d34a9967218c7a6e107178cd95abd1e26c2daac2877f10d3
MD5 92eb52f4e392d2a804c1ac970a82549b
BLAKE2b-256 515babf8943f7f671c669ee472825b756f4cf45c5e2aa104b6e1c3a6fdc0ec6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page