Skip to main content

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.

NiceShot! dashboard


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, live SAL, and FAIR MAST (Zarr/netCDF, local or remote) 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.
  • Classification — train a Gradient Boosting, Random Forest, or Gaussian Process model on a target column and any set of numeric features. Predicted labels colour the scatter plots, and an optional decision-surface background shows the predicted probability of a chosen class. See docs/classification.md.
  • CSV export — download the full data table with cluster_id, cluster_name columns appended when clustering has been run, and label plus per-class probability columns when classification has been run.
  • SHAP decision plots — per-shot feature attribution rendered inline, for a supplied SHAP file or for a trained classifier (optional, requires --shap-data or a trained model).
  • Reference graph — overlay the full reference-shot lineage on any scatter plot (optional, requires reference_shot_col in config).
  • Lineage changes — see which variables changed between a shot and the shots before it in the same reference lineage. Shows a ranked summary of every variable, a colour-coded history table, a lineage tree, the operator's notes, and sparklines (optional, requires reference_shot_col in 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.
  • Long-format files — point NiceShot at a table with one row per (shot, variable) and pick the variable from a header dropdown. Only the selected variable's rows are read, and the projection is computed for that variable alone.
  • Extensible backends — add support for new data sources (MDSplus, HDF5, custom APIs, …) by subclassing TraceBackend or ShotDataBackend and registering via plugins: in config.

Requirements

Python ≥ 3.12


Install

pip install nice-shot
pip install "nice-shot[shap]"       # + SHAP plots, xarray, matplotlib

Run

nice-shot path/to/shot_stats.parquet

SHOT_DATA is the only required argument — everything else has a default. 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 path/to/shot_stats.parquet --debug

Common flags

Flag Default Description
SHOT_DATA — (required) 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

Config-backed flags

Every option in nice_shot/config.yaml also has a CLI flag of the same name. An explicit CLI flag overrides the config file, which overrides the built-in default:

Flag Config field
--backend NAME backend
--signals SIGNAL [SIGNAL ...] signals
--min-time SECONDS time_window.min_time
--max-time SECONDS time_window.max_time
--timebase-hz HZ uda.timebase_hz
--projection-method {umap,pca} projection_method
--variable-column NAME variable_column
--n-components N projection_options.n_components
--random-state N projection_options.random_state
--n-neighbors N projection_options.n_neighbors
--min-dist F projection_options.min_dist
--metric NAME projection_options.metric
--umap-features COLUMN [COLUMN ...] umap_features
--umap-exclude-features COLUMN [COLUMN ...] umap_exclude_features
--reference-shot-col NAME reference_shot_col
--plugins MODULE [MODULE ...] plugins
--backend-option KEY=VALUE (repeatable) backend_options (merged per-key)

Run nice-shot --help for full descriptions.


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

projection_options:     # hyper-parameters of the projection
  n_components: 2       # the plots draw the first two
  n_neighbors: 15       # umap only
  min_dist: 0.1         # umap only

umap_features:          # omit to use all numeric columns
  - ip_max
  - ne_max
  - bt_max

reference_shot_col: reference__number   # omit to hide the feature

Any of these can be overridden for a single run with the matching CLI flag — see Config-backed flags above.

Most of them can also be changed while the app runs, from the Configuration tab. Those changes apply to your browser only, and a restart returns to the config file — see Configuration tab.


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.

Metadata

Release files for nice-shot 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nice-shot 1.2.0
File Size Uploaded Provenance Actions
nice_shot-1.2.0.tar.gz 163.8 kB With provenance Details for nice_shot-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nice-shot 1.2.0
File Interpreter ABI Platform Actions
nice_shot-1.2.0-py3-none-any.whl Python 3 none any Details for nice_shot-1.2.0-py3-none-any.whl

Total release size: 274.0 kB

Release files / nice_shot-1.2.0.tar.gz

Download URL nice_shot-1.2.0.tar.gz
Size 163.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d370a8f04417290ea8dd719de0e20c9a5c167ba4812f314ae3724fcf841f223f
BLAKE2b-256 checksum
How to use checksums
61b8bcdf21b18e5016e166951012ad5e4dc56c84e343eae129373f3d1e852c04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / nice_shot-1.2.0-py3-none-any.whl

Download URL nice_shot-1.2.0-py3-none-any.whl
Size 110.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25ecf856179046845bed6c7c9c920aa509313c0020e25eddc9b42a8746634ae2
BLAKE2b-256 checksum
How to use checksums
95235188b2ebd52b95d9dbe58b37dbab0539a5901b9c41c284bc9ebea3895abb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for nice-shot 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nice_shot-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page