Skip to main content

Suite of tools for processing and reconstruction of electron tomography data

Project description

ETSpy

Documentation link PyPI - Python Version Conda versions

ETSpy is a HyperSpy extension package package for the processing, aligment, and reconstruction of electron tomography data from TEM/STEM instruments. Tools are provided for basic tilt series data processing, stack alignment, and reconstruction using the ASTRA Toolbox.

Installation

Depending on your system, there are a few ways to install ETSpy. Due to dependencies that require compilation of binaries and the use of GPU-accelerated libraries, conda is the simplest way to get started. It will auto-detect CUDA-capable GPUs and install the correct version of whatever packages are required.

⚠️ ETSpy requires a Python version >= 3.10 and < 3.13 (3.13 and above are not supported due to dependencies). If installing manually using pip, please ensure you are using a supported version.

Anaconda (Preferred)

Works on Windows, MacOS, and Linux

  • First, ensure you have either Anaconda or Miniconda installed on your system.

  • Run the following command to create a new environment then activate the newly created environment:

    # if you would like your environment to be stored in a specific place, use the "-p <path>" option
    $ conda create -n etspy
    $ conda activate etspy
    
  • With the etspy environment activated, install the ETSpy package from the conda-forge repo:

    (etspy) $ conda install -c conda-forge etspy
    
  • (Alternatively) if you have a GPU and wish to make full use of the GPU-accelerated code, install the etspy-gpu package, which will pull in a few added dependencies to enable these features:

    (etspy) $ conda install -c conda-forge etspy-gpu
    

Optional Jupyter components (higly recommended)

  • To use ETSpy from within a Jupyter Lab/Notebook environment, you will need to "register" the python kernel associated with the etspy conda environment. Run the following after ensuring that environment is activated (with conda activate etspy):

    (etspy) $ conda install -c conda-forge ipykernel
    (etspy) $ python -m ipykernel install --user --name ETSpy
    

    You will then be able to select the "ETSpy" kernel when running Jupyter and creating new notebooks

Using pip

Works on Linux only, with additional prerequisites

Assuming you have the prequisite packages on your system (including the CUDA libraries), ETSpy should be able to be installed with a simple pip command (it is recommended to install ETSpy in a dedicated virtual environment). Pick one of the following options depending on your needs:

On Ubuntu-based systems, the NVIDIA/CUDA dependencies installed via the system-provided `nvidia-cuda-toolkit` apt package may be out of date and incompatible with the ASTRA toolkit. We recommend installing the version directly from NVIDIA.
  • $ pip install etspy
    
  • To use ETSpy in Jupyter interface from within a dedicated virtual environment, installing ipykernel is necessary (as with Anaconda). This can be done by specifying the [jupyter] group when installing ETSpy:

    $ pip install etspy[jupyter]
    
  • To use the cupy accelerated code in ETSpy, you will need to install cupy. This can be done by specifying the [cuda], [cuda12] or [cuda13] group when installing ETSpy:

    $ pip install etspy[cuda]
    

    Note that the [cuda] is a convenience and is functionally equivalent to [cuda12].

  • A shortcut for doing both of the above is to install the [all] target. Note that this will install the [cuda12] libraries.

    $ pip install etspy[all]
    
  • To register the ETSpy virtual environment as a Jupyter kernel, run the following with the virtual environment enabled:

    (etspy) $ python -m ipykernel install --user --name ETSpy
    

Some dependencies of ETSpy require compilation of C code, meaning using the Anaconda approach above will simplify things greatly if you have trouble with "pure" pip.

Removal

The package can be removed with:

$ pip uninstall etspy

Basic Usage

The majority of the functionality of ETSpy can be accessed by importing the etspy.api module. For example, to load a tilt series dataset into a TomoStack, you could do the following:

import etspy.api as etspy
stack = etspy.load('TiltSeries.mrc')

For more details, see the dedicated documentation, including the example Jupyter notebook and the more detailed API Reference.

Logging

To enable logging in ETSpy, use the following code:

import logging
logging.basicConfig(level="WARNING")

Developer documentation

See the developer docs for more information.

Related projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

etspy-1.2.0.tar.gz (66.5 MB view details)

Uploaded Source

Built Distribution

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

etspy-1.2.0-py3-none-any.whl (66.6 MB view details)

Uploaded Python 3

File details

Details for the file etspy-1.2.0.tar.gz.

File metadata

  • Download URL: etspy-1.2.0.tar.gz
  • Upload date:
  • Size: 66.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for etspy-1.2.0.tar.gz
Algorithm Hash digest
SHA256 67c0088d2fa6b48a94d881a872c06ed93d9f28b06b2bf0d0edb168018d37b1ec
MD5 f3c17a16a65117d1adfb63af4d7522b9
BLAKE2b-256 6766a0dd6c1aec80904c94a01876698d568d8e33b73af86bed313cea0dc7e4a4

See more details on using hashes here.

File details

Details for the file etspy-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: etspy-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 66.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for etspy-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01b470d6c252e954e47e71a7aab1597a8a24e6e589a5e88bd898db6e4aec71ee
MD5 1b49aceebb0a8b41c4897268e27b917a
BLAKE2b-256 eaf2ea201d9a34a55b768d86991fbd5714b085eae9829d7f136e845dccb642c0

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