Interactive tokamak shot dashboard
Project description
NiceShot!
An interactive dashboard for exploring tokamak plasma shot data. Point it at a shot-statistics file and get an instant browser UI for slicing, visualising, and comparing shots.
Features
- Projection — UMAP or PCA scatter of every shot, coloured by any column. Backed by a content-hash cache so reloads are instant.
- Pairwise scatter — any two numeric columns plotted against each other, with linear/log axis toggles.
- Correlation — interactive Pearson correlation heatmap for any selection of numeric columns.
- Data table — sortable, virtualized table with shot-ID search, cross-highlight with scatter plots, and CSV export.
- Time traces — per-shot signal plots loaded on click. Supports local parquet/CSV files, live UDA, and live SAL backends.
- Filters — up to 6 simultaneous column filters combinable with AND / OR logic. All plots update live.
- Clustering — run K-Means, DBSCAN, or Agglomerative clustering on any set of numeric columns. Results colour the scatter plots immediately; clusters can be given human-readable class names.
- Cluster centroid traces — mean time-series per cluster, computed automatically after clustering and relabelled live as class names change.
- Outlier detection — flag anomalous shots with Isolation Forest or Local Outlier Factor. Outliers are highlighted in red on the scatter plots and sample traces are loaded automatically.
- CSV export — download the full data table with
cluster_id,cluster_namecolumns appended when clustering has been run. - SHAP decision plots — per-shot feature attribution rendered inline (optional, requires
--shap-data). - Reference graph — overlay the full reference-shot lineage on any scatter plot (optional, requires
reference_shot_colin config). - Semantic search — find shots similar to a selected one via nearest-neighbour search in feature space. Results are highlighted on the scatter plots with gold ring markers.
- Extensible backends — add support for new data sources (MDSplus, HDF5, custom APIs, …) by subclassing
TraceBackendorShotDataBackendand registering viaplugins:in config.
Requirements
Python ≥ 3.12
Install
pip install nice-shot
pip install "nice-shot[shap]" # + SHAP plots, xarray, matplotlib
Run
nice-shot --shot-data path/to/shot_stats.parquet
Open http://localhost:8050 in a browser.
By default nice-shot runs under gunicorn with 4 worker processes, which supports multiple concurrent users. On first run, UMAP/PCA is computed in the master process and cached; subsequent starts are instant.
For local development with hot-reload use --debug:
nice-shot --shot-data path/to/shot_stats.parquet --debug
Common flags
| Flag | Default | Description |
|---|---|---|
--shot-data PATH |
outputs/shot_stats.parquet |
Shot statistics file (.csv or .parquet) |
--config PATH |
nice_shot/config.yaml |
YAML config file |
--data-dir PATH |
data/mastu/ |
Directory of per-shot files (parquet backend) |
--projection PATH |
— | Pre-computed 2-D embedding; skips UMAP/PCA entirely |
--shap-data PATH |
— | SHAP values NetCDF (.nc); enables the SHAP tab |
--workers N |
4 |
Gunicorn worker processes (ignored in --debug mode) |
--port PORT |
8050 |
Port to listen on |
--debug |
off | Use the single-process Flask dev server instead of gunicorn |
Configuration
Edit nice_shot/config.yaml (or pass --config to point elsewhere):
backend: parquet # parquet | uda | sal
signals: # columns shown in the time-trace panel
- ip
- ne
- dalpha
time_window:
min_time: 0.0
max_time: 1.0
projection_method: umap # umap | pca
umap_features: # omit to use all numeric columns
- ip_max
- ne_max
- bt_max
reference_shot_col: reference__number # omit to hide the feature
Data
Shot statistics file (--shot-data) — a flat .parquet or .csv with one row per shot. The shot ID column is detected automatically (shot_id, shot, pulse, number, …).
Per-shot traces (--data-dir) — one .parquet or .csv per shot, laid out as:
<data-dir>/<any-subdir>/<shot_id>.parquet
Each file needs a time column and one column per configured signal.
Pre-computed projection (--projection) — a .npy (shape (n,2) or (n,3)), .csv, or .parquet with shot ID and two coordinate columns.
SHAP values (--shap-data) — an xarray NetCDF file with shot_id and feature dimensions.
See docs/data-formats.md for full schema details.
Docs
uv run --dev zensical serve
Opens the full documentation at http://localhost:8000.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nice_shot-1.1.2.tar.gz.
File metadata
- Download URL: nice_shot-1.1.2.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9118a3a48723e9aa1f953bdbab1ffc90036179e28520cb71e242197f4a6f01a4
|
|
| MD5 |
0e877de1bc4400a936d683ed5a38b92e
|
|
| BLAKE2b-256 |
540797c562b906351ad80ab30ac7f157c55c0404191e6ac0e99fdb18771239e2
|
Provenance
The following attestation bundles were made for nice_shot-1.1.2.tar.gz:
Publisher:
publish.yml on samueljackson92/nice-shot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nice_shot-1.1.2.tar.gz -
Subject digest:
9118a3a48723e9aa1f953bdbab1ffc90036179e28520cb71e242197f4a6f01a4 - Sigstore transparency entry: 1852331628
- Sigstore integration time:
-
Permalink:
samueljackson92/nice-shot@9f8bbe1b8fb205009b748986273d920b160f08e0 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/samueljackson92
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f8bbe1b8fb205009b748986273d920b160f08e0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nice_shot-1.1.2-py3-none-any.whl.
File metadata
- Download URL: nice_shot-1.1.2-py3-none-any.whl
- Upload date:
- Size: 36.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eda7c0d245906e8b04f745b3495dee40b39d98f111ed2f1837fef2ce2652d33b
|
|
| MD5 |
2f23a5b7f364bb5b5f5d4bd2fa3820e4
|
|
| BLAKE2b-256 |
6d81bb050ad5a31c73068b67093bc5b4a306551ee2ebfd6adda162da5f376abe
|
Provenance
The following attestation bundles were made for nice_shot-1.1.2-py3-none-any.whl:
Publisher:
publish.yml on samueljackson92/nice-shot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nice_shot-1.1.2-py3-none-any.whl -
Subject digest:
eda7c0d245906e8b04f745b3495dee40b39d98f111ed2f1837fef2ce2652d33b - Sigstore transparency entry: 1852331996
- Sigstore integration time:
-
Permalink:
samueljackson92/nice-shot@9f8bbe1b8fb205009b748986273d920b160f08e0 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/samueljackson92
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f8bbe1b8fb205009b748986273d920b160f08e0 -
Trigger Event:
push
-
Statement type: