bobleesj commited on
Commit
b30a28c
·
verified ·
1 Parent(s): 3002eca

Organize shared data guidance by tutorial workflow

Browse files
Files changed (1) hide show
  1. README.md +75 -236
README.md CHANGED
@@ -8,232 +8,70 @@ tags:
8
  pretty_name: quantem-data
9
  ---
10
 
11
- # quantem-data
12
-
13
- This repo is currently used primarily by
14
- **[quantem.widget](https://github.com/electronmicroscopy/quantem.widget)**
15
- (tutorial notebooks and `quantem.widget.datasets`). Other QuantEM packages
16
- may use it later. Keys, the checker, and these instructions can grow as
17
- we take more Community pull requests. Use the current required keys for
18
- new PRs.
19
-
20
- Public electron-microscopy data. MIT license. Downloads need no token.
21
- This page is the upload and download protocol.
22
-
23
- ## Download
24
-
25
- ```python
26
- from quantem.widget.datasets import show4dstem_gold
27
-
28
- ds = show4dstem_gold(size="small")
29
- ```
30
-
31
- Notebook: [Example Data](https://github.com/electronmicroscopy/quantem.widget/blob/main/docs/tutorials/download_data.ipynb).
32
-
33
- ## Add data (Hugging Face pull request)
34
-
35
- Anyone with a Hugging Face account can add data. We follow a pull request
36
- process. Do not use `quantem.widget.io.upload`.
37
-
38
- Downloads need no token. Opening a pull request does. Create an account,
39
- then a token at
40
- [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens).
41
- Use a **Write** token (classic). A **Read** token can download; it cannot
42
- open a PR. A fine-grained token also works if `--create-pr` is allowed on
43
- a public dataset. You do not need collaborator access to this repo.
44
-
45
- ```bash
46
- pip install huggingface_hub # skip if `hf` is already on PATH
47
- hf auth login
48
- ```
49
-
50
- Paste the token. The prompt hides it. When asked `Add token as git
51
- credential? [y/N]`, answer `n`. `hf upload` reads
52
- `~/.cache/huggingface/token`. You do not need a git credential helper.
53
- Ignore any hint to run `git config --global credential.helper store`.
54
-
55
- ```bash
56
- hf auth whoami
57
- ```
58
-
59
- That should print your username. If you already logged in with a Read
60
- token, run `hf auth login --force` and paste a Write token. If
61
- `--create-pr` returns 403 after a valid login, the token is Read or the
62
- fine-grained scopes omit Community PRs; make a Write token and login
63
- again. On SSH (no browser on that machine), paste a token. Do not use the
64
- browser login unless the browser and `hf` run on the same machine. Do not
65
- commit the token.
66
-
67
- A PR is the data file(s) plus one `meta.json`. Example already on the hub
68
- (2 files):
69
-
70
- ```text
71
- widget-tutorials/show4dstem/gold-512-bin4/full/data.npy
72
- widget-tutorials/show4dstem/gold-512-bin4/full/meta.json
73
- ```
74
-
75
- One EMD: `gold_haadf.emd` + `meta.json` (2 files). A session folder: the
76
- `.emd` files + `meta.json`.
77
-
78
- Copy this `meta.json`. Required: `name`, `source`, `date`, `sample`,
79
- `shape`, `dtype`, `permission`. Optional: `sampling`, `units`, optics.
80
- Omit a key if unknown. Do not invent a number.
81
-
82
- `shape` is `[row, col]` for an image, `[frame, row, col]` for a stack, or
83
- `[scan_row, scan_col, det_row, det_col]` for 4D-STEM. `dtype` is the NumPy
84
- name of the stored array (or of the EMD image). Examples already on this
85
- repo:
86
-
87
-
88
- | Data | `shape` | `dtype` |
89
- | ------------------------- | -------------------- | -------- |
90
- | 2D HAADF (`gold-haadf`) | `[4096, 4096]` | `uint16` |
91
- | 4D-STEM (`gold-512-bin4`) | `[512, 512, 48, 48]` | `uint16` |
92
- | One EMD HAADF | `[4096, 4096]` | `uint16` |
93
-
94
-
95
- Processed float data uses `"float32"`. Read both values from the file
96
- (`arr.shape`, `arr.dtype`, or the EMD image) and copy them into
97
- `meta.json`.
98
-
99
- Replace every placeholder in this example:
100
-
101
- ```json
102
- {
103
- "name": "<public dataset name>",
104
- "source": "<public-facing microscope, facility, and acquisition description>",
105
- "date": "<YYYY-MM-DD>",
106
- "sample": "<sample description>",
107
- "shape": [512, 512, 48, 48],
108
- "dtype": "uint16",
109
- "permission": {
110
- "received": true,
111
- "from": ["<person who granted permission>"],
112
- "collectors": ["<data collector>"],
113
- "date": "<YYYY-MM-DD>"
114
- },
115
- "sampling": [0.5, 0.5, 1.84, 1.84],
116
- "units": ["A", "A", "mrad", "mrad"],
117
- "voltage_kV": 300,
118
- "semiangle_mrad": 30,
119
- "camera_length_mm": 91
120
- }
121
- ```
122
-
123
- `source` is a public-facing microscope, facility, and acquisition description;
124
- omit local paths and non-public filenames. `date` is the acquisition day
125
- (`YYYY-MM-DD`). `permission.received` must be `true`. `from` is who granted
126
- the share (one name or several). `collectors` is who used the instrument
127
- (one name or several). `permission.date` is when that share was granted.
128
-
129
- ```bash
130
- python -m check_meta ./gold-512-bin4
131
- hf upload bobleesj/quantem-data ./gold-512-bin4 \
132
- widget-tutorials/show4dstem/gold-512-bin4/full \
133
- --repo-type dataset --create-pr
134
- ```
135
-
136
- Run `python -m check_meta` from a checkout of this dataset so the
137
- `check_meta/` package is importable. `./gold-512-bin4` is your local
138
- folder (`data.npy` + `meta.json`). The last `hf upload` path is the
139
- folder on this repo. The hub path is
140
- `widget-tutorials/<widget>/<name>/<size>/`. For a new ShowBragg set that
141
- would be `widget-tutorials/showbragg/<name>/full`. Size is `small`,
142
- `medium`, `large`, or `full`. Use `widget-tutorials/shared/` only when
143
- more than one widget will read the same files.
144
-
145
- `python -m check_meta` must print `ok` or do not open the PR. Resume a stopped
146
- upload with `--revision refs/pr/N` (do not pass `--create-pr` again).
147
- Merge is on the
148
- [Community tab](https://huggingface.co/datasets/bobleesj/quantem-data/discussions).
149
-
150
- ### Coding agents
151
-
152
- A coding agent can open the Community pull request. The human creates the
153
- Write token and attests permission. The agent does not invent
154
- `permission.*`, `sampling`, or optics. The agent does not run
155
- `hf auth login` (that prompt is interactive). The agent does not write the
156
- token into a repository file.
157
-
158
- ```bash
159
- # human already ran `hf auth login` or exported HF_TOKEN (Write)
160
- hf auth whoami
161
- hf download bobleesj/quantem-data --repo-type dataset \
162
- --include "check_meta/**" --include "templates/meta.json" \
163
- --local-dir ./quantem-data-tools
164
- export PYTHONPATH="$PWD/quantem-data-tools${PYTHONPATH:+:$PYTHONPATH}"
165
- python -m check_meta ./gold-512-bin4
166
- hf upload bobleesj/quantem-data ./gold-512-bin4 \
167
- widget-tutorials/show4dstem/gold-512-bin4/full \
168
- --repo-type dataset --create-pr \
169
- --commit-message "add show4dstem gold-512-bin4 full tutorial data"
170
- ```
171
-
172
- `hf auth whoami` must print a username. If it fails or `--create-pr`
173
- returns 403, stop and ask the human for a Write token (`export HF_TOKEN=...`).
174
- If `python -m check_meta` is not `ok`, stop. After the upload, give the
175
- human the Community URL. Do not merge.
176
-
177
- Copy this prompt into your coding agent. Replace every placeholder before
178
- submitting it. Do not paste a Hugging Face token into the prompt.
179
-
180
- ```text
181
- Add these files to the public Hugging Face dataset bobleesj/quantem-data
182
- as a Community pull request.
183
-
184
- Local folder:
185
- <path to a folder that already contains the data files and will get meta.json>
186
-
187
- Target hub path:
188
- widget-tutorials/<widget-or-shared>/<name>/<size>/
189
-
190
- Permission (required; do not invent):
191
- - I collected this data myself: <yes/no>
192
- - permission.from: <name or list>
193
- - permission.collectors: <name or list>
194
- - permission.date: <YYYY-MM-DD>
195
- - I have written permission from the collector: <yes, or "I collected it">
196
-
197
- Follow the current Add data and Coding agents instructions on this dataset
198
- card. Do not use quantem.widget.io.upload. Do not commit .npy or .emd into
199
- electronmicroscopy/quantem.widget.
200
-
201
- 1. Confirm `hf auth whoami` prints a username. If it fails, stop and ask me
202
- to create a Write token and run `hf auth login`, or export `HF_TOKEN`.
203
- Do not run an interactive login yourself or write the token into a repo.
204
- 2. Download the checker and template, then copy the template into the folder:
205
-
206
- hf download bobleesj/quantem-data --repo-type dataset \
207
- --include "check_meta/**" --include "templates/meta.json" \
208
- --local-dir ./quantem-data-tools
209
- cp ./quantem-data-tools/templates/meta.json <folder>/meta.json
210
-
211
- 3. Fill every required field in `<folder>/meta.json` from the files and the
212
- permission lines above. Read shape and dtype from the array or EMD. Omit
213
- optional values when unknown; do not invent them. Do not put a local path
214
- or credential in `meta.json`. Validate it:
215
-
216
- export PYTHONPATH="$PWD/quantem-data-tools${PYTHONPATH:+:$PYTHONPATH}"
217
- python -m check_meta <folder>
218
-
219
- Stop unless validation prints `ok`.
220
- 4. Open the Community pull request:
221
-
222
- hf upload bobleesj/quantem-data <folder> \
223
- widget-tutorials/<widget-or-shared>/<name>/<size>/ \
224
- --repo-type dataset --create-pr \
225
- --commit-message "add <widget> <name> <size> tutorial data"
226
- 5. Give me the Community URL. Do not merge. Open a GitHub PR only if a named
227
- loader is also needed in `quantem.widget.datasets`; that PR waits until
228
- this Hugging Face PR merges. A new widget is discuss-first.
229
- ```
230
-
231
- If a notebook should call `quantem.widget.datasets`, open a GitHub PR after
232
- this one merges:
233
- [Contribute tutorial data](https://github.com/electronmicroscopy/quantem.widget/blob/main/docs/tutorials/contribute_data.md).
234
-
235
- Colab: [Show4DSTEM](https://colab.research.google.com/gist/bobleesj/54864ce5b2a6f0a4fd5ae1e5d5719b45/show4dstem_colab.ipynb)
236
- · [Workshop v1](https://colab.research.google.com/gist/bobleesj/a05a90185c6cddbb331342cae6d7e9c1/berk_workshop_v1.ipynb)
237
 
238
  ## Acquisition parameters
239
 
@@ -253,15 +91,16 @@ The 20260423 drift session optics are confirmed via the session HAADF EMD.
253
 
254
  ✓ = confirmed via EMD/yaml. `(op)` = operator pattern, not file-certified.
255
 
256
- ## License
257
-
258
- Files on this repo are published under **MIT**.
259
 
260
- **You must have explicit written permission from the person who collected
261
- the data before you open a pull request**, unless you collected the data
262
- yourself. Put that receipt in `meta.json` (`permission.received`,
263
- `permission.from`, `permission.collectors`, `permission.date`). If you
264
- collected it yourself, set `from` and `collectors` to your name.
265
 
266
- Do not open a pull request without that permission. `python -m check_meta`
267
- must print `ok`.
 
 
 
 
 
 
8
  pretty_name: quantem-data
9
  ---
10
 
11
+ # QuantEM shared data
12
+
13
+ Reusable public inputs for QuantEM and Denova tutorials. Downloads need no token.
14
+ This repository stores scientific input data, minimal data cards, numerical
15
+ metadata, checksums and existing catalog previews. Scientific code, notebooks,
16
+ models, benchmarks and result reports belong in the owning software repository.
17
+
18
+ ## Find the input for your tutorial
19
+
20
+ | Purpose | Input folder | Source tutorial |
21
+ | --- | --- | --- |
22
+ | Show1D reconstruction comparison | `widget/ducky` | [Show1D](https://github.com/electronmicroscopy/quantem.widget/blob/main/docs/tutorials/show1d.ipynb) |
23
+ | Show2D/Show3D survey session | `widget/gold_session` | [Live folder watching](https://github.com/electronmicroscopy/quantem.widget/blob/main/docs/tutorials/watch_folder.ipynb) |
24
+ | Show2D and Show3D gold image | `haadf/gold_haadf_npy` | [Example data](https://github.com/electronmicroscopy/quantem.widget/blob/main/docs/tutorials/download_data.ipynb) |
25
+ | Show4DSTEM reduced gold scan | `4dstem/gold_128_npy_bin8` | [Show4DSTEM](https://github.com/electronmicroscopy/quantem.widget/blob/main/docs/tutorials/show4dstem.ipynb) |
26
+ | Calibrated 4D-STEM denoising | `denoise/simulated_au_nanobeam_pg_dose1` | [Denova tutorials](https://github.com/bobleesj/denoise/tree/main/docs/tutorials) |
27
+
28
+ The shared HAADF image is stored once; size choices are local loader previews.
29
+ The reduced gold diffraction input similarly provides one source for explicit
30
+ scan strides. These choices do not imply a new detector calibration or a smaller
31
+ network transfer. Keep HDF5 masters and linked shards together. Retain metadata
32
+ and checksums beside their inputs.
33
+
34
+ `quantem.data` owns qualified dataset retrieval and immutable revision pins.
35
+ `quantem.gpu` loads native detector acquisitions. `quantem.widget` provides the
36
+ viewer helpers; Denova owns calibration and denoising. The Ducky monitor and the
37
+ survey-image session are viewer inputs, not raw 4D-STEM acquisitions for the GPU
38
+ loader. Follow the compatible source tutorial for each format.
39
+
40
+ ## Migration and reproducibility
41
+
42
+ The `widget/` paths add destinations for already-public inputs. Existing source
43
+ paths remain available during the coordinated transition. No unique numerical
44
+ input is added, removed, resimulated or recompressed by this step. Shared
45
+ `haadf/`, `4dstem/` and `denoise/` inputs remain in place.
46
+
47
+ Older notebooks use `widget-tutorials/` or `survey/`. Reproduce them with their
48
+ matching software and revision `475260be22b5a00704f58382517a44aff94e252e`. New examples must use the qualified ID
49
+ and exact revision recorded by their compatible tutorial. Do not combine a
50
+ historical revision with a path first introduced later. A short name may become
51
+ ambiguous while aliases coexist; use its full folder ID. Qualified/revision API
52
+ support currently requires the coordinated development checkout until a tested
53
+ release is identified.
54
+
55
+ Legacy source-only files remain temporarily during the transition; they are not
56
+ maintained tutorial entry points. Current notebooks and contribution tools live
57
+ in [quantem.widget](https://github.com/electronmicroscopy/quantem.widget),
58
+ [quantem.data](https://github.com/bobleesj/quantem.data), and
59
+ [Denova](https://github.com/bobleesj/denoise).
60
+
61
+ ## Provenance and credit
62
+
63
+ Ducky is synthetic. Original simulation tutorial: **Georgios Varnavides**,
64
+ [*Trademark ducky dataset* (October 23, 2025)](https://github.com/electronmicroscopy/quantem-tutorials/blob/dbadc111734641226ab0454ed988feaf018e65c4/simulation_notebooks/ducky-dataset.ipynb).
65
+ The viewer files contain subsequent reconstruction results; see the Ducky data
66
+ card for the separate source-run record and limits of atomic-model provenance.
67
+
68
+ The synthetic Au nanobeam example was inspired by experimental data from
69
+ **Serin Lee and Andrew Barnum**,
70
+ [DOI 10.5281/zenodo.18167694](https://doi.org/10.5281/zenodo.18167694).
71
+ It contains no experimental measurements and uses an assumed Poisson–Gaussian
72
+ recipe, not a validated ARINA detector calibration. Consult its unchanged card
73
+ and metadata for scope, units and attribution. This credit does not identify the
74
+ collectors of unrelated gold acquisitions in the repository.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  ## Acquisition parameters
77
 
 
91
 
92
  ✓ = confirmed via EMD/yaml. `(op)` = operator pattern, not file-certified.
93
 
94
+ ## Contributions and license
 
 
95
 
96
+ The repository card declares MIT. Preserve applicable source notices and any
97
+ dataset-specific provenance or licensing qualifications; this label does not
98
+ establish an otherwise unverified atomic-model license.
 
 
99
 
100
+ New contributions require actual permission and accurate metadata. Record the
101
+ collector, sharing permission, acquisition date, shape, dtype and known
102
+ calibration; do not invent absent values. The contribution validator and template
103
+ are maintained in the `quantem.data` source repository, not distributed as a
104
+ Python package inside this dataset. Existing legacy metadata is not rewritten
105
+ into a new universal schema. Follow the owning repository's contribution guide
106
+ and review the exact data-file list before submitting a change.