Skip to content

Dashboard: show the per-trial stimulus-quality flag (trial_quality / display_gap events) with an opt-in exclude #203

Description

@mbreiser

Why

Studio v0.77+ writes a per-trial stimulus-quality verdict into every run log ({"type":"log","event":"trial_quality", "trials":[{trial, pattern, status: pass|fail|unknown, slow_reads, stalls, max_read_ms, max_age_ms, coverage, …}]}, plus one display_gap event per stall). The Studio flags, never auto-excludes (selection-bias rule). The dashboard currently parses these logs fine (verified 2026-09-14 on rig03-sr's 13 runs: 0 parse errors, frames/steps/metadata correct) but ignores both events, so a flagged trial is plotted like any other.

First field case, 2026-09-14 rig03-sr: 6 of 638 trials flagged — each a ≈ 400 ms card-internal stall on pattern 41 (firmware #54, comment of 2026-09-14). The experimenter has no way to see them in the dashboard today; the list had to be posted by hand.

What

In dashboard/data-browser (shared logic preferably in js/, vendored like runlog-format.js):

  1. Read trial_quality (last one in the file wins; a run may have a deferred rewrite) and attach status + the reason (stalls, max_read_ms, max_age_ms, coverage) to each step/trial by trial number → step mapping (trial is 1-based over the sequence's trialParams steps).
  2. Show it: a per-trial badge/colour in the step table and trial plots (pass = nothing, flagged = ⚠ with tooltip "N stalls, max read X ms", unknown = ? "coverage incomplete"); a run-level line in the header ("56 trials · 1 flagged · 0 unknown").
  3. Exclude toggle, off by default: "hide flagged trials" checkbox for the aggregate plots; the excluded count stays visible. Never exclude silently.
  4. Optional: mark display_gap events on the time axis of the per-trial trace.
  5. Old logs (no trial_quality) render exactly as today.

Format authority

docs/development/telemetry-logging-reference.md (events section) and js/trial-quality.js (field names). Reader rule: any string-tagged array row ("cc"/"cf"/"cs") is a stream and must stay skipped.

Tests

Extend the dashboard/reader tests with a fixture containing a trial_quality event (one pass, one fail, one unknown) and assert the per-step attachment + header counts; keep tests/test-runlog-format.js copy-identity check green.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions