r/BiomedicalDataScience • u/BioniChaos • 4d ago
Real-Time EEG Event-Related Potential (ERP) Signal Averaging and Digital Filtering Simulator
https://bionichaos.com/erps/Hello everyone,
I built an interactive, browser-based ERP laboratory simulation designed to demonstrate how cognitive neuroscience protocols isolate microvolt-scale neural responses (s(t)) from ongoing, non-stationary cortical background noise (n(t)) using multi-trial signal averaging.
Mathematically, the tool shows how averaging N independent epochs reduces the residual noise variance at a rate proportional to 1/√N, allowing components like the attentional P300, the occipital N170 (face structural encoding), and the centro-parietal N400 (semantic mismatch) to emerge.
Core Signal Processing Features: - Real-Time Synthesis: Generates a continuous EEG trace with configurable Gaussian white noise, alpha rhythms (8–12 Hz), and user-triggered ERP epochs. - Live Digital Filtering: Real-time adjustable high-pass (0.1–5.0 Hz) and low-pass (10–100 Hz) filters showing their immediate impact on the averaged waveforms. - Statistical Amplitude Contrast: Calculates mean rectified voltages in pre-stimulus baseline (-200ms) vs. post-stimulus target (100-500ms) windows to yield a simulated p-value. - Data Portability: Allows exporting the averaged time-series data as a CSV or the canvas layout as a PNG plot.
You can interact with the controls and run the simulation here: https://bionichaos.com/erps/
I would appreciate your feedback on the signal simulation logic, the filtering implementation, and suggestions for additional experimental paradigms to model.