Skip to main content

A Python interface for the TRPX compression algorithm

Project description

Pyterse

Python package of TERSE/PROLIX diffraction and cryo-EM 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:
from pyterse import Terse

# Constructor 1
terse = Terse() 

# Constuctor 2
 terse = Terse(data) #nD NumPy array or slice from an array

 # Constuctor 3
 terse = Terse(data,  data.size, block_size) #Provide the frame size and the costum block size: default is 12
 - Example:
terse = Terse(data,  512* 512, 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 = loaded_terse.prolix()
  • Decompress a specific entry:
decompressed_frame = loaded_terse.prolix(n)
# You can check the number of entries by terse.number_of_entries()
  • Add and retrieve metadata to the terse object:
terse.set_attribute('distance', '487.0')
terse.get_attribute('distance')
terse.get_attributes() #Retrieves all set atributes

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.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (131.8 kB view details)

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

pyterse-0.1.2-cp311-cp311-macosx_11_0_arm64.whl (114.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyterse-0.1.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (130.1 kB view details)

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

pyterse-0.1.2-cp310-cp310-macosx_11_0_arm64.whl (113.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyterse-0.1.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (130.3 kB view details)

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

pyterse-0.1.2-cp39-cp39-macosx_11_0_arm64.whl (113.6 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file pyterse-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyterse-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e05962b4f26d612a3e72fae6dae89e74adc5256f76da4ad10bcb568cb5fb94a7
MD5 40cfb9342b4238a17cdca3d4034fd8a0
BLAKE2b-256 2431c13d25327fdd1cde54e4b9ac074a86c11df595fa6f601eadfd62520f3384

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyterse-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06c3f86353a61a2b690e6c5c30973a891c85069b1ffd7e9e94d473e74397faf5
MD5 c5ddf2a6e34d91ed9c60f385097565f5
BLAKE2b-256 3f77e48691337346584140bc070a4c75d6c0651268f4f4ca11696163391dedae

See more details on using hashes here.

File details

Details for the file pyterse-0.1.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyterse-0.1.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8d8b56f285257b73474d4bdb86ea79f791b5af795c58cb2d6c01cc1aaa6224d6
MD5 c7a09547b52270c4da1b41a5ace6f430
BLAKE2b-256 e29ad30e45e24cf067073f263998d2803c7540887286b65649fb74c9304c63b1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyterse-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2d3ea4514315f9eb46e9ca7df871bc8affe3956b5cde6523ae9d65c3f18ee618
MD5 8cf115f265ae78a7839793ac07bb5709
BLAKE2b-256 eaebe2be0a9f67b209ef1036965e21c3b0f839dc004fffe0f9e3d816b6aa9b4d

See more details on using hashes here.

File details

Details for the file pyterse-0.1.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyterse-0.1.2-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 682ab72ce17dbc043e91f497b08492fd701ae8449c397c8fccbc68ae01f15cea
MD5 510dd48b906b33ec0f162cbcd1765bb6
BLAKE2b-256 abc660a2c8fc2bcee0bd324ad92bd353ed106a20cfae0afaa8fc76c4ac03c0a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyterse-0.1.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 98e0d52d4656674aae16dbd8376520c57b6fbc6a6963f4e907b8cf82641542ae
MD5 bb0df351b40b65059ffa3d9cab0c2074
BLAKE2b-256 93f05850fae37ed34583f60d902b0bc85f6fe64c57f8b8e7a6c447429ee2ecc3

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