How the algorithm works
This tool and the algorithm were built by multiple students for research and learning. It helps locate EEG time ranges that warrant a closer look. It does not diagnose.
Files you can use
- EDF/EDF+ - Standard EEG. The algorithm reads all channels and their labels.
- CSV - Each numeric column is treated as one channel. Set Sampling rate (Hz) correctly.
What a channel is
A channel is one electrode measured over time. Because true events may appear on some channels and not others, the algorithm analyzes channels separately and can optionally combine them later.
Under the hood (per channel)
- Windowing - One second windows with 0.5 second steps provide overlap so edges are not missed.
- Energy measure - Root-mean-square (RMS) is computed per window as a simple amplitude proxy.
- Robust baseline - The quietest half of RMS values is used to estimate a median and a median absolute deviation (MAD), which are stable to outliers.
- Threshold -
threshold = median + Z x MAD. With Auto-Z, the algorithm selects Z so about 0.2-1% of frames exceed threshold (controlled by Aggressiveness).
- Segments - Consecutive above-threshold windows form runs. The algorithm merges runs separated by less than or equal to Merge gap and removes runs shorter than Min duration.
Optional: channel fusion (K-of-N)
Per-channel runs are mapped to a shared timeline and votes are counted. A time point is active only if at least K channels agree. Those voted frames are then converted back into segments using the same merge and duration rules.
Tuning tips
- If nothing is detected, lower Z, switch Auto-Z to Sensitive, or reduce Min duration.
- If too much is detected, raise Z, switch Auto-Z to Conservative, or increase Min duration. With many channels, enable fusion or increase K.
- If CSV timing looks off, re-check the sampling rate. EDF rates are read automatically.
Reading the results
- Each row shows Source (either Fused or a channel name), Start, End, and Duration in seconds.
- Fused indicates cross-channel consensus; channel rows are single-channel detections.
- Use Download as CSV to export the segments.
Notes and limitations
- Research and education only. Not a medical device.
- Artifacts from muscle, blinks, or movement can elevate energy measures. Always inspect raw EEG and obtain expert review.
- Processing occurs in the browser; this page does not upload files.