bobleesj commited on
Commit
30d14c8
·
verified ·
1 Parent(s): f1bd554

docs(README): lead with TestPyPI quantem.widget + Colab; document npy_bin variants

Browse files
Files changed (1) hide show
  1. README.md +61 -27
README.md CHANGED
@@ -10,48 +10,82 @@ pretty_name: quantem-data
10
 
11
  # quantem-data
12
 
13
- Reference electron-microscopy datasets for [quantem.live](https://github.com/bobleesj/quantem.live).
14
 
15
- Two buckets:
16
 
17
- - **`4dstem/`** — 4D-STEM acquisitions (one folder per dataset: Arina master + data chunks)
18
- - **`haadf/`** — HAADF survey images
19
 
20
- ## Download with quantem.live
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  ```python
23
  from quantem.live import io
24
- from quantem.widget import Show4DSTEM, Show2D
25
  import torch
26
 
27
- # 4D-STEM: download (cached after first time), bin to fit your GPU, browse
28
- folder = io.download("gold_512") # -> 4dstem/gold_512/
29
- data = io.load(io.discover_masters(folder)[0], det_bin=2)
30
- Show4DSTEM(torch.from_dlpack(data.data))
31
-
32
- # HAADF image
33
- Show2D(io.read_image(io.download("gold_haadf"))) # -> haadf/gold_haadf.emd
34
  ```
35
 
36
- From a terminal: `live data list` · `live data download gold_512`.
37
 
38
- ## Memory (VRAM)
39
 
40
- The 4D-STEM sets here are 512x512x192x192. Peak VRAM on load is about **1.4x the
41
- loaded array**, set by `det_bin` (bins the detector on the fly):
42
 
43
- | det_bin | detector | loaded | peak VRAM | fits 16 GB? |
44
  |---|---|---|---|---|
45
- | 1 | 192x192 | 18 GB | ~25 GB | no |
46
- | **2** | 96x96 | 4.5 GB | **~6.9 GB** | **yes** |
47
- | 4 | 48x48 | 1.1 GB | ~2.2 GB | yes |
48
- | 8 | 24x24 | 0.3 GB | ~0.5 GB | yes (good for flipping through many) |
49
 
50
  Show4DSTEM keeps the data on the GPU; cursor interaction is ~0.03 ms/frame.
51
 
52
- ## Current datasets
53
-
54
- - `4dstem/`: gold_512, gold_30mrad1.3mx04, gold_30mrad1.3mx06, gold_30mrad1.3mx07, gold_30mrad1.3mx09
55
- - `haadf/`: gold_haadf
56
 
57
- Run `live data list` for the live set.
 
10
 
11
  # quantem-data
12
 
13
+ Reference electron-microscopy datasets for browsing and learning. Open them in your browser via [quantem.widget](https://github.com/bobleesj/quantem.widget) — **no quantem.live install needed**.
14
 
15
+ Two buckets, that's it:
16
 
17
+ - **`4dstem/`** — 4D-STEM acquisitions. `_npy_bin*` variants are pre-binned NumPy files for fast workshop / Colab demos; the originals are full Arina h5 bundles.
18
+ - **`haadf/`** — HAADF survey images.
19
 
20
+ ## Quick start — Show4DSTEM in Google Colab (or any Jupyter)
21
+
22
+ Workshop path: just `quantem.widget` from TestPyPI + `huggingface_hub`. No CUDA, no h5, no quantem.live.
23
+
24
+ ```python
25
+ !pip install -q --pre --extra-index-url https://test.pypi.org/simple/ quantem.widget huggingface_hub
26
+
27
+ import os, json, numpy as np, torch
28
+ from huggingface_hub import snapshot_download
29
+ from quantem.widget import Show4DSTEM
30
+
31
+ # Pre-binned NumPy bundle — fast download, no decompression needed.
32
+ folder = snapshot_download(
33
+ "bobleesj/quantem-data",
34
+ repo_type="dataset",
35
+ allow_patterns=["4dstem/gold_512_npy_bin8/*"],
36
+ )
37
+ asset = os.path.join(folder, "4dstem", "gold_512_npy_bin8")
38
+ data = np.load(os.path.join(asset, "data.npy")) # (512, 512, 24, 24) uint16, ~300 MB
39
+ meta = json.load(open(os.path.join(asset, "meta.json"))) # sampling + units
40
+
41
+ Show4DSTEM(torch.from_numpy(data), sampling=meta["sampling"], units=meta["units"])
42
+ ```
43
+
44
+ Drag the scan cursor in the real-space image; the CBED updates in real time. Chrome works best (WebGPU).
45
+
46
+ For HAADF use `Show2D` with `quantem.live.io.read_image` (or load the `.emd` directly with `hyperspy`).
47
+
48
+ ## Datasets
49
+
50
+ | name | kind | shape | dtype | size | use |
51
+ |---|---|---|---|---|---|
52
+ | `4dstem/gold_512_npy_bin8/` | NumPy bundle | (512, 512, 24, 24) | uint16 | ~302 MB | workshop / Colab demo |
53
+ | `4dstem/gold_512_npy_bin4/` | NumPy bundle | (512, 512, 48, 48) | uint16 | ~1.2 GB | sharper version |
54
+ | `4dstem/gold_512/` | Arina h5 (full) | (512, 512, 192, 192) | uint16 | ~5 GB | power user, full data |
55
+ | `4dstem/gold_30mrad1.3mx04` …`09` | Arina h5 (full) | smaller scans | uint16 | ~5 GB each | series demo |
56
+ | `haadf/gold_haadf.emd` | Velox EMD | (4096, 4096) | float32 | a few MB | Show2D |
57
+
58
+ Each `_npy_*` bundle ships a `meta.json` next to `data.npy`: `shape`, `dtype`, `sampling`, `units`, `bin_factor`, original source.
59
+
60
+ ## Power-user path (full data, GPU decompression)
61
+
62
+ If you have an NVIDIA GPU and want the full uncooked h5 path, install `quantem.live` (private):
63
 
64
  ```python
65
  from quantem.live import io
66
+ from quantem.widget import Show4DSTEM
67
  import torch
68
 
69
+ folder = io.download("gold_512") # 4dstem/gold_512/
70
+ result = io.load(io.discover_masters(folder)[0], det_bin=2) # GPU decompression
71
+ Show4DSTEM(torch.from_dlpack(result.data))
 
 
 
 
72
  ```
73
 
74
+ Same data, full Arina h5, decompressed on the GPU. Faster + full resolution.
75
 
76
+ ## Memory (VRAM) for the full h5
77
 
78
+ The Arina h5 sets are 512×512×192×192. Peak VRAM is about 1. the loaded array; control with `det_bin`:
 
79
 
80
+ | `det_bin` | detector | loaded | peak VRAM | fits 16 GB? |
81
  |---|---|---|---|---|
82
+ | 1 | 192×192 | 18 GB | ~25 GB | no |
83
+ | **2** | 96×96 | 4.5 GB | **~6.9 GB** | **yes** |
84
+ | 4 | 48×48 | 1.1 GB | ~2.2 GB | yes |
85
+ | 8 | 24×24 | 0.3 GB | ~0.5 GB | yes (good for flipping through many) |
86
 
87
  Show4DSTEM keeps the data on the GPU; cursor interaction is ~0.03 ms/frame.
88
 
89
+ ## Licence
 
 
 
90
 
91
+ CC-BY-4.0. Cite quantem.live / quantem.widget if you use these in a publication.