Skip to main content

Panel+Bokeh-based GUI Toolkit for LiberTEM

Project description

binder github precommit pypi

Widget-based web GUI package intended to support the LiberTEM library for electron microscopy data analysis. The primary usage environment is from within Jupyter Notebooks. Built using the Panel and Bokeh frameworks.

Runs LiberTEM User Defined Functions (UDFs) in interactive panels, which simplies adjustment of parameters and exploring data.

The framework is capable of running certain analyses on top of the LiberTEM-live framework, allowing for interactive live acquisitions in a Jupyter Notebook.

There are two ways to use the UI tools:

  • as standalone analysis windows connected to a dataset

  • through a UIContext window manager, which can dynamically add and remove windows as required

The standalone case (where ctx, ds are LiberTEM Context and DataSet objects):

from libertem_ui.windows.com import CoMImagingWindow
# Create the window using a context and dataset
com_window = CoMImagingWindow.using(ctx, ds)
# Display the window itself
com_window.layout()
# Results from the window are stored in a dataframe-based results manager
# This provides a GUI result browser using a .layout() method
com_window.results_manager.layout()
# Results in the manager can be extracted into Python objects using methods
result_id = '3kd9sn'
rc = com_window.results_manager.get_result_container(result_id)
assert isinstance(rc.data, np.ndarray)
https://raw.githubusercontent.com/LiberTEM/LiberTEM-panel-ui/refs/heads/main/examples/com_window.png

A second standalone window can be linked to the first, and will share the data and LiberTEM resources. Results from both windows will appear in the same results_manager.

from libertem_ui.windows.imaging import VirtualDetectorWindow
# Create new window linked to the previous window
v_window = VirtualDetectorWindow.linked_to(com_window)
# Display the new window
v_window.layout()

When two-or-more windows are linked, certain results can be displayed in other windows to help navigate the data. For example, a log-sum over all frames generated by the FrameImagingWindow can be displayed in the VirtualDetectorWindow frame plot, to help parametrize an annular darkfield analysis.

For a more tightly-integrated experience, the managed UIContext can dynamically add and remove windows, as well as run analyses from multiple windows in parallel:

from libertem_ui.api import UIContext

# Create the UIContext object
# This orchestrates:
#  - add/remove analysis windows
#  - providing work to the LiberTEM Context
#  - managing and saving results from analyses
ui_context = UIContext.for_offline(ctx, ds)
# Display main window for running analyses
ui_context.layout()
# Display table / dataframe-based results manager
ui_context.results_manager.layout()
https://raw.githubusercontent.com/LiberTEM/LiberTEM-panel-ui/refs/heads/main/examples/ui_context.png

see examples/ for some more complete example use cases.

Installation

libertem_ui requires Python 3.10 or greater.

As always, it is advisable to use a virtual or conda environment for testing packages.

pip install libertem-ui

The optional dependencies libertem-ui[libertem] and libertem-ui[notebook] install the necessary components to run LiberTEM windows and Jupyter notebooks, respectively.

Disclaimer

LiberTEM-panel-ui is at an early proof-of-concept stage. All interfaces and functionality is subject to change in the future. Notably, the primary usage environment is in a Jupyter Notebook - standalone usage as a web app through panel serve is not well tested.

If you are interested in the project and would like to see it taken further, please don’t hesitate to get in touch by posting an Issue.

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

libertem_ui-0.0.1.tar.gz (116.4 kB view details)

Uploaded Source

Built Distribution

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

libertem_ui-0.0.1-py3-none-any.whl (143.8 kB view details)

Uploaded Python 3

File details

Details for the file libertem_ui-0.0.1.tar.gz.

File metadata

  • Download URL: libertem_ui-0.0.1.tar.gz
  • Upload date:
  • Size: 116.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for libertem_ui-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fc166552a91df68d80255fea630edae87e3a8755f223dfcf6104840a9efe62d7
MD5 4e39b94504f4c49e937a9e0ffc3b8be8
BLAKE2b-256 57f90b2b5e28570712ce9af2798ffcb316288fcb0a98a40266d78cf1237770a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for libertem_ui-0.0.1.tar.gz:

Publisher: python-publish.yml on LiberTEM/LiberTEM-panel-ui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file libertem_ui-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: libertem_ui-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 143.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for libertem_ui-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5325fdfc5f580609444ee17a7f5b9a4189e90de27547b18ff6c1145caabf93ac
MD5 5a637a413bbb06e6af10b0e585a80141
BLAKE2b-256 ce740c9e0f1a350ae1246ec7ecff2691795b9cd2d8b4603ece5c3cdd28e1a07f

See more details on using hashes here.

Provenance

The following attestation bundles were made for libertem_ui-0.0.1-py3-none-any.whl:

Publisher: python-publish.yml on LiberTEM/LiberTEM-panel-ui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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