[Mne_analysis] not understanding use of pick_types

Dan McCloy dan.mccloy at gmail.com
Wed Nov 6 19:06:38 EST 2019
Search archives:

        External Email - Use Caution        

could you show us how you created the `epochs` variable, and anything you
did to it before this failing line?  I'm not sure, but it looks like maybe
you've got an earlier step in which you needed to include an
`epochs.copy()` before doing a pick...  many (all?) of the picking methods
operate in-place, so if you do first do something like
epochs.pick_types(meg=False, eeg=True) then subsequent calls to
epochs.pick_types(meg='mag') will fail because after the EEG picking,
`epochs` now only contains EEG channels.

On Wed, Nov 6, 2019 at 3:50 PM Megan Schendel <mschendel at mrn.org> wrote:

>         External Email - Use Caution
>
> Hi all,
> Now I'm using mne version 0.19, but I'm still getting pick errors using
> .pick_types(meg='mag') and (meg='grad').
> See below for commands and errors.  Any help would be appreciated!
> Thanks,
> Megan
>
> In [26]: mne.__version__
> Out[26]: '0.19.1'
>
> In [27]: mag_epochs =  epochs.pick_types(meg='mag')
>     ...:
> ---------------------------------------------------------------------------
> IndexError                                Traceback (most recent call last)
> <ipython-input-27-b02891c6983c> in <module>
> ----> 1 mag_epochs =  epochs.pick_types(meg='mag')
>
> </export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/externals/decorator.py:decorator-gen-31>
> in pick_types(self, meg, eeg, stim, eog, ecg, emg, ref_meg, misc, resp,
> chpi, exci, ias, syst, seeg, dipole, gof, bio, ecog, fnirs, include,
> exclude, selection, verbose)
>
> /export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/utils/_logging.py
> in wrapper(*args, **kwargs)
>      88             with use_log_level(verbose_level):
>      89                 return function(*args, **kwargs)
> ---> 90         return function(*args, **kwargs)
>      91     return FunctionMaker.create(
>      92         function, 'return decfunc(%(signature)s)',
>
> /export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/channels/channels.py
> in pick_types(self, meg, eeg, stim, eog, ecg, emg, ref_meg, misc, resp,
> chpi, exci, ias, syst, seeg, dipole, gof, bio, ecog, fnirs, include,
> exclude, selection, verbose)
>     673             ecog=ecog, fnirs=fnirs, include=include,
> exclude=exclude,
>     674             selection=selection)
> --> 675         return self._pick_drop_channels(idx)
>     676
>     677     def pick_channels(self, ch_names):
>
> /export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/channels/channels.py
> in _pick_drop_channels(self, idx)
>     813
>     814         if getattr(self, 'picks', None) is not None:
> --> 815             self.picks = self.picks[idx]
>     816
>     817         if hasattr(self, '_cals'):
>
> IndexError: index 0 is out of bounds for axis 0 with size 0
>
>
> In [28]:  grad_epochs =  epochs.pick_types(meg='grad')
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call last)
> <ipython-input-28-ed060676757b> in <module>
> ----> 1 grad_epochs =  epochs.pick_types(meg='grad')
>
> </export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/externals/decorator.py:decorator-gen-31>
> in pick_types(self, meg, eeg, stim, eog, ecg, emg, ref_meg, misc, resp,
> chpi, exci, ias, syst, seeg, dipole, gof, bio, ecog, fnirs, include,
> exclude, selection, verbose)
>
> /export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/utils/_logging.py
> in wrapper(*args, **kwargs)
>      88             with use_log_level(verbose_level):
>      89                 return function(*args, **kwargs)
> ---> 90         return function(*args, **kwargs)
>      91     return FunctionMaker.create(
>      92         function, 'return decfunc(%(signature)s)',
>
> /export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/channels/channels.py
> in pick_types(self, meg, eeg, stim, eog, ecg, emg, ref_meg, misc, resp,
> chpi, exci, ias, syst, seeg, dipole, gof, bio, ecog, fnirs, include,
> exclude, selection, verbose)
>     673             ecog=ecog, fnirs=fnirs, include=include,
> exclude=exclude,
>     674             selection=selection)
> --> 675         return self._pick_drop_channels(idx)
>     676
>     677     def pick_channels(self, ch_names):
>
> /export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/channels/channels.py
> in _pick_drop_channels(self, idx)
>     818             self._cals = self._cals[idx]
>     819
> --> 820         pick_info(self.info, idx, copy=False)
>     821
>     822         if getattr(self, '_projector', None) is not None:
>
> </export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/externals/decorator.py:decorator-gen-8>
> in pick_info(info, sel, copy, verbose)
>
> /export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/utils/_logging.py
> in wrapper(*args, **kwargs)
>      88             with use_log_level(verbose_level):
>      89                 return function(*args, **kwargs)
> ---> 90         return function(*args, **kwargs)
>      91     return FunctionMaker.create(
>      92         function, 'return decfunc(%(signature)s)',
>
> /export/research/analysis/human/jstephen/shared/programs/python/anaconda3/envs/mne19/lib/python3.7/site-packages/mne/io/pick.py
> in pick_info(info, sel, copy, verbose)
>     447         return info
>     448     elif len(sel) == 0:
> --> 449         raise ValueError('No channels match the selection.')
>     450     n_unique =
> len(np.unique(np.arange(len(info['ch_names']))[sel]))
>     451     if n_unique != len(sel):
>
> ValueError: No channels match the selection.
>
>
>
> MEG Technician
> The Mind Research Network
> 1101 Yale Blvd. NE
> Albuquerque, New Mexico 87106
>
>
>
> On Wed, Nov 6, 2019 at 4:23 PM Megan Schendel <mschendel at mrn.org> wrote:
>
>> Thanks, Dan!  That worked and will keep me moving!
>> Megan
>> MEG Technician
>> The Mind Research Network
>> 1101 Yale Blvd. NE
>> Albuquerque, New Mexico 87106
>>
>>
>>
>> On Wed, Nov 6, 2019 at 3:24 PM Dan McCloy <dan.mccloy at gmail.com> wrote:
>>
>>>         External Email - Use Caution
>>>
>>> I don't know why --only-binary is failing there, but something you could
>>> try to get going quickly is to clone one of the existing conda
>>> environments, activate the cloned environment, and then do `pip install
>>> --upgrade mne` in the new cloned env.
>>> -- dan
>>>
>>> Daniel McCloy
>>> http://dan.mccloy.info/
>>> Research Scientist
>>> Institute for Learning and Brain Sciences
>>> University of Washington
>>>
>>>
>>> On Wed, Nov 6, 2019 at 2:10 PM Megan Schendel <mschendel at mrn.org> wrote:
>>>
>>>>         External Email - Use Caution
>>>>
>>>> Hello again,
>>>> I'm having trouble trying to update my version of mne.
>>>> I'm following instructions from
>>>> https://mne.tools/stable/install/mne_python.html and I'm trying to use
>>>> a new anaconda environment so I don't disturb other users who have working
>>>> scripts with older versions.   I didn't get an error with the curl command,
>>>> but when I try
>>>> conda env create --name mne19 --file environment.yml
>>>> I get
>>>> Using Anaconda Cloud api site https://api.anaconda.org
>>>> Fetching package metadata ...........
>>>> Solving package specifications: .
>>>> glib-2.63.1-h5 100%
>>>> |###########################################################################################|
>>>> Time: 0:00:00   7.00 MB/s
>>>> pillow-6.2.1-p 100%
>>>> |###########################################################################################|
>>>> Time: 0:00:00   6.81 MB/s
>>>> jupyter_core-4 100%
>>>> |###########################################################################################|
>>>> Time: 0:00:00   9.71 MB/s
>>>> nbconvert-5.6. 100%
>>>> |###########################################################################################|
>>>> Time: 0:00:00   9.09 MB/s
>>>> ERROR: Invalid requirement: 'dipy --only-binary dipy'
>>>>
>>>> CondaValueError: pip returned an error.
>>>>
>>>> I know you don't support anaconda, but any insights you could give to
>>>> this error would be helpful!  Or another way to just update the mne install
>>>> and not the whole anaconda one.
>>>>
>>>> Thanks,
>>>> Megan
>>>>
>>>> MEG Technician
>>>> The Mind Research Network
>>>> 1101 Yale Blvd. NE
>>>> Albuquerque, New Mexico 87106
>>>>
>>>>
>>>>
>>>> On Fri, Nov 1, 2019 at 5:03 PM Megan Schendel <mschendel at mrn.org>
>>>> wrote:
>>>>
>>>>> Thank you for your help!
>>>>> Megan
>>>>> MEG Technician
>>>>> The Mind Research Network
>>>>> 1101 Yale Blvd. NE
>>>>> Albuquerque, New Mexico 87106
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Oct 30, 2019 at 3:47 AM Alexandre Gramfort <
>>>>> alexandre.gramfort at inria.fr> wrote:
>>>>>
>>>>>>         External Email - Use Caution
>>>>>>
>>>>>> hi Megan
>>>>>>
>>>>>> your version of MNE python is too old to pick with a string.
>>>>>>
>>>>>> you need to update or use the old documentation:
>>>>>>
>>>>>> https://mne.tools/0.15/index.html
>>>>>>
>>>>>> we are now at version 0.19.1
>>>>>>
>>>>>> Alex
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mne_analysis mailing list
>>>>>> Mne_analysis at nmr.mgh.harvard.edu
>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>>>
>>>>> _______________________________________________
>>>> Mne_analysis mailing list
>>>> Mne_analysis at nmr.mgh.harvard.edu
>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>
>>> _______________________________________________
>>> Mne_analysis mailing list
>>> Mne_analysis at nmr.mgh.harvard.edu
>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20191106/0554c0bb/attachment-0001.html 


More information about the Mne_analysis mailing list