GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - DanielKhaykelson/dino-4dstem: DINO-SR self-supervised classifier for 4D-STEM diffraction: training, GUI, NL assistant (Ollama), NMF/ACOM/interpretation pipeline.

BranchesTags
Open more actions menu

Latest commit

 

History

282 Commits
282 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
assets
assets
 
 
dev_notes
dev_notes
 
 
dino4dstem
dino4dstem
 
 
docs
docs
 
 
notebooks
notebooks
 
 
revision_analysis
revision_analysis
 
 
src
src
 
 
tests
tests
 
 
tools
tools
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CITATION.cff
CITATION.cff
 
 
INSTALL.md
INSTALL.md
 
 
LICENSE
LICENSE
 
 
PAPER_REPRODUCIBILITY.md
PAPER_REPRODUCIBILITY.md
 
 
PROJECT_SUMMARY.md
PROJECT_SUMMARY.md
 
 
README.md
README.md
 
 
_activate.bat
_activate.bat
 
 
_activate.sh
_activate.sh
 
 
_find_conda.bat
_find_conda.bat
 
 
_find_conda.sh
_find_conda.sh
 
 
environment.yml
environment.yml
 
 
install.bat
install.bat
 
 
install.sh
install.sh
 
 
install_1_environment.bat
install_1_environment.bat
 
 
install_2_dino4dstem.bat
install_2_dino4dstem.bat
 
 
launch_assistant.bat
launch_assistant.bat
 
 
launch_assistant.sh
launch_assistant.sh
 
 
launch_gui.bat
launch_gui.bat
 
 
launch_gui.sh
launch_gui.sh
 
 
launch_notebooks.bat
launch_notebooks.bat
 
 
launch_notebooks.sh
launch_notebooks.sh
 
 
make_desktop_shortcuts.ps1
make_desktop_shortcuts.ps1
 
 
make_desktop_shortcuts.sh
make_desktop_shortcuts.sh
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 
uninstall.bat
uninstall.bat
 
 
uninstall.sh
uninstall.sh
 
 

Repository files navigation

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

  • 📄 The paper — arXiv:2608.15098
  • 🧭 What it does & results — PROJECT_SUMMARY.md
  • 📓 Tutorial notebooks — notebooks/ — phantom → train → analyse → baselines, plus the denoising methods comparison (N2N binomial, Noise2Void, Noise2Self)
  • 🧠 The methods explained (DINO, NMF, clustering, PCA) — docs/assistant/CONCEPTS.md
  • 📕 Full manual — docs/USER_MANUAL.pdf
  • 🛠️ Install guide — INSTALL.md

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 [email protected].

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.

About

DINO-SR self-supervised classifier for 4D-STEM diffraction: training, GUI, NL assistant (Ollama), NMF/ACOM/interpretation pipeline.

Topics

4d-stem4dstemclusteringcrystallizationdenoisingdinoelectron-diffractionelectron-microscopic-imageselectron-microscopyguimaterials-sciencenoise2noisenoise2selfnoise2voidorganic-chemistrypythonpytorchself-supervisedself-supervised-clusteringself-supervised-learning

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.