NextStatNextStat

WASM Playground

NextStat compiles to a 454 KB WebAssembly binary, enabling full statistical inference entirely in the browser. No Python, no server, no installation.

How It Works

The playground compiles the core inference engine (ns-inference + ns-translate) to wasm32-unknown-unknown using wasm-bindgen. The resulting WASM module runs in any modern browser.

Running Locally

# Prerequisites
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.108

# Build and serve
make playground-build-wasm
make playground-serve

Open http://localhost:8000/ and drag & drop a workspace.json file.

Operations

  • Brazil Band — asymptotic CLs upper limit scan with ±1σ/±2σ expected bands
  • Profile Scan — −2Δln L likelihood curve
  • MLE Fit — maximum likelihood estimates with Hessian uncertainties
  • Hypo Test — single-point CLs p-value
  • GLM Regression — linear, logistic, and Poisson regression via L-BFGS-B
  • Histogram Table Ingest — build a pyhf workspace from JSON histogram rows (channel/sample/yields/stat_error)
  • Mass Scan (Type B) — ATLAS/CMS-style 95% CL exclusion plot (μ_up vs signal peak)

Features

  • Drag & drop any pyhf JSON workspace or load from 7 guided examples
  • Auto-run on tab switch — results update instantly when switching operations
  • Filtered dropdown — only compatible examples shown per operation tab
  • 454 KB WASM binary (opt-level=z, fat LTO, wasm-opt -Oz)
  • No server required — computation happens entirely in the browser
  • ⌘+Enter keyboard shortcut for quick runs

Limitations

  • Single-threaded (no Rayon in WASM)
  • Asymptotic tests only (no toy generation)
  • No ROOT file I/O (browser sandbox)