Skip to main content
DINO-4DSTEM

DINO-4DSTEM

A self-supervised deep-learning pipeline for 4D-STEM data analysis.

Unsupervised classification and phase mapping for 4D-STEM (4DSTEM, four-dimensional STEM) and scanning electron diffraction (SED) — also nanobeam electron diffraction (NBED) and nanodiffraction. It groups your diffraction patterns into distinct structural regions and shows you why — no labels, no coding.

paper tests platform coding setup


A real NaPHI diffraction pattern is classified into a colored class map



⬇ Download & install →

Free · Windows · a one-time ~15-minute setup, then double-click to run.


What it does

Point it at a scan. It groups every diffraction pattern into structurally distinct classes — phases, crystallinity, texture — paints them on a map of your sample, and gives you the evidence behind each class.

🔍 Automatic

Groups every diffraction pattern into distinct classes with no labels and no hand-tuning. Just load a scan and go.

🧭 Interpretable

See why each region is its own class — its diffraction as a single frame, a grain average, or the whole class — plus attribution maps and an NMF baseline to check the answer.

🖱️ No code

A desktop app plus a plain-English assistant. Double-click to launch — or just ask “load this file, then train.”


See the evidence — at any scale

Every class is checkable. Look at its diffraction as a single frame, a grain average, or the whole-class average — the noise falls away and the Bragg spots sharpen as you zoom out.

The same NaPHI class as a single frame, a grain average, and a class average — progressively cleaner

Bring your own data

Point it at the files you already have — nothing is uploaded, everything stays on your machine.

Format Source / detector Notes
.prz · .npz · .npy py4DSTEM / NumPy cubes memory-mapped, low RAM
.h5 · .hdf5 master Dectris / Eiger / EMPAD masters stitches external links; asks scan shape if 3-D
.dm4 · .dm3 Gatan reads calibration from metadata
.raw EMPAD metadata rows cropped automatically
.mib (+ .hdr) Quantum Detectors Merlin / Medipix3 counting mode
folder of images .tif / .png / .jpg / … numbered by scan order → cube (greyscale + optional binning)

Low dose? Denoise it first.

Beam-sensitive samples force you below the dose that gives a clean pattern. The Pre-processing tab now has one-click self-supervised denoising — no clean reference, no repeated acquisition. One exposure is enough.

🌀 Denoise (Noise2Noise, binomial). Every pattern is a Poisson draw, so a fair coin flip per electron deals its counts into two independent half-dose exposures of the same signal (Poisson thinning). A small, deliberately low-capacity dose-equivariant network learns to map one half to the other, then runs on the full exposure. Total counts are preserved — and there is no parameter to tune.

📉 Flatten (radial background). Removes the azimuthally-symmetric radial background — the direct-beam skirt and the amorphous halo — so the Bragg and orientation signal stands out. Subtract the azimuthal median, or divide by the azimuthal mean.

Both show a before/after preview, then bake a new cube alongside the original — your raw file is never modified.

The other algorithms are in the notebooks. n2_methods_demo.ipynb compares Noise2Void, Noise2Self and scan-to-scan Noise2Noise against the binomial split — with the math behind each, and why the blind-spot methods carry a hyperparameter while the binomial split does not.


More than classes — the full 4D-STEM toolbox

The learned class map is the centre of the app, but the everyday 4D-STEM workflow is all there too — on the same loaded scan, no scripting.

Tab What you can do
Data ▸ Viewing Virtual BF / HAADF images of the scan; drag an n × m window for a live mean diffraction pattern; exposure + log stretch; distance, radial and azimuthal profile tools; iCOM (DPC)
Data ▸ Load + Pre-process Flyback detection for continuously streamed scans (finds lead-in / flyback frames and the real scan grid); hot / dead pixel removal; NBED centering; ellipticity correction; real-space binning; denoising and radial flattening (above)
Clustering ▸ NMF + cluster Model-free NMF + clustering baseline (k-means, agglomerative, HDBSCAN, fuzzy c-means) on polar or Cartesian patterns; interactive class map with a live pattern under the mouse and class A − class B difference patterns
Diffraction ▸ ACOM (orientation & phase mapping) Load CIFs, calibrate against the CIF rings, match a single pattern, then map class averages, grains or the full scan: phase map, zone-axis map, correlation, optional NNLS phase refinement (phase weights + reliability). Overlay the DINO / NMF classes on the result and click any pixel to see its pattern with the matched phase. A fiber search can be restricted to one viewing direction [u v w].
Diffraction ▸ ACOM ▸ Data reference No CIF needed: a measured pattern (scan position, grain, ROI box or class average) is the reference — its detected spots are the template. Every pattern gets a match score and its in-plane rotation relative to the reference; several references give a phase / zone-axis map — for near-identical phases (e.g. a structure and its superstructure) the references are compared with each other and only the reflections that differ are measured, giving best / second-best phase, confidence and an uncertain class. Right-drag a box on the result to turn that region into a new reference. A CIF simulated at a zone axis can be added as a reference too.
Diffraction ▸ ACOM ▸ Strain Per-pattern lattice strain (εxx, εyy, εxy) and lattice rotation against any reference: a measured region (relative strain) or a CIF at a zone axis (absolute strain). Sub-pixel spot positions; click a pixel to see the fitted lattice.
Diffraction ▸ Crystallinity 1D peak/halo and spottiness maps (degree of crystallinity, no spot detection needed)

Orientation and phase mapping is py4DSTEM's. The ACOM tab's CIF mode is a graphical front end to py4DSTEM's crystal orientation and phase mapping (Crystal.orientation_plan / match_orientations, CrystalPhase.quantify_phase) — the matching and the NNLS phase fit are py4DSTEM's work, not ours (the Data reference and Strain modes are DINO-4DSTEM's own spot matching and lattice fitting; a CIF reference there uses py4DSTEM only to simulate the spot positions). If you use it, please cite py4DSTEM (Savitzky et al., Microscopy and Microanalysis 2021) and its orientation-mapping paper (Ophus et al., Microscopy and Microanalysis 2022).

Where results go. Every analysis tab saves into one folder next to your data — <data name>_DINO4DSTEM/ with a sub-folder per tool (nmf/, acom/maps, acom/dataref, acom/strain, …) and a README inside. The Open outputs folder button in the top bar takes you there.


Get started — pick your platform

Each bundle is the whole app with the right launchers for your OS. All three need free Miniconda / Miniforge installed first.

🪟 Windows 🐧 Linux 🍎 macOS

⬇ Download for Windows

Double-click install_1_…bat then install_2_…bat, launch from the Desktop icon. NVIDIA GPU set up automatically.

Install guide →

⬇ Download for Linux

chmod +x *.sh → ./install.sh → ./launch_gui.sh. NVIDIA-GPU ready.

Install guide →

⬇ Download for macOS

chmod +x *.sh → ./install.sh → ./launch_gui.sh. Runs on CPU.

Install guide →

Prefer git? git clone https://github.com/DanielKhaykelson/dino-4dstem, then run the installer for your OS. The Windows bundle also includes GETTING_STARTED.docx, a picture-by-picture walkthrough.

Or install with pip

Comfortable with Python? Install into a fresh Python 3.10 environment:

pip install dino4dstem
dino4dstem shortcuts     # optional: GUI / Assistant / Notebooks icons on your Desktop
dino4dstem setup-gpu     # optional: CUDA build of PyTorch for an NVIDIA GPU
pip install -U dino4dstem   # later: update to the newest release

Then just run dino4dstem to open the app. Other commands: dino4dstem assistant, dino4dstem notebooks, dino4dstem --help. The app keeps its working files in ~/DINO4DSTEM (set DINO4DSTEM_HOME to move it).

⚠️ Windows is the primary, fully tested platform. The Linux and macOS builds share the same code and their installers have been checked, but they have not yet been fully tested end-to-end on those systems. If you hit a problem on Linux or macOS, please get in touch — reports are very welcome.


Citing

If DINO-4DSTEM contributes to work you publish, please cite the paper:

DINO4DSTEM: A self-supervised framework for structural discovery in 4D-STEM
Daniel Khaykelson, Lothar Houben, Boris Rybtchinski
arXiv:2608.15098 (2026) — read it →

@article{khaykelson2026dino4dstem,
  title  = {DINO4DSTEM: A self-supervised framework for structural discovery in 4D-STEM},
  author = {Khaykelson, Daniel and Houben, Lothar and Rybtchinski, Boris},
  journal = {arXiv preprint arXiv:2608.15098},
  year   = {2026},
  url    = {https://arxiv.org/abs/2608.15098}
}

GitHub also builds this for you: use “Cite this repository” on the repo sidebar (it reads CITATION.cff) to copy BibTeX or APA.


Learn more


Help & contact

Questions, bug reports, feature requests, or help getting it running on your data — including Linux/macOS issues — are all welcome. Two ways to reach us:

  • 🐛 Bug reports & feature requests: open a GitHub issue (click New issue). Best for anything reproducible — it's searchable and others can follow along.
  • 📧 Direct questions / inquiries: email Daniel Khaykelson at daniel.kh@weizmann.ac.il.

When reporting a problem, it helps to include your operating system, what you did, and the full error message (copy the text from the console window).


🦕 Windows · Linux · macOS · companion code for ongoing 4D-STEM / electron-diffraction research.

Metadata

Release files for dino4dstem 1.0.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 dino4dstem 1.0.1
File Size Uploaded Provenance Actions
dino4dstem-1.0.1.tar.gz 6.5 MB With provenance Details for dino4dstem-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dino4dstem 1.0.1
File Interpreter ABI Platform Actions
dino4dstem-1.0.1-py3-none-any.whl Python 3 none any Details for dino4dstem-1.0.1-py3-none-any.whl

Total release size: 13.0 MB

Release files / dino4dstem-1.0.1.tar.gz

Download URL dino4dstem-1.0.1.tar.gz
Size 6.5 MB
Tags Source
SHA-256 checksum
How to use checksums
611cfe51ab282f4e47ac0db4e6d0004a79a2715d409234857384e5fabb5f83a0
BLAKE2b-256 checksum
How to use checksums
4168e48321613f37049808e3cdbe260839fce9b4c9036554b147d618d289a7e2
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 Nov 2, 2026.

Transparency log

Release files / dino4dstem-1.0.1-py3-none-any.whl

Download URL dino4dstem-1.0.1-py3-none-any.whl
Size 6.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
150d9d1b8baa6cdf73f1268be525362c5ab940a9e1cc12793e301f280bbf8c2a
BLAKE2b-256 checksum
How to use checksums
d3d44791730d5a423fb9cd62cf8e542b4d515f7944e1af35a33f374aeecc328c
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 Nov 2, 2026.

Transparency log

Security for dino4dstem 1.0.1

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dino4dstem-1.0.1.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 Nov 2, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files Full provenance

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