PulseExploreJournal ClubDebatesTrendingResearchersJournals
Instagram
HomeExploreJournal ClubTrending
Synapse
⌘+K
Synapse
May 10, 2026SLEEP0 citations

0368 Real-Time Sleep Stage and EEG Feature Detection for Closed-Loop Neuromodulation

View Full Paper
CGCameron GoodAPAntony PassaroEDEhsan Dadgar-Kiani

Key Points

  • This research aims to develop real-time algorithms for EEG analysis to enable effective closed-loop neuromodulation.
  • Utilized the STAGES dataset comprising 1,687 polysomnograms
  • Implemented a threshold-based approach for artifact rejection
  • Developed an XGBoost machine learning model for real-time sleep staging.
  • Achieved 81.4% detection of slow waves prior to the negative peak
  • EEG feature calculations completed in less than 5 ms
  • The model predicts future sleep stages based on a 10-second analysis of EEG data.

Abstract

Abstract Introduction Closed-loop neuromodulation based on streaming EEG requires real-time algorithms to continuously run as new data samples are collected, and the system must react with millisecond precision to time stimulation with detected features. To address this, we developed a comprehensive real-time EEG signal processing pipeline consisting of automated on-line artifact rejection, sleep staging, and slow-wave and spindle detection, along with control logic for triggering external neuromodulation systems. Methods We used the STAGES dataset (1,687 polysomnograms) to develop our algorithms. We manually labeled artifact containing sleep epochs to develop a threshold-based approach to rejection. We then defined a set of parameters to identify slow waves and spindles as they occur in real-time, along with opportunities for personalized models. An XGBoost machine learning (ML) model was used to implement automated sleep staging capable of running in a real-time manner. Lastly, we developed a predictive model of the upcoming (future) sleep stage of the next epoch of EEG data. Results The artifact rejection threshold value can be adjusted to be less or more restrictive on data quality used for analysis. For example, one can reject more data by reducing the threshold to lower values, which flags more epochs as contaminated by noise and provides a cleaner (but reduced) dataset. The sleep stage model analyzes 10 seconds of EEG data then predicts the future 10 second epoch and runs again 10 seconds later. EEG feature calculations take 5 ms to run. Our algorithms can detect 81.4 % of slow waves prior to the negative peak (270-degress, mean = 246.2 degrees). A second real-time slow wave and spindle detection model relies on obtaining a minimum of 1-night’s sleep recording for individualized neuromodulation. Conclusion We combined these algorithms (artifact rejection, sleep staging, and slow-wave and spindle detection) into a closed-loop workflow that allows one to time neurostimulation at any point and define timeout periods for safety. The approach was validated using a separately developed custom software application to visualize pre-recorded EEG data as if it were being actively recorded. All code is written in Python to accommodate further modification and enhancements. Support (if any)

Ask AI
Helpful
Bookmark
Share
View Full Paper

Cite This Study

Good et al. (2026) studied this question.

synapsesocial.com/papers/6a00205ec8f74e3340f9b475https://doi.org/10.1093/sleep/zsag091.0368
Ask AI
Helpful
Bookmark
Share
View Full Paper