feat(kstar): live KSTAR rotating-mode analysis end-to-end#55
Merged
Conversation
Add magnetics.data.fetch.kstar_transport (KFE VPN + nkstar SSH tunnel) and wire fetch_shot to reach an access="mdsplus_tree" device through its own transport instead of the DIII-D omega cluster / mdsthin gateway. A tree device with no explicit sensor set defaults to its declared `arrays` (toroidal + poloidal), and its ms window is converted to seconds for the resample (KSTAR MDS time is in seconds). Fail loudly on a pull that resolves zero usable channels. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Add data/device/kstar.json (segmented since_shot model, matching diiid.json) with the MC Mirnov toroidal/poloidal arrays, saddle/flux loops, and plasma pointnames, plus kstar_mirnov_config.json (per-campaign-year angles/polarity from the /PRISM archive) and scripts/kstar/build_kstar_device.py that regenerates the device file. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ometry) Serve the rotating-mode nodes from a device's declared toroidal/poloidal arrays so KSTAR shots render end-to-end; add the poloidal-geometry plumbing (QS/poloidal nodes still 422 until poloidal theta lands — follow-up). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Make the device dropdown drive sensor sets and credential hints (KFE VPN 2FA vs DIII-D key/Duo), and render KSTAR in the rotating views. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…updates Co-Authored-By: Claude Opus 4.8 <[email protected]>
Integrate develop's NSTX/NSTX-U fetch + node genericization with the KSTAR rotating-mode work. Both branches added an MDSplus-tree device and genericized the same fetch/node paths; conflicts resolved to keep each device on its tested path: - toksearch.py: split the tree dispatch into `if _tree_transport:` (KSTAR: KFE VPN + nkstar tunnel) / `elif tree_access:` (NSTX: mdsthin-over-flux). Unified the sensor_set guard (require a set only for tree devices with no `arrays` block — NSTX; KSTAR defaults to its declared toroidal+poloidal arrays). Kept develop's device_id + per-channel channel_geometry write path. - nodes.py: hybrid channel selection — KSTAR keeps its precise `_arrays`/`_set_channels` path; NSTX + DIII-D flow through develop's `_dev_geom`/`_pick_pair_prefs`/`_array_channels` membership machinery. - app.py / api.ts: unioned the device-info fields (access, remote_capable, needs_ssh_creds, connect_note, default_shot). - PullControl.tsx: kept KSTAR's store-owned device + VPN cred UI; folded in NSTX's snapDeviceDefaults, tree-aware window/backend gating, generic copy. - conftest.py: kept both kstar_shot and nstx_shot synthetic fixtures. QS realignment: develop's early "QS is DIII-D-only" 422 guard in _prep_qs_ds supersedes KSTAR's device-specific QS channel_filter (which PR #55 already documents as a 422 follow-up). Kept the guard; renamed the KSTAR test to test_qs_is_diiid_only asserting KSTAR QS → 422. Verified: ruff/ty/pytest (254 passed, 5 skipped)/eslint/tsc/vitest/vite build all green; Playwright drove the NSTX-U render path end-to-end (Sensors geometry + Rotating modes) against a synthetic shot with zero API/console errors. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The develop→kstar_int merge kept KSTAR's passcode-only 2FA UI, which dropped develop's Duo push/passcode dropdown for the flux gateway (DIII-D / NSTX-U). Flux Duo supports push, so restore the dropdown for non-KSTAR devices: Push (sends "1") or a typed passcode, with the passcode field shown only when "Enter passcode…" is selected. KSTAR/KFE VPN keeps passcode-only (no push). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ch fix) Second develop→kstar_int sync. develop advanced with PR #53 (per-node plot image + HDF5 data export) and PR #54 (fetch EFIT tree signals via mdsip on the toksearch backend, + tree-fetch wrapper tests). Only one conflict, in toksearch.py: develop added a `server=None` param to `_fetch_toksearch` (routing EFIT tree signals over a direct mdsip connection via `_toksearch_tree_channels`) right where KSTAR's `_node_tree_map`/`_fetch_mds_tree` functions were inserted. Kept both — the KSTAR mds-tree functions and develop's new `_fetch_toksearch` signature/body — and restored the toksearch section header above it. api.ts (nodeDownloadUrl) and app.py (/download endpoint + export module) merged cleanly, carrying both sides' additions. Verified: ruff/ty/pytest (301 passed, 5 skipped)/eslint/tsc/vitest (27)/vite build all green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…relock) Third develop→kstar_int sync. develop advanced with PR #65 (rotating-live wiring: 2-D Gaussian pre-smoothing, download-500 hardening, heatmap null-cell handling) and PR #46 (gui-sensors: device-agnostic coil overlay, saddle-loop tilt). Only one conflict — uv.lock — since pyproject.toml is identical on both sides; resolved by taking develop's lockfile and regenerating with `uv lock` (135 packages, `uv lock --check` clean). app.py, nodes.py, and test_nodes.py auto-merged. Verified: ruff/ty/pytest (312 passed, 5 skipped)/eslint/tsc/vitest (29)/vite build all green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Integrates KSTAR into the fetch → process → service → GUI path. Rotating-mode
(MODESPEC) analysis now works end-to-end against live KSTAR shots (e.g. 42477):
mode_number/spectrogram/coherence/phase_fitall serve real data.Rebased onto latest
develop(merges cleanly with thenetwork.pyfetch refactor andQS-correctness tests) and squashed into 5 logical commits.
What's included
kstar_transport(KFE VPN + nkstar SSH tunnel);fetch_shotroutes an
access="mdsplus_tree"device through its own transport (never the omegacluster), defaults a tree device with no sensor set to its declared
arrays(toroidal + poloidal), converts the ms window to seconds for the resample, and fails
loudly on a zero-channel pull.
data/device/kstar.json(segmentedsince_shotmodel matchingdiiid.json) +kstar_mirnov_config.json(per-year archive angles/polarity) +scripts/kstar/build_kstar_device.pygenerator.rotating views.
hints), KSTAR in the rotating views.
Known follow-up (not a regression)
QS / poloidal nodes still return 422 for KSTAR — the poloidal Mirnov θ geometry isn't
populated yet. Rotating analysis is unaffected.
Verification
uv run pytest→ 237 passed, 2 skippeduv run ruff format --check .→ clean;uv run ruff check .→ cleannpm --prefix gui/web test→ 24 passed🤖 Generated with Claude Code