Threshold Tuner
Move a peak-to-peak rejection threshold and watch the per-condition rejection counts and the resulting ERP change together.
3 claims on this page are unverified. TODO(confirm) marks a specific statement the author has not yet checked against a
primary source. Everything else on this page has been reviewed. Treat a marked claim as
provisional and go to the cited source rather than quoting the sentence.
Modes: default — the widget below runs in default. Use Share state to put the exact view in the URL.
What it does
One subject’s epochs, two conditions, and a threshold you can drag. As the peak-to-peak criterion moves, three panels update: the histogram of per-epoch peak-to-peak values with the threshold line drawn on it, the rejection count and percentage per condition, and the ERP recomputed from the surviving trials.
The counts are real. The widget thresholds on per-epoch values precomputed for every channel of the recording, not just the channels it draws, so the number of rejected epochs is the number a pipeline would reject at that setting. The ERP panel re-averages the stored channel subset.
Controls
| Control | What it sets |
|---|---|
| Peak-to-peak threshold | The rejection criterion, in µV, applied to every channel |
| Flat threshold | The minimum peak-to-peak below which a channel counts as flat |
| Condition display | Show both conditions, one, or the difference wave |
| Channel | Which channel the ERP panel shows |
| Balance counts | Subsample the better-preserved condition to match the other (seeded), to see what equal trial counts do |
What to look for
default
- Lowering the threshold improves the average up to a point, and then makes it worse: the trade between cleanliness and trials has a turning point you can see.
- Noise in an average falls as the square root of the trial count, so rejecting 20% of trials costs roughly 10% of the signal-to-noise ratio — while a handful of genuinely contaminated trials can cost far more than that.
- The two conditions do not lose trials at the same rate. Watch the difference between the two percentages, not just the total.
- At some thresholds the difference wave changes visibly while both conditions are still “reasonably clean” — the threshold has become an analysis choice.
- With counts balanced, a difference driven by unequal noise shrinks; a real effect does not.
Used in
- L2.5 Artifact rejection strategies (
default)
Data provenance
ds-erpcore — ERP CORE (Kappenman et al., 2021), CC BY 4.0, open access, per-subject downloadable. Biosemi ActiveTwo, 30 EEG + 3 EOG electrodes, 1024 Hz, CMS reference, 60 Hz mains, no software filters. One subject’s P3 epochs (target and standard), derived: epoched over the stored window, baselined, resampled and cropped to the §4.5 asset budget; the per-epoch peak-to-peak, maximum-absolute and flatness values for every channel are precomputed in Python and shipped in epochs.json.
TODO(confirm): the subject id, the exact epoch window, the sampling rate of the shipped asset and the trial counts are read from data/manifest.json and the asset sidecar once data/scripts/extract_p2_widgets.py has run; the frame’s provenance line is the authority. TODO(confirm): the author mirrors the ERP CORE entry into data/registry.yaml (§10.11 item 8).
Open the code
site/src/components/widgets/w-threshold-tuner/ — Widget.svelte, index.ts, README.md. Repository link: TODO(confirm) (GitHub org/repo, §13 item 3).