Repository navigation
Compare tab, plasma-signal strip, per-n mode amplitude, Ip-flattop cut-off - #95
Merged
J-Chiriboga merged 1 commit intoOct 9, 2026
Conversation
Compare tab: the rotating spectrogram (n-map or log power), n(t), per-|n| mode amplitude, the QS phi-t contour / amplitude / phase and the selected plasma signals stacked on one shared time axis, with user annotations (v-lines, spans, h-levels, points; persisted per shot, JSON import/export) and a drag/arrow panel order. It plots the params last run in the Rotating and QS tabs (store.rotParams / qsParams), else their defaults; the shared trace builders move to lib/plotTraces.ts. Plasma-signal strip above every tab: Ip / Bt / kappa chips plus any coil or probe channel in the shot file, stacked on the time axis with the cursor. Shared time axis: store.timeRange links the strip, the QS traces, the rotating spectrogram and time tracks, and Compare; zoom any of them and the rest follow; double-click or the strip's reset restores the full range. Rotating mode amplitude: new mode_amplitude node and card, one trace per toroidal |n| (core mode_shape.mode_amplitude_by_n). Each (t, f) cell counts only toward its best-fit n, so a strong n=1 does not echo into n=2/3 on the unevenly spaced DIII-D array. Ip flattop cut-off: core plasma.ip_flattop (smoothed |Ip| >= 95 % of peak); with cut_flattop=1 the QS fit window, the rotating tracks and the (t, f) maps stop at the flattop end. Toggled from the strip. Plot: optional onDoubleClick (single clicks held 320 ms so a cursor move can't swallow a double-click), and unmount purges only after an in-flight Plotly.react settles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What this adds
Compare tab. The rotating and quasi-stationary results stacked on one shared time axis: spectrogram (n-map or log power), n(t), per-|n| mode amplitude, QS φ–t contour / amplitude / phase, and the selected plasma signals. You can annotate across panels (vertical lines, shaded spans, per-panel horizontal levels and points), saved per shot with JSON import/export. You can reorder panels by dragging or with ‹ › buttons, and the order persists. It plots the params last run in the Rotating and QS tabs, else their defaults.
Plasma-signal strip above every tab. Ip / Bt / κ toggle chips, plus any coil or probe channel in the shot file, stacked against time with the shared cursor. Pointnames not yet in the file are still fetched with the QS tab's existing custom-signal panel, after which they show up in the strip.
Shared time axis. Zooming the strip, any QS time trace, the rotating spectrogram or time tracks, or the Compare figure zooms all of them, across tabs. Double-click or the strip's "↺ full range" resets it.
Rotating mode amplitude, one trace per toroidal |n|. New
mode_amplitudenode and Rotating card (n-map colors). At each (t, f) cell the toroidal array is projected onto every n, as the n-map does, and the cell counts only toward its best-fit n. The |n| trace is the strongest such cell per time. On the unevenly spaced DIII-D array, a plain per-n projection would make a strong n=1 echo into n=2/3. Gaps mark times where an |n| owns no cell.Stop analysis at the Ip flattop end (checkbox in the strip).
core.plasma.ip_flattopfinds where smoothed |Ip| ≥ 95 % of peak. Withcut_flattop=1, the QS fit'stmaxis clamped, so the fit never sees post-flattop data. The rotating tracks end their sampling window there, and the spectrogram / n-map / coherence drop later columns. The strip shades the excluded time.Contract changes
mode_amplitude: line, seriesn=0…5,null= gap,meta.freq_kHz.extra_signalsmeta gainsavailable(every channel grouped plasma / coil / sensor),units, andflattop_ms.cut_flattop=1query param on the QS nodes,mode_track/mode_over_time/mode_amplitude, andspectrogram/mode_number/coherence. Without it nothing changes.Notes for review
Plotgains an optionalonDoubleClick. When it's set, single clicks are held 320 ms, because a click that moves the cursor re-renders the plot and would otherwise swallow the double-click.Plotnow purges only after an in-flightPlotly.reactsettles. Purging mid-draw threw inside Plotly when a plot unmounted while redrawing.Testing
ruff format --check,ruff check,ty check src/magnetics,pytest(494 passed).eslint,tsc -b,vitest(65 passed),vite build.test_plasma.py(flattop edges, sign, spikes, dips);test_mode_amplitude_by_n.py(two-mode 2:1 ratio recovered, no n=1 echo into n=2–5); node tests formode_amplitude, theextra_signalslisting/units/flattop, andcut_flattopon every affected node.timeRange,signalUnits,flattop, panel ordering, and annotations.n=0…5.🤖 Generated with Claude Code