Ptydy
A PtyRAD studio. Pronounced "tidy".
Status: early development (0.3.0). The data viewer, fast-acbf and the result inspector work; the other planned apps do not exist yet. Expect the interface to change between releases; installing from source is recommended while it does.
Ptydy is a desktop program that brings the PtyRAD ecosystem together in one place, so the steps of a ptychography workflow share their settings instead of being copied between tools by hand:
- Experiment planning: dose, probe overlap, sampling, and the expected result (planned)
- Dataset inspection: a fast 4D-STEM browser with fast-acbf tcBF/acBF (available)
- PtyRAD plan helper: build and check reconstruction settings, submit jobs (planned)
- Dataset simulation: simulated datasets with known ground truth (planned)
- Output inspector: PtyRAD results (v1 and v2), live jobs (available)
What works today
Ptydy is a shell of pipeline apps: pick an app on the rail at the left; its tools appear in the ribbon under the main menu.
-
Data viewer (a py4DGUI replacement without py4DSTEM): diffraction and virtual-image panes, and a result pane (FFT, EWPC or a task's output) on demand; point / rectangle / circle / annulus detectors with integrating, maximum, centre-of-mass and iCoM responses; scan point or rectangle for the diffraction pattern; statistics, colour map, scaling and a level histogram next to each pane; scale bars from the calibration; TIFF / PNG / clipboard export.
-
Files: EMPAD
.raw(memory-mapped), py4DSTEM / emdfile HDF5 with its calibration, any HDF5 / MATLAB v7.3 / Zarr / NumPy array through a flexible loader that maps the axes (fixed indices, flattened scans), and DigitalMicrograph / Medipix / blockfile through RosettaSciIO. Large files are memory-mapped when they don't fit in RAM. Export saves a dataset (e.g. after a crop or bin) as HDF5 with its calibration and fast-acbf's aberrations and orientation; ptydy reopens it as it was and PtyRAD reads it as it is. -
fast-acbf: GPU tcBF / acBF reconstruction. The everyday steps (tcBF, acBF, orientation, defocus search, C10) are in the data viewer's ribbon; the fast-acbf app has the dashboard: per-aberration values, automated refinement with a restorable history, the reconstruction next to the probe (|ψ|, |ψ|², complex), the aberration surface χ, ∇χ and the vBF image shifts as arrows, and 3D depth stacks over defocus with an orthogonal view, exported as multi-page TIFF stacks.
-
Result inspector: PtyRAD model files of v1 and v2 (read without PtyRAD), a run's output folder or a folder of runs. A dashboard first (object, probe modes, the loss of every iteration, the run's facts, state and time left), then tabs: object (phase / amplitude / complex, modes, depth sum, mean or product / slice / orthogonal sections, FFT, change since the previous save), probe (real / Fourier, amplitude / phase, modes, propagation through z with the focus, aberration fit with PtyRAD params to copy and the coefficients over iterations), positions, PtyRAD's figures (saved, or redrawn by PtyRAD's plotting functions), metadata (filterable) and the log. Play through the saved iterations; a running job is followed as it saves. Several runs stay open, one tab each: switching keeps the tab, the display settings, the zoom and the iteration, so runs compare at a glance; a Files panel (View ▸ Files) shows them with thumbnails. Drop a model file or folder on the window, or
ptydy path/to/output_folder.
Installation (from source)
conda create -n ptydy python=3.12
conda activate ptydy
git clone https://github.com/chiahao3/ptydy.git
cd ptydy
pip install -e ".[all]" # or ".[acbf]" for fast-acbf only, "." for the browser alone
For GPU reconstructions, install the PyTorch build that matches your CUDA version first
(and torchvision from the same index), e.g.
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126.
Optional extras: acbf (fast-acbf + PyTorch), zarr, rsciio (DigitalMicrograph,
Medipix, ...), dev (tests, lint, build).
Usage
ptydy # then drop a dataset on the window
ptydy path/to/scan_x128_y128.raw
ptydy path/to/ptyrad/output/run_folder # or a model_iter*.hdf5: the result inspector
See notes/INSTRUCTION.md for the controls, and use the ptydy.io
readers from scripts:
from ptydy.io import open_datacube
dc = open_datacube("scan_x128_y128.raw") # DataCube: data[scan_y, scan_x, det_y, det_x]
dc = open_datacube("data.mat", dataset="/dp", scan_shape=(64, 64))
Development
See PLAN.md (state, next actions, architecture, decisions) and RELEASING.md.
QT_QPA_PLATFORM=offscreen pytest -q
ruff check src tests tools
License
LGPL-3.0. See LICENSE.
Metadata
Release files for ptydy 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ptydy-0.4.0.tar.gz | 311.2 kB | With provenance | Details for ptydy-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ptydy-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for ptydy-0.4.0-py3-none-any.whl |
Total release size: 614.4 kB
Release files / ptydy-0.4.0.tar.gz
| Download URL | ptydy-0.4.0.tar.gz |
|---|---|
| Size | 311.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72311a1243c2714cc0bdc4e2aff3b829169132548520c2ca00d6a34ce0922ad3
|
|
BLAKE2b-256 checksum How to use checksums |
f8877b3cc176373b3585b92a7e0a60aae2a899905dfa57a584297abfe5732bae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 22, 2026.
Transparency logRelease files / ptydy-0.4.0-py3-none-any.whl
| Download URL | ptydy-0.4.0-py3-none-any.whl |
|---|---|
| Size | 303.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d02b4ab98a082a37b03f928b0c2d3285e3b46283ee2a28ef075e11b502339fd3
|
|
BLAKE2b-256 checksum How to use checksums |
93be75e5ab20e657a303cc6d9de44bdcb3542627a01fc9d2299b358a86b89199
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 22, 2026.
Transparency logSecurity for ptydy 0.4.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ptydy-0.4.0.tar.gz
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 Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.