lkorczowski / Tinnitus-n-Sleep

Detecting events in sleeping tinnitus patients
MIT License
1 stars 0 forks source link

First Cell having trouble #7

Closed lkorczowski closed 4 years ago

lkorczowski commented 4 years ago

@RobinGuillard reported an error in the notebook https://github.com/lkorczowski/Tinnitus-n-Sleep/blob/master/Notebooks/Bruxism_detection.ipynb

He couldn't load the Config notebook.

Please provide error log.

RobinGuillard commented 4 years ago

Here is the error log I got when executing the first "imports" cell of the noteebook:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-196-0b857fcdc193> in <module>
      6 import scipy
      7 import seaborn as sns
----> 8 from tinnsleep.config import Config  # please add your data path in the module
      9 from tinnsleep.data import CreateRaw, RawToEpochs_sliding
     10 print("Config loaded")

ModuleNotFoundError: No module named 'tinnsleep'
lkorczowski commented 4 years ago

this error comes when tinnsleep is not in python path, which is important. Usually, you want that you environnement to have the git folder in the python path

You can use absolute path

import sys
sys.path.append('/path/to/main/git')

or relative path use ('..') > one folder up from notebooks/ folder

lkorczowski commented 4 years ago

Without having in sys path, you can't do anything ^^

RobinGuillard commented 4 years ago

At last I could load the tinnsleep modules!! But directly after, when I try to run the second cell, I get:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-00b3053d26eb> in <module>
      3 
      4 raw  = mne.io.read_raw_edf(filename, preload=False)  # prepare loading
----> 5 raw  = CreateRaw(raw[picks_chan][0], picks_chan, ch_types=['emg'])        # pick channels and load
      6 raw  = raw.load_data()  # load data into memory
      7 print("Data loaded")

~\Documents\acou_sommeil_HD_ENS\Tinnitus-n-Sleep\tinnsleep\data.py in CreateRaw(data, ch_names, montage, ch_types)
     36     info = mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types, verbose=False)
     37     raw = mne.io.RawArray(data, info, verbose=False)
---> 38     raw.set_montage(montage)
     39     return raw
     40 

<C:\Users\Zeta\Anaconda3\lib\site-packages\mne\externals\decorator.py:decorator-gen-30> in set_montage(self, montage, set_dig, verbose)

~\Anaconda3\lib\site-packages\mne\utils\_logging.py in wrapper(*args, **kwargs)
     86             # set it back if we get an exception
     87             with use_log_level(verbose_level):
---> 88                 return function(*args, **kwargs)
     89         return function(*args, **kwargs)
     90     return FunctionMaker.create(

~\Anaconda3\lib\site-packages\mne\channels\channels.py in set_montage(self, montage, set_dig, verbose)
    459         """
    460         from .montage import _set_montage
--> 461         _set_montage(self.info, montage, set_dig=set_dig)
    462         return self
    463 

~\Anaconda3\lib\site-packages\mne\channels\montage.py in _set_montage(info, montage, update_ch_names, set_dig)
    808 
    809         if not _contains_ch_type(info, 'eeg'):
--> 810             raise ValueError('No EEG channels found.')
    811 
    812         sensors_found = []

ValueError: No EEG channels found.

From my point of view, it is because you suppressed the "montage" option when you call the CreateRaw function...

lkorczowski commented 4 years ago

What version of mne do you have ?

I have 20.0 and not problem

This raise ValueError is not anymore in _set_montage: https://github.com/mne-tools/mne-python/blob/1639ab47dd41a73e9e95962e766c80c102cc70f1/mne/channels/montage.py#L658-L762

lkorczowski commented 4 years ago

I think that issue has been managed by :