| --- |
| license: cc-by-4.0 |
| tags: |
| - electron-microscopy |
| - 4D-STEM |
| - materials-science |
| - quantem |
| pretty_name: quantem-data |
| --- |
| |
| # quantem-data |
|
|
| Reference electron-microscopy datasets for browsing and learning. Open in your browser via [quantem.widget](https://github.com/bobleesj/quantem.widget) — **no quantem.live install needed**. |
|
|
| Two buckets: |
|
|
| - **`4dstem/`** — 4D-STEM acquisitions. `_npy_bin*` variants are pre-binned NumPy files for fast workshop / Colab demos; the originals are full Arina h5 bundles. |
| - **`haadf/`** — HAADF survey images. `_npy` variants are pre-cooked NumPy + a `meta.json` sidecar carrying sampling + optics; the originals are full Velox EMD files. |
|
|
| A ready-to-run notebook sits at `notebooks/show4dstem_colab.ipynb` in this repo. |
|
|
| ## One-click workshop notebook (Google Colab) |
|
|
| [](https://colab.research.google.com/gist/bobleesj/54864ce5b2a6f0a4fd5ae1e5d5719b45/show4dstem_colab.ipynb) |
|
|
| It does the full pipeline in 7 cells: install `quantem.widget` (TestPyPI rc) + `quantem` (dev fork branch), download the pre-binned NumPy bundle from this dataset, wrap it as `Dataset4dstem.from_tensor`, render with `Show4DSTEM` in your browser via WebGPU. No CUDA on Colab. No quantem.live. |
|
|
| [](https://colab.research.google.com/gist/bobleesj/a05a90185c6cddbb331342cae6d7e9c1/berk_workshop_v1.ipynb) |
|
|
| **Workshop v1** — real gold 4D-STEM: browse + bright field + dark field + probe + DPC, all on the Colab T4. No `quantem.live`, no local install. The notebook lives at `notebooks/berk_workshop_v1.ipynb` in this repo and on the `berk-workshop` branch of `bobleesj/quantem`. |
|
|
| ## Workshop quick start — Show4DSTEM (any Jupyter) |
|
|
| ```python |
| !pip install -q --pre --extra-index-url https://test.pypi.org/simple/ quantem.widget huggingface_hub |
| !pip install -q git+https://github.com/electronmicroscopy/quantem.git@dev |
| |
| import os, json, numpy as np, torch |
| from huggingface_hub import snapshot_download |
| from quantem.core.datastructures import Dataset4dstem |
| from quantem.widget import Show4DSTEM |
| |
| folder = snapshot_download("bobleesj/quantem-data", repo_type="dataset", |
| allow_patterns=["4dstem/gold_512_npy_bin8/*"]) |
| asset = os.path.join(folder, "4dstem", "gold_512_npy_bin8") |
| data = np.load(os.path.join(asset, "data.npy")) |
| meta = json.load(open(os.path.join(asset, "meta.json"))) |
| |
| dset = Dataset4dstem.from_tensor(torch.from_numpy(data), |
| sampling=meta["sampling"], units=meta["units"]) |
| Show4DSTEM(dset) |
| ``` |
|
|
| ## Workshop quick start — Show2D for HAADF |
|
|
| ```python |
| import os, json, numpy as np, torch |
| from huggingface_hub import snapshot_download |
| from quantem.widget import Show2D |
| |
| folder = snapshot_download("bobleesj/quantem-data", repo_type="dataset", |
| allow_patterns=["haadf/gold_haadf_npy/*"]) |
| asset = os.path.join(folder, "haadf", "gold_haadf_npy") |
| img = np.load(os.path.join(asset, "data.npy")) |
| meta = json.load(open(os.path.join(asset, "meta.json"))) |
| |
| Show2D(torch.from_numpy(img), sampling=meta["sampling"], units=meta["units"]) |
| ``` |
|
|
| ## Acquisition parameters |
|
|
| The 20260423 drift session's optics are **confirmed via the session's own HAADF EMD** (`AccelerationVoltage`, `BeamConvergence`, `CameraLength`). 4D-STEM `scan_sampling` is an **operator pattern from a sibling SSB session** — the drift acquisition itself was never per-file calibrated. |
|
|
| | dataset | voltage | probe | CL | scan | scan sampling | det pitch | mag | |
| |---|---|---|---|---|---|---|---| |
| | `haadf/gold_haadf_npy` | 300 kV ✓ | 30 mrad ✓ | 91 mm ✓ | 4096² image | 0.0186 nm/px | n/a | FOV 76.2 nm | |
| | `4dstem/gold_512_npy_bin8` | 300 kV ✓ | 30 mrad ✓ | 91 mm ✓ | 512² | 0.5 Å (op) | 3.68 mrad/px | unknown | |
| | `4dstem/gold_512_npy_bin4` | 300 kV ✓ | 30 mrad ✓ | 91 mm ✓ | 512² | 0.5 Å (op) | 1.84 mrad/px | unknown | |
| | `4dstem/gold_512` | 300 kV ✓ | 30 mrad ✓ | 91 mm ✓ | 512² | 0.5 Å (op) | 0.46 mrad/px | unknown | |
| | `4dstem/gold_30mrad1.3mx04`…`09` | 300 kV | 30 mrad | 91 mm | smaller | (session yaml) | 0.46 mrad/px | 1.3 Mx | |
| | `haadf/gold_haadf.emd` | 300 kV ✓ | 30 mrad ✓ | 91 mm ✓ | 4096² image | 0.0186 nm/px | n/a | FOV 76.2 nm | |
|
|
| ✓ = confirmed via EMD/yaml. `(op)` = operator pattern, not file-certified. |
|
|
| ## Datasets at a glance |
|
|
| | name | kind | shape | dtype | size | use | |
| |---|---|---|---|---|---| |
| | `4dstem/gold_512_npy_bin8/` | NumPy bundle | (512, 512, 24, 24) | uint16 | ~302 MB | workshop / Colab demo | |
| | `4dstem/gold_512_npy_bin4/` | NumPy bundle | (512, 512, 48, 48) | uint16 | ~1.2 GB | sharper workshop version | |
| | `4dstem/gold_512/` | Arina h5 | (512, 512, 192, 192) | uint16 | ~5 GB | power user | |
| | `4dstem/gold_30mrad1.3mx04` … `09` | Arina h5 | varies | uint16 | ~5 GB each | series demo | |
| | `haadf/gold_haadf_npy/` | NumPy bundle | (4096, 4096) | uint16 | ~34 MB | workshop / Colab Show2D | |
| | `haadf/gold_haadf.emd` | Velox EMD | (4096, 4096) | uint16 | a few MB | full optics carrier | |
|
|
| Each `_npy*` bundle ships a `meta.json` next to `data.npy`: shape, dtype, sampling, units, voltage / probe / CL (with provenance flags) when known. |
|
|
| ## Power-user path (full data, GPU decompression) |
|
|
| Got an NVIDIA GPU and want the full Arina h5 / Velox EMD path? Install [`quantem.live`](https://github.com/bobleesj/quantem.live): |
|
|
| ```python |
| from quantem.live import io |
| from quantem.widget import Show4DSTEM, Show2D |
| import torch |
| |
| folder = io.download("gold_512") |
| result = io.load(io.discover_masters(folder)[0], det_bin=2) |
| Show4DSTEM(torch.from_dlpack(result.data)) |
| |
| ds = io.read_image(io.download("gold_haadf")) |
| Show2D(ds) |
| ``` |
|
|
| ## Memory (VRAM) for the full h5 |
|
|
| | `det_bin` | detector | loaded | peak VRAM | fits 16 GB? | |
| |---|---|---|---|---| |
| | 1 | 192×192 | 18 GB | ~25 GB | no | |
| | **2** | 96×96 | 4.5 GB | **~6.9 GB** | **yes** | |
| | 4 | 48×48 | 1.1 GB | ~2.2 GB | yes | |
| | 8 | 24×24 | 0.3 GB | ~0.5 GB | yes | |
|
|
| ## Licence |
|
|
| CC-BY-4.0. Cite quantem.live / quantem.widget if you use these in a publication. |
|
|