[Mne_analysis] Problem with mne.pick_types

Mainak Jas mainakjas at gmail.com
Sat Aug 30 05:02:59 EDT 2014
Search archives:

Hi all,

I took a look at Maria's script. It turns out that the bad channels were
not picked in Raw, which is why they couldn't be picked downstream in the
Epochs and Evoked objects. Picking 'bads' in Raw solved the problem.

Mainak


On Wed, Aug 27, 2014 at 8:29 PM, Maria Hakonen <maria.hakonen at gmail.com>
wrote:

> Unfortunately, that didn't solve the problem.
>
> -Maria
>
>
> 2014-08-27 20:16 GMT+03:00 Denis-Alexander Engemann <
> denis.engemann at gmail.com>:
>
> Have you tried to to pass exclude=[] when invoking mne.pick_types?
>>
>> -Denis
>>
>>
>> 2014-08-27 19:09 GMT+02:00 Maria Hakonen <maria.hakonen at gmail.com>:
>>
>> Is it somehow possible to include the bads if they are in selection?
>>>
>>> -Maria
>>>
>>>
>>> 2014-08-27 19:51 GMT+03:00 Denis-Alexander Engemann <
>>> denis.engemann at gmail.com>:
>>>
>>> Hi Maria,
>>>>
>>>> it seems you found a 'bug' in the documentation. If you hit
>>>> 'mne.pick_types? in and IPython terminal you can see that 'exclude'
>>>> defaults to bads.
>>>> I guess that would explain your problem?
>>>>
>>>> -Denis
>>>>
>>>>
>>>> 2014-08-27 18:46 GMT+02:00 Maria Hakonen <maria.hakonen at gmail.com>:
>>>>
>>>> Or could it alternatively be possible to plot also the bad channels?
>>>>>
>>>>> I have:
>>>>>
>>>>>  picks = mne.pick_types(evoked_raw.info,selection=selection)
>>>>>
>>>>> I think that this shouldn't exclude bads because I have not
>>>>> exclude='bads'.
>>>>>
>>>>> However, picks doesn't include the channels in selection that are
>>>>> marked as bad.
>>>>>
>>>>> In the reference of mne.picks_type it is said:
>>>>>
>>>>> exclude : list of string | str
>>>>>
>>>>> List of channels to exclude. If empty do not exclude any (default). If
>>>>> ‘bads’, exclude channels in info[‘bads’]
>>>>>
>>>>>
>>>>> -Maria
>>>>>
>>>>>
>>>>>
>>>>> 2014-08-27 19:02 GMT+03:00 Maria Hakonen <maria.hakonen at gmail.com>:
>>>>>
>>>>> There was one channel two times in selection...
>>>>>>
>>>>>> However, it seems to cause a problem if some of the channels in
>>>>>> selection is bad.
>>>>>> I would like to plot a subset of channels from each data file in a
>>>>>> loop as follows:
>>>>>>
>>>>>> picks = mne.pick_types(evoked.info,selection=selection)
>>>>>>
>>>>>>                 idx = 0
>>>>>>                 for ax_row in axes:
>>>>>>                         for ax in ax_row:
>>>>>>                                 ax.plot(evoked_raw.times,
>>>>>> evoked_raw.data[picks[idx]])
>>>>>>                                 idx += 1
>>>>>>
>>>>>> Is it somehow possible to, for example, plot a blank plot if there is
>>>>>> a bad channel in selection?
>>>>>>
>>>>>> -Maria
>>>>>>
>>>>>>
>>>>>> 2014-08-27 15:05 GMT+03:00 Denis-Alexander Engemann <
>>>>>> denis.engemann at gmail.com>:
>>>>>>
>>>>>> Hi,
>>>>>>>
>>>>>>> 2014-08-27 14:02 GMT+02:00 Maria Hakonen <maria.hakonen at gmail.com>:
>>>>>>>
>>>>>>> I manged to solve this already.
>>>>>>>>
>>>>>>>>
>>>>>>> now I'm curious, what was the problem?
>>>>>>>
>>>>>>> -Denis
>>>>>>>
>>>>>>>
>>>>>>>> -Maria
>>>>>>>>
>>>>>>>>
>>>>>>>> 2014-08-27 13:11 GMT+03:00 Maria Hakonen <maria.hakonen at gmail.com>:
>>>>>>>>
>>>>>>>> I have one bad channel but it is not included in selection. Can it
>>>>>>>>> however cause problems?
>>>>>>>>>
>>>>>>>>> -Maria
>>>>>>>>>
>>>>>>>>> Here are the outputs:
>>>>>>>>> evoked.info['bads']
>>>>>>>>> Out[54]: [u'MEG 2511']
>>>>>>>>>
>>>>>>>>> but
>>>>>>>>>
>>>>>>>>> In [53]: selection
>>>>>>>>> Out[53]:
>>>>>>>>> ['MEG 0133',
>>>>>>>>>  'MEG 0212',
>>>>>>>>>  'MEG 0223',
>>>>>>>>>  'MEG 1313',
>>>>>>>>>  'MEG 1322',
>>>>>>>>>  'MEG 1443',
>>>>>>>>>  'MEG 0132',
>>>>>>>>>  'MEG 0213',
>>>>>>>>>  'MEG 0222',
>>>>>>>>>  'MEG 1312',
>>>>>>>>>  'MEG 1323',
>>>>>>>>>  'MEG 1442',
>>>>>>>>>  'MEG 1513',
>>>>>>>>>  'MEG 0242',
>>>>>>>>>  'MEG 0233',
>>>>>>>>>  'MEG 1343',
>>>>>>>>>  'MEG 1332',
>>>>>>>>>  'MEG 2613',
>>>>>>>>>  'MEG 1512',
>>>>>>>>>  'MEG 0243',
>>>>>>>>>  'MEG 0232',
>>>>>>>>>  'MEG 1343',
>>>>>>>>>  'MEG 1333',
>>>>>>>>>  'MEG 2612',
>>>>>>>>>  'MEG 1523',
>>>>>>>>>  'MEG 1612',
>>>>>>>>>  'MEG 1623',
>>>>>>>>>  'MEG 2413',
>>>>>>>>>  'MEG 2422',
>>>>>>>>>  'MEG 2643',
>>>>>>>>>  'MEG 1522',
>>>>>>>>>  'MEG 1613',
>>>>>>>>>  'MEG 1622',
>>>>>>>>>  'MEG 2412',
>>>>>>>>>  'MEG 2423',
>>>>>>>>>  'MEG 2642']
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 2014-08-27 12:56 GMT+03:00 Denis-Alexander Engemann <
>>>>>>>>> denis.engemann at gmail.com>:
>>>>>>>>>
>>>>>>>>> Hi Maria,
>>>>>>>>>>
>>>>>>>>>> Do you have one bad channel? Take a look at evoked.info['bads']
>>>>>>>>>> pick types automatically excludes those.
>>>>>>>>>>
>>>>>>>>>> -Denis
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 2014-08-27 11:53 GMT+02:00 Maria Hakonen <maria.hakonen at gmail.com
>>>>>>>>>> >:
>>>>>>>>>>
>>>>>>>>>>> Hi all,
>>>>>>>>>>>
>>>>>>>>>>> I have used mne.pick_types as follows:
>>>>>>>>>>>
>>>>>>>>>>> picks = mne.pick_types(evoked.info,selection=selection)
>>>>>>>>>>>
>>>>>>>>>>> where selection includes 36 channel names.
>>>>>>>>>>> However, picks is an array with only 35 elements.
>>>>>>>>>>> I wonder what could be wrong there?
>>>>>>>>>>>
>>>>>>>>>>> Regards,
>>>>>>>>>>> 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.
>>>
>>>
>>
>> _______________________________________________
>> 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/20140830/73974613/attachment.html 


More information about the Mne_analysis mailing list