lkorczowski / Tinnitus-n-Sleep

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

Inter_subject_analysis.ipynb : ValueError: No appropriate channels found for the given picks ([]) #45

Closed lkorczowski closed 4 years ago

lkorczowski commented 4 years ago

Processing of the dataset and report generation

Files processed : 
1BA07_nuit_hab.edf
1DA15_nuit_hab.edf
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-25-2399c048e0a5> in <module>
     31                   )
     32             # Get the preprocessing steps done
---> 33             epochs, valid_labels, log = preprocess(raw, picks_chan, picks_imp, duration, interval, params, THR_imp=THR_imp, get_log=True)
     34             #If at least one epoch is good create report
     35             if np.sum(valid_labels)>0 :

~/git/Tinnitus-n-Sleep/notebooks/../tinnsleep/create_reports.py in preprocess(raw, picks_chan, picks_imp, duration, interval, params, THR_imp, get_log, filter)
     47     suppressed_imp = np.sum(impedance_labels)
     48 
---> 49     raw = CreateRaw(raw[picks_chan][0], picks_chan, ch_types='emg')  # pick channels and load
     50 
     51     # Filtering data

~/anaconda3/envs/tinnsleep-env/lib/python3.8/site-packages/mne/io/base.py in __getitem__(self, item)
    725 
    726         """  # noqa: E501
--> 727         sel, start, stop = self._parse_get_set_params(item)
    728         if self.preload:
    729             data = self._data[sel, start:stop]

~/anaconda3/envs/tinnsleep-env/lib/python3.8/site-packages/mne/io/base.py in _parse_get_set_params(self, item)
    660                                "and time)")
    661 
--> 662         sel = _picks_to_idx(self.info, item[0])
    663 
    664         if isinstance(item[1], slice):

~/anaconda3/envs/tinnsleep-env/lib/python3.8/site-packages/mne/io/pick.py in _picks_to_idx(info, picks, none, exclude, allow_empty, with_ref_meg, return_kind)
    998     #
    999     if len(picks) == 0 and not allow_empty:
-> 1000         raise ValueError('No appropriate channels found for the given picks '
   1001                          '(%r)' % (orig_picks,))
   1002     if (picks < -n_chan).any():

ValueError: No appropriate channels found for the given picks ([])
lkorczowski commented 4 years ago

because lines of electrode selection should be corrected as:

        picks_chan = [raw.info["ch_names"][i] for i in ind_picks_chan]
        picks_imp = [raw.info["ch_names"][i] for i in ind_picks_imp]

solved