Skip to content

Commit

Permalink
init tutorial sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
Slasnista committed Nov 16, 2018
1 parent 90ebb36 commit 9925949
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tutorials/plot_sleep.py
@@ -0,0 +1,35 @@
"""
=======================================
Example on sleep data
=======================================
"""

import mne

my_event_id = {'Sleep stage ?': 1,
'Sleep stage W': 2,
'Sleep stage 1': 3,
'Sleep stage 2': 4,
'Sleep stage 3': 5,
'Sleep stage R': 6}

# names of edf and annot files
edf_f = "SC4001E0-PSG.edf"
annot_f = "SC4001EC-Hypnogram.edf"

# read raw edf
raw = mne.io.read_raw_edf(edf_f, preload=True)

# names of EEG and EOG channels to use
channels = ['EEG Fpz-Cz', 'EEG Pz-Oz', 'EOG horizontal']

# set annotations
annot = mne.read_annotations(annot_f)
raw.set_annotations(annot)

# get the events and the event ids
events, event_id = mne.events_from_annotations(raw)

# perform epoching
epochs = mne.Epochs(raw, events, event_id, tmin=0., tmax=30., baseline=None)

0 comments on commit 9925949

Please sign in to comment.