Skip to main content

py4D-browser-transform

py4D-browser-transform is a plugin for py4D-browser that adds in-memory datacube transformation tools. It currently supports axis permutation, diffraction flips/transposes, RAM checkpoints and restore, and datacube slicing, subsampling, and binning.

Installation

You can install py4D-browser-transform with pip or conda:

pip install py4d-browser-transform

💡 Note:

  • If you install into a fresh Python environment, py4D-browser and py4DSTEM will be automatically installed as dependencies so you don't need to install them first.
  • If you already have py4D-browser installed, you can install this plugin into the same Python environment.

A step-by-step guide including creating a fresh Python environment via conda would look 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-transform

Usage

Simply run the following command to start the browser once you activated the corresponding Python environment:

py4dgui

After installing this plugin, you should see the "Transform" submenu appear under the "Plugins" menu.
From here, you can:

  • Set Axis Permutation: reorder the four datacube axes when the loaded dataset is not in the expected order.
  • Set Diffraction Flips: flip the diffraction pattern up/down, left/right, or transpose its X/Y axes.
  • Save RAM Checkpoint: store a RAM-only snapshot of the current in-memory datacube.
  • Restore RAM Checkpoint: restore a previous RAM checkpoint, rename checkpoints, replace checkpoints, or delete checkpoints.
  • Slice / Subsample / Bin: slice, subsample with Python-style step syntax such as ::2, and bin along the displayed axes Ry, Rx, Qy, and Qx.

Demo of py4D-browser-transform

These operations directly modify the loaded in-memory datacube, but do not affect the raw file stored on disk. You can export the transformed datacube to disk using File > Export Datacube.

RAM checkpoints

RAM checkpoints are session-local snapshots of the datacube data at the moment they are saved. They are intended as recovery points before destructive in-memory transformations such as slicing, subsampling, and binning.

Checkpoint restore loads the saved datacube snapshot and resets the flip/permutation markers back to their default clean state. In other words, a checkpoint represents "the datacube exactly as it looked then", not a reversible history of every flip or permutation action that produced it.

Large checkpoints can require substantial memory. The plugin warns before saving a checkpoint larger than 1 GiB, or when total stored checkpoint data would exceed 4 GiB.

Slicing, subsampling, and binning

The Slice / Subsample / Bin dialog provides one row for each axis:

  • Ry
  • Rx
  • Qy
  • Qx

Use slice text like :, 10:100, or ::4 to select or subsample data. Use the bin control to sum neighboring pixels along an axis. The dialog previews the output shape before applying the transform.

Calibration pixel sizes are updated when both axes in real space or both axes in diffraction space change by the same spacing factor. When the change cannot be represented safely by py4DSTEM's shared real-space or diffraction-space pixel size, calibration is preserved.

Note: The order of flipping and permutation matters. If you mix these operations, reversing them manually requires applying the opposite operations in the opposite order. RAM checkpoints provide a simpler way to return to a known datacube state.

License

GNU GPLv3

py4D-browser-transform 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-transform is also kept free and open.

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_transform-0.1.1.tar.gz (24.5 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_transform-0.1.1-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file py4d_browser_transform-0.1.1.tar.gz.

File metadata

  • Download URL: py4d_browser_transform-0.1.1.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for py4d_browser_transform-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2c3a586b4aa64c0b8fa77c582cd5b0b0aeef25276a7650e16450887ca71c86f5
MD5 71cf09e6c4c22c9b1bc942529d2e5522
BLAKE2b-256 dc06786782b6118061a2ec91297f26a720579743d1d5ad27b75474de0c455baa

See more details on using hashes here.

Provenance

The following attestation bundles were made for py4d_browser_transform-0.1.1.tar.gz:

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

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_transform-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for py4d_browser_transform-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e211b52018cc97126d5404a4845a135d97c3dba63facf921b7de827b469f9c7
MD5 1855e6b3b3a4395bda0354594a47845f
BLAKE2b-256 1fa2c10950b96df9c34624b588ad5b0f80c727bc34d7dfbe4079e2a4f5ec9d8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for py4d_browser_transform-0.1.1-py3-none-any.whl:

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

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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

0.0.2.post1

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page