Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pyterse

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyterse

A Python interface for the TRPX compression algorithm

  • 0.1.3
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc