raphaelvallat / yasa

YASA (Yet Another Spindle Algorithm): a Python package to analyze polysomnographic sleep recordings.
https://raphaelvallat.com/yasa/
BSD 3-Clause "New" or "Revised" License
417 stars 113 forks source link

Error during automatic sleep staging #36

Closed cyberfag closed 3 years ago

cyberfag commented 3 years ago

Hi. I was trying to get the automatically extracted sleep stages, but, while executing sls.predict() command, Python (Jupyter Lab) returned the following error. image I used an edf file loaded via mne.io.read_raw_edf function(...preload=True...): 4 channels (2 EEG, 2 EMG) with the same sf (200 Hz), then I executed sls = yasa.SleepStaging(raw, eeg_name="EEG1", emg_name="EMG1") which worked without errors for ~5 seconds, though the file is 26 hours long. I use the newest version of yasa (0.4.1), lightGBM (3.2.1) and antropy (0.1.4) are also installed. Seems like it cannot find the files containing pretrained classifiers. What could it be due to? Because manually I could find the files int the file system. image Thanks in advance.

cyberfag commented 3 years ago

I added a print() in the staging.py and figured out that path is correct but there is just no such classifier that could use eeg+emg without eog. Deleting emg_name="EMG1" from yasa.SleepStaging() call solved the issue.

raphaelvallat commented 3 years ago

Hi @cyberfag,

Good catch -- I'll make sure to add a classifier for eeg+emg in the next release to avoid such errors in the future.

Thanks! Raphael

raphaelvallat commented 3 years ago

Fixed in release 0.5.0.