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.

Metadata

Release files for py4D-browser-transform 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py4D-browser-transform 0.1.1
File Size Uploaded
py4d_browser_transform-0.1.1.tar.gz 24.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py4D-browser-transform 0.1.1
File Interpreter ABI Platform
py4d_browser_transform-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 48.1 kB

Release files / py4d_browser_transform-0.1.1.tar.gz

Download URL py4d_browser_transform-0.1.1.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2c3a586b4aa64c0b8fa77c582cd5b0b0aeef25276a7650e16450887ca71c86f5
BLAKE2b-256 checksum
How to use checksums
dc06786782b6118061a2ec91297f26a720579743d1d5ad27b75474de0c455baa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / py4d_browser_transform-0.1.1-py3-none-any.whl

Download URL py4d_browser_transform-0.1.1-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e211b52018cc97126d5404a4845a135d97c3dba63facf921b7de827b469f9c7
BLAKE2b-256 checksum
How to use checksums
1fa2c10950b96df9c34624b588ad5b0f80c727bc34d7dfbe4079e2a4f5ec9d8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page