GithubHelp home page GithubHelp logo

nabilalibou / sleepchecker Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 30 KB

Class wrapper of the yasa package to detect drowsiness/sleep phase using EEG data

License: MIT License

Python 100.00%
eeg eeg-analysis eeg-signals-processing sleep-analysis drowsiness-detection sleep-scoring sleep-staging sleep

sleepchecker's Introduction

SleepChecker: A Simplified Wrapper for Robust Sleep Stage Detection in EEG

SleepChecker simplifies the process of detecting sleep stages in EEG recordings. It wraps the powerful yasa [1] SleepStaging module, providing a user-friendly interface for robust sleep detection.

Key Features:

  • Automated Sleep Stage Classification: Combines predictions from the underlying algorithm for a single, reliable sleep stage label.
  • Total Sleep Time: Calculates the total percentage of time spent asleep during the recording.
  • Sleep Annotation: Annotates sleep segments directly onto your MNE raw EEG data for easy visualization and analysis.

Installation

git clone https://github.com/nabilalibou/SleepChecker.git
pip install -r requirements.txt

Example

import mne
from SleepChecker import SleepChecker

# Load an EDF file using MNE
raw_eeg = mne.io.read_raw_edf("myfile.edf", preload=True)  
sc = SleepChecker(raw_eeg, eeg_name=['C4', 'C3'], eog_name="HEOGR-HEOGL", ref_channel=["M1", "M2"])
# Return an array containing the predicted sleep phases among ['W', 'N1', 'N2', 'N3', 'R']
sleep_stages = sc.predict()  
# get the overall % of time asleep
sleep_percent = sc.get_tot_sleep_percentage(sleep_stages)  
# annotate the sleeping time spans directly on the raw data
raw_eeg = sc.annotate_data()  

References

[1] Vallat, Raphael, and Matthew P. Walker. "An open-source, high-performance tool for automated sleep staging." Elife 10 (2021). doi: https://doi.org/10.7554/eLife.70092

sleepchecker's People

Contributors

nabilalibou avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.