Skip to content

ShowPtycho: offline HTML + folder export (kernel-less share, WebGPU play) #186

Description

@bobleesj

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:

  1. In a notebook: finish optimize / explore / star calibrations
  2. w.export_html(...) and/or w.export_sidecar(out_dir)
  3. Ship a folder (or single HTML when small enough)
  4. 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

  • ShowPtycho.export_html and/or export_sidecar documented next to Show3D/Show4DSTEM
  • Kernel-less Chrome open shows real phase/FFT (not blank); scrub works
  • Multi-GB path uses folder + Range fetch (not multi-GB single ArrayBuffer)
  • No silent display_bin / downsample unless user opts in and it is announced
  • Phase B optional: WebGPU adapter confirmed real hardware before claiming live drag offline

Refs

  • Show3D sidecar skill/docs: export_sidecar, offline_stack.u8, Range server
  • Show4DSTEM offline WebGPU HTML
  • Second-brain: ShowPtycho offline + 5D defocus notebook play

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions