nice-shot 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nice_shot-1.0.0/LICENSE +21 -0
- nice_shot-1.0.0/PKG-INFO +143 -0
- nice_shot-1.0.0/README.md +117 -0
- nice_shot-1.0.0/nice_shot/__init__.py +0 -0
- nice_shot-1.0.0/nice_shot/app.py +2078 -0
- nice_shot-1.0.0/nice_shot/config_schema.py +32 -0
- nice_shot-1.0.0/nice_shot.egg-info/PKG-INFO +143 -0
- nice_shot-1.0.0/nice_shot.egg-info/SOURCES.txt +12 -0
- nice_shot-1.0.0/nice_shot.egg-info/dependency_links.txt +1 -0
- nice_shot-1.0.0/nice_shot.egg-info/entry_points.txt +2 -0
- nice_shot-1.0.0/nice_shot.egg-info/requires.txt +18 -0
- nice_shot-1.0.0/nice_shot.egg-info/top_level.txt +1 -0
- nice_shot-1.0.0/pyproject.toml +69 -0
- nice_shot-1.0.0/setup.cfg +4 -0
nice_shot-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Samuel Jackson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
nice_shot-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nice-shot
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Interactive tokamak shot dashboard
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: dash>=4.1.0
|
|
9
|
+
Requires-Dist: duckdb>=1.5.3
|
|
10
|
+
Requires-Dist: matplotlib>=3.10.9
|
|
11
|
+
Requires-Dist: numpy>=2.4.6
|
|
12
|
+
Requires-Dist: pandas>=3.0.3
|
|
13
|
+
Requires-Dist: plotly>=6.7.0
|
|
14
|
+
Requires-Dist: pyarrow>=24.0.0
|
|
15
|
+
Requires-Dist: pydantic>=2.13.4
|
|
16
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
17
|
+
Requires-Dist: scikit-learn>=1.8.0
|
|
18
|
+
Requires-Dist: shap>=0.49.1
|
|
19
|
+
Requires-Dist: umap-learn>=0.5.12
|
|
20
|
+
Requires-Dist: xarray>=2026.4.0
|
|
21
|
+
Provides-Extra: shap
|
|
22
|
+
Requires-Dist: matplotlib>=3.10.9; extra == "shap"
|
|
23
|
+
Requires-Dist: shap>=0.49.1; extra == "shap"
|
|
24
|
+
Requires-Dist: xarray>=2026.4.0; extra == "shap"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# NiceShot!
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- **Projection** — UMAP or PCA scatter of every shot, coloured by any column. Backed by a content-hash cache so reloads are instant.
|
|
39
|
+
- **Pairwise scatter** — any two numeric columns plotted against each other, with linear/log axis toggles.
|
|
40
|
+
- **Data table** — sortable, virtualized table with shot-ID search and cross-highlight with the scatter plots.
|
|
41
|
+
- **Time traces** — per-shot signal plots loaded on click. Supports local parquet/CSV files, live UDA, and live SAL backends.
|
|
42
|
+
- **Filters** — up to 6 simultaneous column filters combinable with AND / OR logic. All plots update live.
|
|
43
|
+
- **SHAP decision plots** — per-shot feature attribution rendered inline (optional, requires `--shap-data`).
|
|
44
|
+
- **Reference graph** — overlay the full reference-shot lineage on any scatter plot (optional, requires `reference_shot_col` in config).
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
- Python ≥ 3.12
|
|
52
|
+
- [uv](https://github.com/astral-sh/uv)
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Install
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
git clone <repo>
|
|
60
|
+
cd nice_shot
|
|
61
|
+
uv sync # core dependencies
|
|
62
|
+
uv sync --extra shap # + SHAP plots, xarray, matplotlib
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Run
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
uv run nice-shot --shot-data path/to/shot_stats.parquet
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Open **http://localhost:8050** in a browser.
|
|
74
|
+
|
|
75
|
+
On first run, UMAP/PCA is computed and cached. Subsequent starts are instant unless the data file or `umap_features` config changes.
|
|
76
|
+
|
|
77
|
+
### Common flags
|
|
78
|
+
|
|
79
|
+
| Flag | Default | Description |
|
|
80
|
+
|------|---------|-------------|
|
|
81
|
+
| `--shot-data PATH` | `outputs/shot_stats.parquet` | Shot statistics file (`.csv` or `.parquet`) |
|
|
82
|
+
| `--config PATH` | `nice_shot/config.yaml` | YAML config file |
|
|
83
|
+
| `--data-dir PATH` | `data/mastu/` | Directory of per-shot files (parquet backend) |
|
|
84
|
+
| `--projection PATH` | — | Pre-computed 2-D embedding; skips UMAP/PCA entirely |
|
|
85
|
+
| `--shap-data PATH` | — | SHAP values NetCDF (`.nc`); enables the SHAP tab |
|
|
86
|
+
| `--port PORT` | `8050` | Port to listen on |
|
|
87
|
+
| `--no-debug` | — | Disable Dash hot-reload |
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
Edit `nice_shot/config.yaml` (or pass `--config` to point elsewhere):
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
backend: parquet # parquet | uda | sal
|
|
97
|
+
|
|
98
|
+
signals: # columns shown in the time-trace panel
|
|
99
|
+
- ip
|
|
100
|
+
- ne
|
|
101
|
+
- dalpha
|
|
102
|
+
|
|
103
|
+
time_window:
|
|
104
|
+
min_time: 0.0
|
|
105
|
+
max_time: 1.0
|
|
106
|
+
|
|
107
|
+
projection_method: umap # umap | pca
|
|
108
|
+
|
|
109
|
+
umap_features: # omit to use all numeric columns
|
|
110
|
+
- ip_max
|
|
111
|
+
- ne_max
|
|
112
|
+
- bt_max
|
|
113
|
+
|
|
114
|
+
reference_shot_col: reference__number # omit to hide the feature
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Data
|
|
120
|
+
|
|
121
|
+
**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`, …).
|
|
122
|
+
|
|
123
|
+
**Per-shot traces** (`--data-dir`) — one `.parquet` or `.csv` per shot, laid out as:
|
|
124
|
+
```
|
|
125
|
+
<data-dir>/<any-subdir>/<shot_id>.parquet
|
|
126
|
+
```
|
|
127
|
+
Each file needs a `time` column and one column per configured signal.
|
|
128
|
+
|
|
129
|
+
**Pre-computed projection** (`--projection`) — a `.npy` (shape `(n,2)` or `(n,3)`), `.csv`, or `.parquet` with shot ID and two coordinate columns.
|
|
130
|
+
|
|
131
|
+
**SHAP values** (`--shap-data`) — an `xarray` NetCDF file with `shot_id` and `feature` dimensions.
|
|
132
|
+
|
|
133
|
+
See [`docs/data-formats.md`](docs/data-formats.md) for full schema details.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Docs
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
uv run --dev zensical serve
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Opens the full documentation at **http://localhost:8000**.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# NiceShot!
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **Projection** — UMAP or PCA scatter of every shot, coloured by any column. Backed by a content-hash cache so reloads are instant.
|
|
13
|
+
- **Pairwise scatter** — any two numeric columns plotted against each other, with linear/log axis toggles.
|
|
14
|
+
- **Data table** — sortable, virtualized table with shot-ID search and cross-highlight with the scatter plots.
|
|
15
|
+
- **Time traces** — per-shot signal plots loaded on click. Supports local parquet/CSV files, live UDA, and live SAL backends.
|
|
16
|
+
- **Filters** — up to 6 simultaneous column filters combinable with AND / OR logic. All plots update live.
|
|
17
|
+
- **SHAP decision plots** — per-shot feature attribution rendered inline (optional, requires `--shap-data`).
|
|
18
|
+
- **Reference graph** — overlay the full reference-shot lineage on any scatter plot (optional, requires `reference_shot_col` in config).
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
- Python ≥ 3.12
|
|
26
|
+
- [uv](https://github.com/astral-sh/uv)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
git clone <repo>
|
|
34
|
+
cd nice_shot
|
|
35
|
+
uv sync # core dependencies
|
|
36
|
+
uv sync --extra shap # + SHAP plots, xarray, matplotlib
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Run
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
uv run nice-shot --shot-data path/to/shot_stats.parquet
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Open **http://localhost:8050** in a browser.
|
|
48
|
+
|
|
49
|
+
On first run, UMAP/PCA is computed and cached. Subsequent starts are instant unless the data file or `umap_features` config changes.
|
|
50
|
+
|
|
51
|
+
### Common flags
|
|
52
|
+
|
|
53
|
+
| Flag | Default | Description |
|
|
54
|
+
|------|---------|-------------|
|
|
55
|
+
| `--shot-data PATH` | `outputs/shot_stats.parquet` | Shot statistics file (`.csv` or `.parquet`) |
|
|
56
|
+
| `--config PATH` | `nice_shot/config.yaml` | YAML config file |
|
|
57
|
+
| `--data-dir PATH` | `data/mastu/` | Directory of per-shot files (parquet backend) |
|
|
58
|
+
| `--projection PATH` | — | Pre-computed 2-D embedding; skips UMAP/PCA entirely |
|
|
59
|
+
| `--shap-data PATH` | — | SHAP values NetCDF (`.nc`); enables the SHAP tab |
|
|
60
|
+
| `--port PORT` | `8050` | Port to listen on |
|
|
61
|
+
| `--no-debug` | — | Disable Dash hot-reload |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Configuration
|
|
66
|
+
|
|
67
|
+
Edit `nice_shot/config.yaml` (or pass `--config` to point elsewhere):
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
backend: parquet # parquet | uda | sal
|
|
71
|
+
|
|
72
|
+
signals: # columns shown in the time-trace panel
|
|
73
|
+
- ip
|
|
74
|
+
- ne
|
|
75
|
+
- dalpha
|
|
76
|
+
|
|
77
|
+
time_window:
|
|
78
|
+
min_time: 0.0
|
|
79
|
+
max_time: 1.0
|
|
80
|
+
|
|
81
|
+
projection_method: umap # umap | pca
|
|
82
|
+
|
|
83
|
+
umap_features: # omit to use all numeric columns
|
|
84
|
+
- ip_max
|
|
85
|
+
- ne_max
|
|
86
|
+
- bt_max
|
|
87
|
+
|
|
88
|
+
reference_shot_col: reference__number # omit to hide the feature
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Data
|
|
94
|
+
|
|
95
|
+
**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`, …).
|
|
96
|
+
|
|
97
|
+
**Per-shot traces** (`--data-dir`) — one `.parquet` or `.csv` per shot, laid out as:
|
|
98
|
+
```
|
|
99
|
+
<data-dir>/<any-subdir>/<shot_id>.parquet
|
|
100
|
+
```
|
|
101
|
+
Each file needs a `time` column and one column per configured signal.
|
|
102
|
+
|
|
103
|
+
**Pre-computed projection** (`--projection`) — a `.npy` (shape `(n,2)` or `(n,3)`), `.csv`, or `.parquet` with shot ID and two coordinate columns.
|
|
104
|
+
|
|
105
|
+
**SHAP values** (`--shap-data`) — an `xarray` NetCDF file with `shot_id` and `feature` dimensions.
|
|
106
|
+
|
|
107
|
+
See [`docs/data-formats.md`](docs/data-formats.md) for full schema details.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Docs
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
uv run --dev zensical serve
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Opens the full documentation at **http://localhost:8000**.
|
|
File without changes
|