[Mne_analysis] Pick a channel from the epoch data?

Denis-Alexander Engemann denis.engemann at gmail.com
Mon Oct 27 12:03:08 EDT 2014
Search archives:

Ok. The error message tells you what we just saw: you need to pass the
exact channel name to remove the channel from the data. Why you get an
indexing error when passing a valid channel name is unclear to me. Could
you possibly share a mini-verison of your data. e.g. after croping them to
a few samples e.g. using the .crop method.

-Denis



2014-10-27 16:57 GMT+01:00 Maria Hakonen <maria.hakonen at gmail.com>:

> Hi Denis,
>
> That gives
>
> In [57]: 'MEG0242' in epochs_condition_1.ch_names
> Out[57]: False
>
> but
>
> In [58]: 'MEG 0242' in epochs_condition_1.ch_names
> Out[58]: True
>
> -Maria
>
> 2014-10-27 17:47 GMT+02:00 Denis-Alexander Engemann <
> denis.engemann at gmail.com>:
>
>> Hi, Maria,
>>
>> what do you get if you type:
>>
>> 'MEG0242' in epochs_condition_1.ch_names
>>
>> -Denis
>>
>> 2014-10-27 16:44 GMT+01:00 Maria Hakonen <maria.hakonen at gmail.com>:
>>
>>> I think that the space is not the problem because at least in the case
>>> of evoked data 'MEG 0242' works. I also tried condition_1.pick_channels(['MEG0242'])
>>> but got an error:
>>>
>>> ----> 1 epochs_condition_1.pick_channels(['MEG0242'])
>>>
>>> /home/mhhakone/Downloads/mne-python/mne/channels.pyc in
>>> pick_channels(self, ch_names, copy)
>>>     148
>>>     149         idx = [inst.ch_names.index(c) for c in ch_names if c in
>>> inst.ch_names]
>>> --> 150         inst._pick_drop_channels(idx)
>>>     151
>>>     152         return inst
>>>
>>> /home/mhhakone/Downloads/mne-python/mne/channels.pyc in
>>> _pick_drop_channels(self, idx)
>>>     192             self.cals = self.cals[idx]
>>>     193
>>> --> 194         self.info = pick_info(self.info, idx, copy=False)
>>>     195
>>>     196         if inst_has('_projector'):
>>>
>>> /home/mhhakone/Downloads/mne-python/mne/io/pick.pyc in pick_info(info,
>>> sel, copy)
>>>     285
>>>     286     if len(sel) == 0:
>>> --> 287         raise ValueError('Warning : No channels match the
>>> selection.')
>>>     288
>>>     289     info['chs'] = [info['chs'][k] for k in sel]
>>>
>>> ValueError: Warning : No channels match the selection.
>>>
>>> -Maria
>>>
>>> 2014-10-27 17:32 GMT+02:00 Laetitia Grabot <laetitia.grabot at gmail.com>:
>>>
>>>> You should try without the space between MEG and 0242, like this:
>>>> epochs_condition_1.pick_channels(['MEG0242'])
>>>> Normally it works!
>>>>
>>>> 2014-10-27 16:22 GMT+01:00 Maria Hakonen <maria.hakonen at gmail.com>:
>>>>
>>>>> Hi,
>>>>>
>>>>> I tried that as:
>>>>> epochs_condition_1.pick_channels(['MEG 0242'])
>>>>>
>>>>> but got an error:
>>>>>
>>>>> ----> 1 epochs_condition_1.pick_channels(['MEG 0242'])
>>>>>
>>>>> /home/mhhakone/Downloads/mne-python/mne/channels.pyc in
>>>>> pick_channels(self, ch_names, copy)
>>>>>     148
>>>>>     149         idx = [inst.ch_names.index(c) for c in ch_names if c
>>>>> in inst.ch_names]
>>>>> --> 150         inst._pick_drop_channels(idx)
>>>>>     151
>>>>>     152         return inst
>>>>>
>>>>> /home/mhhakone/Downloads/mne-python/mne/channels.pyc in
>>>>> _pick_drop_channels(self, idx)
>>>>>     187
>>>>>     188         if inst_has('picks'):
>>>>> --> 189             self.picks = self.picks[idx]
>>>>>     190
>>>>>     191         if inst_has('cals'):
>>>>>
>>>>> IndexError: index 22 out of bounds 0<=index<0
>>>>>
>>>>> Could someone please let me know what I am doing wrong?
>>>>>
>>>>> epochs_condition_1 is:
>>>>>
>>>>> epochs_condition_1
>>>>> Out[40]: <Epochs  |  n_events : 160 (all good), tmin : -0.
>>>>> 0999936018905 (s), tmax : 0.999936018905 (s), baseline :
>>>>> (-0.09999360144138336, 0.0)>
>>>>>
>>>>> Thanks,
>>>>> Maria
>>>>>
>>>>> 2014-10-27 17:02 GMT+02:00 Laetitia Grabot <laetitia.grabot at gmail.com>
>>>>> :
>>>>>
>>>>>> Hi,
>>>>>> There is a method that you can apply to your epochs object to select
>>>>>> a channel:
>>>>>> epochs.pick_channels()
>>>>>>
>>>>>> Laetitia
>>>>>>
>>>>>> 2014-10-27 15:52 GMT+01:00 Maria Hakonen <maria.hakonen at gmail.com>:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have loaded epochs with mne.read_epochs and would need to pick a
>>>>>>> channel from the epoch data. I wonder if there is any function to do this?
>>>>>>> mne.pick_channels_evoked seems to work for evoked data, but I haven't found
>>>>>>> the corresponding function for epochs.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Maria
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mne_analysis mailing list
>>>>>>> Mne_analysis at nmr.mgh.harvard.edu
>>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>>>>>
>>>>>>>
>>>>>>> The information in this e-mail is intended only for the person to
>>>>>>> whom it is
>>>>>>> addressed. If you believe this e-mail was sent to you in error and
>>>>>>> the e-mail
>>>>>>> contains patient information, please contact the Partners Compliance
>>>>>>> HelpLine at
>>>>>>> http://www.partners.org/complianceline . If the e-mail was sent to
>>>>>>> you in error
>>>>>>> but does not contain patient information, please contact the sender
>>>>>>> and properly
>>>>>>> dispose of the e-mail.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Mne_analysis mailing list
>>>>>> Mne_analysis at nmr.mgh.harvard.edu
>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>>>>
>>>>>>
>>>>>> The information in this e-mail is intended only for the person to
>>>>>> whom it is
>>>>>> addressed. If you believe this e-mail was sent to you in error and
>>>>>> the e-mail
>>>>>> contains patient information, please contact the Partners Compliance
>>>>>> HelpLine at
>>>>>> http://www.partners.org/complianceline . If the e-mail was sent to
>>>>>> you in error
>>>>>> but does not contain patient information, please contact the sender
>>>>>> and properly
>>>>>> dispose of the e-mail.
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mne_analysis mailing list
>>>>> Mne_analysis at nmr.mgh.harvard.edu
>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>>>
>>>>>
>>>>> The information in this e-mail is intended only for the person to whom
>>>>> it is
>>>>> addressed. If you believe this e-mail was sent to you in error and the
>>>>> e-mail
>>>>> contains patient information, please contact the Partners Compliance
>>>>> HelpLine at
>>>>> http://www.partners.org/complianceline . If the e-mail was sent to
>>>>> you in error
>>>>> but does not contain patient information, please contact the sender
>>>>> and properly
>>>>> dispose of the e-mail.
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Mne_analysis mailing list
>>>> Mne_analysis at nmr.mgh.harvard.edu
>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>>
>>>>
>>>> The information in this e-mail is intended only for the person to whom
>>>> it is
>>>> addressed. If you believe this e-mail was sent to you in error and the
>>>> e-mail
>>>> contains patient information, please contact the Partners Compliance
>>>> HelpLine at
>>>> http://www.partners.org/complianceline . If the e-mail was sent to you
>>>> in error
>>>> but does not contain patient information, please contact the sender and
>>>> properly
>>>> dispose of the e-mail.
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Mne_analysis mailing list
>>> Mne_analysis at nmr.mgh.harvard.edu
>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>
>>>
>>> The information in this e-mail is intended only for the person to whom
>>> it is
>>> addressed. If you believe this e-mail was sent to you in error and the
>>> e-mail
>>> contains patient information, please contact the Partners Compliance
>>> HelpLine at
>>> http://www.partners.org/complianceline . If the e-mail was sent to you
>>> in error
>>> but does not contain patient information, please contact the sender and
>>> properly
>>> dispose of the e-mail.
>>>
>>>
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>>
>> The information in this e-mail is intended only for the person to whom it
>> is
>> addressed. If you believe this e-mail was sent to you in error and the
>> e-mail
>> contains patient information, please contact the Partners Compliance
>> HelpLine at
>> http://www.partners.org/complianceline . If the e-mail was sent to you
>> in error
>> but does not contain patient information, please contact the sender and
>> properly
>> dispose of the e-mail.
>>
>>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it
> is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141027/2153405e/attachment.html 


More information about the Mne_analysis mailing list