Why
Collaborators (and future-you) should open a finished ShowPtycho session without re-running a notebook or attaching a Python/CUDA kernel: scrub phase/FFT, try locked calibrations, optionally tweak defocus if the math runs in-browser.
Same product shape as:
- Show3D
export_sidecar(out_dir) → index.html + data + manifest (Range-fetch friendly)
- Show4DSTEM offline WebGPU HTML (
export_html / quantem show4dstem --html)
Today ShowPtycho is live-kernel only (anywidget + Python GPU for drag/commit). No export_html / export_sidecar.
Ask
Add export + sidecar for ShowPtycho so anyone can:
- In a notebook: finish optimize / explore / star calibrations
w.export_html(...) and/or w.export_sidecar(out_dir)
- Ship a folder (or single HTML when small enough)
- Open in Chrome over HTTP and play — no Python
Suggested phases
Phase A — display-first offline (ship first)
- Bake what the user already computed: phase, amplitude, FFT products, probe, locked
PtychoCalibration / stars, time index if 5D
- Thin
index.html + on-disk arrays (prefer folder export for multi-frame / full-res; single-file only when safe size)
- Scrub frames, flip starred aberrations as precomputed views (or switch among baked product stacks)
- Match house patterns:
manifest.json, Range-capable serve docs, no silent binning
Phase B — WebGPU live math (the “oh my goodness” path)
- Port the interactive path that currently hits the Python kernel (BF-subsampled phase/FFT while dragging C10/C12/…, full recon on commit) to browser WebGPU / WGSL
- Offline HTML can then re-run free-SSB-style abberation scrub without CUDA host
- Fall back gracefully if WebGPU adapter missing
Phase C — 5D / series (later, related)
- Time series + shared vs per-frame defocus products
- Ties to joint-probe / defocus-drift science work; do not block Phase A
Package boundary (do not put WGSL in quantem.gpu)
| Piece |
Package |
| Offline export API, HTML shell, JS UI, scrub |
quantem.widget |
| WGSL / browser WebGPU compute for offline recompute |
quantem.widget (same as Show4DSTEM offline WebGPU) |
| Python CUDA/CuPy/torch SSB + cal for live notebooks |
quantem.gpu (called by live kernel / ShowPtycho online) |
quantem.gpu is Python multi-backend compute. WGSL runs in Dawn/Chrome, not in the Python process. quantem.gpu already documents backendless WebGPU paths as living elsewhere (export_html style). Keep that split: math source of truth in gpu for Python; browser port of interactive subset in widget.
Acceptance
Refs
- Show3D sidecar skill/docs:
export_sidecar, offline_stack.u8, Range server
- Show4DSTEM offline WebGPU HTML
- Second-brain: ShowPtycho offline + 5D defocus notebook play
Why
Collaborators (and future-you) should open a finished
ShowPtychosession without re-running a notebook or attaching a Python/CUDA kernel: scrub phase/FFT, try locked calibrations, optionally tweak defocus if the math runs in-browser.Same product shape as:
export_sidecar(out_dir)→index.html+ data + manifest (Range-fetch friendly)export_html/quantem show4dstem --html)Today
ShowPtychois live-kernel only (anywidget + Python GPU for drag/commit). Noexport_html/export_sidecar.Ask
Add export + sidecar for
ShowPtychoso anyone can:w.export_html(...)and/orw.export_sidecar(out_dir)Suggested phases
Phase A — display-first offline (ship first)
PtychoCalibration/ stars, time index if 5Dindex.html+ on-disk arrays (prefer folder export for multi-frame / full-res; single-file only when safe size)manifest.json, Range-capable serve docs, no silent binningPhase B — WebGPU live math (the “oh my goodness” path)
Phase C — 5D / series (later, related)
Package boundary (do not put WGSL in quantem.gpu)
quantem.gpuis Python multi-backend compute. WGSL runs in Dawn/Chrome, not in the Python process.quantem.gpualready documents backendless WebGPU paths as living elsewhere (export_htmlstyle). Keep that split: math source of truth in gpu for Python; browser port of interactive subset in widget.Acceptance
ShowPtycho.export_htmland/orexport_sidecardocumented next to Show3D/Show4DSTEMdisplay_bin/ downsample unless user opts in and it is announcedRefs
export_sidecar,offline_stack.u8, Range server