py4D-browser plugin that adds utility functions which transform the datacube
Project description
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-browserandpy4DSTEMwill be automatically installed as dependencies so you don't need to install them first.- If you already have
py4D-browserinstalled, 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 axesRy,Rx,Qy, andQx.
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:
RyRxQyQx
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py4d_browser_transform-0.1.0.tar.gz.
File metadata
- Download URL: py4d_browser_transform-0.1.0.tar.gz
- Upload date:
- Size: 23.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9437c1c2584af5daa9d2b2718c8362ac5db5524e17c67d846d80ed52a9b02217
|
|
| MD5 |
7cfb3db0944ef9dabbad657ab9a78834
|
|
| BLAKE2b-256 |
88c75d13a8d8026c7348df9d3ccb5a800ef6c77efb241dd2734a78e5ad7b1d85
|
Provenance
The following attestation bundles were made for py4d_browser_transform-0.1.0.tar.gz:
Publisher:
publish_pypi.yml on chiahao3/py4D-browser-transform
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py4d_browser_transform-0.1.0.tar.gz -
Subject digest:
9437c1c2584af5daa9d2b2718c8362ac5db5524e17c67d846d80ed52a9b02217 - Sigstore transparency entry: 1615323522
- Sigstore integration time:
-
Permalink:
chiahao3/py4D-browser-transform@4c22f82e00817e2f76079de972864f7a558da2e7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/chiahao3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@4c22f82e00817e2f76079de972864f7a558da2e7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file py4d_browser_transform-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py4d_browser_transform-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9085a9dc9ee7ca24b6755e99262940b0e79d7d7cb46535167a3f326b21e1d325
|
|
| MD5 |
b450a31cb49c87ea2018bba5cb282195
|
|
| BLAKE2b-256 |
80cb43b4bd2ff2ef30da73365ea3c1e4fd1ede6f4472fd59aac193042c9ec1ac
|
Provenance
The following attestation bundles were made for py4d_browser_transform-0.1.0-py3-none-any.whl:
Publisher:
publish_pypi.yml on chiahao3/py4D-browser-transform
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py4d_browser_transform-0.1.0-py3-none-any.whl -
Subject digest:
9085a9dc9ee7ca24b6755e99262940b0e79d7d7cb46535167a3f326b21e1d325 - Sigstore transparency entry: 1615323525
- Sigstore integration time:
-
Permalink:
chiahao3/py4D-browser-transform@4c22f82e00817e2f76079de972864f7a558da2e7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/chiahao3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@4c22f82e00817e2f76079de972864f7a558da2e7 -
Trigger Event:
release
-
Statement type: