Skip to main content

py4D-browser plugin for flexible HDF5 and Zarr dataset loading

Project description

py4D-browser-flexloader

py4D-browser-flexloader is a plugin for py4D-browser that adds a flexible loader for HDF5 and Zarr datasets. It lets you browse datasets inside a file or Zarr store, choose the data array to load, map arbitrary source dimensions into py4DGUI's expected 4D datacube order, and preview the selected mapping before loading.

This is useful for datasets that are not organized in the standard py4DSTEM file layout, including files with multiple arrays, higher-dimensional arrays, and flattened scan dimensions such as (Nscans, ky, kx).

Installation

You can install py4D-browser-flexloader directly from PyPI:

pip install py4d-browser-flexloader

Note:

  • If you install into a fresh Python environment, py4D-browser and py4DSTEM will be installed automatically as dependencies.
  • If you already have py4D-browser installed, install this plugin into the same Python environment.

A step-by-step installation using conda looks like this:

conda create -n py4dgui python=3.12
conda activate py4dgui
python -m pip install --upgrade pip
python -m pip cache purge
pip install py4d-browser-flexloader

Usage

Start py4DGUI after activating the environment:

py4dgui

After installing this plugin, you should see a "Flex Loader" submenu under the "Plugins" menu. From there, choose the loader that matches your data source:

  • Load HDF5 File... for .h5, .hdf5, .emd, .mat, and .py4dstem files.
  • Load Zarr Directory... for directory-backed .zarr stores.
  • Load Zarr Zip File... for Zarr stores saved as .zip or .zarr.zip files.

The loader dialog shows the internal hierarchy of the selected file or store, including array paths, shapes, dtypes, chunks, and attributes. Once an array is selected, assign its dimensions to:

  • Scan Y
  • Scan X
  • Detector Y
  • Detector X
  • Fixed Index
  • Flattened Scan

Use Flattened Scan for datasets stored as (Nscans, ky, kx) or (..., Nscans, ky, kx). The loader will factor the flattened scan axis into Scan Y and Scan X before loading.

Click Update Preview to inspect a lightweight preview before loading. The preview reads only two 2D slices from the selected HDF5/Zarr dataset:

  • a sqrt-scaled diffraction pattern from the central scan position
  • an axial bright-field image from the central diffraction pixel

Click Load to create a py4DSTEM.DataCube from the selected 4D subset and send it to py4DGUI. The raw source file is not modified. Calibration can be set after loading using py4DGUI's calibration tools.

Both grouped Zarr stores and root-level Zarr arrays are supported.

License

GNU GPLv3

py4D-browser-flexloader is open source software distributed under a GPLv3 license. It is free to use, alter, or build on, provided that any work derived from py4D-browser-flexloader is also kept free and open.

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

py4d_browser_flexloader-0.0.5.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

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

py4d_browser_flexloader-0.0.5-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file py4d_browser_flexloader-0.0.5.tar.gz.

File metadata

  • Download URL: py4d_browser_flexloader-0.0.5.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py4d_browser_flexloader-0.0.5.tar.gz
Algorithm Hash digest
SHA256 21141c81d41ecf64a11153e83587750365621d2b11b2ad93bca2798f88d1fda5
MD5 afe5602eb3f9b734d4609c7f85a489b1
BLAKE2b-256 adf74761ef1a1e880e6c8c81fa8e1fc45dfe741537ea75e9b8df36a645a9c07f

See more details on using hashes here.

Provenance

The following attestation bundles were made for py4d_browser_flexloader-0.0.5.tar.gz:

Publisher: publish_pypi.yml on chiahao3/py4D-browser-flexloader

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

File details

Details for the file py4d_browser_flexloader-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for py4d_browser_flexloader-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4e6939da5e1966cccb9fd853c19091285a24cf985a76e1441e4e908b7d18acb0
MD5 c5c0a3112f152d07846beff124a78cdb
BLAKE2b-256 49c18b571fd851ab194f45151b905b692077e3a108888a7f7ca428562687e107

See more details on using hashes here.

Provenance

The following attestation bundles were made for py4d_browser_flexloader-0.0.5-py3-none-any.whl:

Publisher: publish_pypi.yml on chiahao3/py4D-browser-flexloader

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