Skip to main content

A Python interface for the TERSE library using pybind11.

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. After the compilation the build directory contains the python compression library, which can be imported to a python environment.

How to Install the Package

Create a virtual environment with pybind and cmake

For example:

mamba create -n pyterse python cmake pip pybind11 numpy pillow

OR

conda create -n pyterse python cmake pip pybind11 numpy pillow

And then install the package

pip install pyterse_master.zip


How to compile the code

First, navigate to the project directory. Then, execute the following commands:

mkdir build
cd build
cmake ..
make

Alternatively, if you want to distribute the package, run the following command:

python3 setup.py sdist --inplace

Or run the following command to install the pip package:

pip3 install --use-feature=in-tree-build . 
  • Please note that in case of specific builds special care should be taken for these lines in root CmakeLists.txt: the paths of python and pybinder may be hardcoded based on specific needs before the compilation
# Find Python and PyBind11
find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(pybind11 REQUIRED) 

Testing the functionality of the library

Basic commands

  • Create terse object:
terse = Terse()
  • Add data to Terse object:
terse.push_back(data)
  • Save compressed data to a file:
terse.save('filename.trpx')
  • Load compressed data from a file:
loaded_terse = Terse.load('filename.trpx')
  • Decompress a specific frame:
decompressed_frame = loaded_terse.prolix(frame_index)

Running the test file.

python3 test.py

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

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

pyterse-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (113.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyterse-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (128.4 kB view details)

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

pyterse-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (112.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyterse-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (128.6 kB view details)

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

pyterse-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (112.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for pyterse-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 85aed943cd34df74e4e1fe67fd43978887c700fb2460ed5d980dd96ca4dfc5af
MD5 84d470c0a56284eeae2f8ae597197c94
BLAKE2b-256 9d53fbf2b664aee6429da2c7f720bf8a4cda3f9af23926eca5b86490babf70c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyterse-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e3d46925a38fca2c86aaf24aa4c1549d42049ad3b0af92a67710ad159d39e44
MD5 1159ab92b5aaa66dfb19b69bb2bc8b48
BLAKE2b-256 95fe1374585be6652d566a5beadfdd8deaccf101d15763fd559e427a4d2507bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyterse-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c99c8cd52cb98b37e79d3003d5e9facd6e09dfb7998604d8f4555239fed45e27
MD5 d0360ed45ee96ca8d04294c57f76160b
BLAKE2b-256 7a8d4af94bf0be4c9a65c54977d680c4f2d9c2124e5d000a36fc05589b4c3007

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyterse-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c37c5c1b89ccd33bb8fcf83a58aab7f382b8b426986640eb2811085918646e32
MD5 6ab78462ee0520edb87846d662af15b1
BLAKE2b-256 c45cfb186d975ea8192e2df4bea4e7ada386c3d754c50234ed63665024abd5d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyterse-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c9898353f231297a63d9555b03e09223be927f0feedecac0894a306164a0d359
MD5 e01f075d24470bf175169cb4a528f84b
BLAKE2b-256 42c07cff235cf5ed7d82332cabc4b90108170d2e89efa7869aca737b48ef12d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyterse-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cca4b17836cf8b80083593635286cd7da881ecabebf5964bc4f2436454a00634
MD5 1b77ed7e9bd680f6f18a262c9d8264c0
BLAKE2b-256 8bb00c6b4b24216c5d44c0a2f510ce9162f853c9a60bae35014b32dd1f97269e

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