Grand average over subjects when bad channels are excluded?

Hi all,

I have computed grand average over subjects as follows:

for subject in subjects:
                evoked = mne.read_evokeds(filename, baseline=(None, 0),
proj=True,verbose=False)
                if flag == 1:
                        evoked_all = evoked[0]
                        flag = 0
                else:
                        evoked_all = evoked_all+evoked[0]
        evoked_all = evoked_all / len(subjects)

However, a problem arises when the evoked files don't contain the same
channels (this is because I have excluded bad channels and they are not
same in all files):

AssertionError: <Evoked | comment : 'Unknown', time : [-0.099994,
2.999808], n_epochs : 147, n_channels x n_times : 305 x 3721> and <Evoked
> comment : 'Unknown', time : [-0.099994, 2.999808], n_epochs : 154,
n_channels x n_times : 306 x 3721> do not contain the same channels

I wonder if there is any way to get the grand average over subjects if bad
channels are excluded?

Many thanks already in advance!

Regards,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141117/3d75cd2e/attachment.html

hi Maria,

your best option is to do a first for loop to get the list of all
channels to drop,
then drop them with evoked.drop_channels and then average.

also pay attention to the number of epochs if it varies, as the + operator
uses it.

any volunteer to add a mne.evoked.grand_average function?

HTH
Alex

Hi Maria,

we also have mne.equalize_channels

which equlizes the channeld of a list of raw/ epochs/ or evoked object.

Denis

2014-11-17 9:21 GMT+01:00 Alexandre Gramfort <
alexandre.gramfort at telecom-paristech.fr>:

hi Maria,

your best option is to do a first for loop to get the list of all
channels to drop,
then drop them with evoked.drop_channels and then average.

also pay attention to the number of epochs if it varies, as the + operator
uses it.

any volunteer to add a mne.evoked.grand_average function?

HTH
Alex

> Hi all,
>
> I have computed grand average over subjects as follows:
>
> for subject in subjects:
> evoked = mne.read_evokeds(filename, baseline=(None, 0),
> proj=True,verbose=False)
> if flag == 1:
> evoked_all = evoked[0]
> flag = 0
> else:
> evoked_all = evoked_all+evoked[0]
> evoked_all = evoked_all / len(subjects)
>
> However, a problem arises when the evoked files don't contain the same
> channels (this is because I have excluded bad channels and they are not
same
> in all files):
>
> AssertionError: <Evoked | comment : 'Unknown', time : [-0.099994,
> 2.999808], n_epochs : 147, n_channels x n_times : 305 x 3721> and
<Evoked |
> comment : 'Unknown', time : [-0.099994, 2.999808], n_epochs : 154,
> n_channels x n_times : 306 x 3721> do not contain the same channels
>
> I wonder if there is any way to get the grand average over subjects if
bad
> channels are excluded?
>
> Many thanks already in advance!
>
> Regards,
> Maria
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> Mne_analysis Info Page
>
>
> 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
> MyComplianceReport.com: Compliance and Ethics Reporting . 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
Mne_analysis Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141117/ed67fb9e/attachment.html

Hi all,

I can give the mne.evoked.grand_average function a try.

best regards,
mads

Hi all,

Many thanks for all help!
I will try mne.evoked.grand_average.
Can I find it if I first get the latest code as: git clone git://
github.com/mne-tools/mne-python.git
and then simply type mne.evoked.grand_average ? in python?

Regards,
Maria

2014-11-17 11:28 GMT+02:00 Mads Jensen <mje.mads at gmail.com>:

Hi all,

I can give the mne.evoked.grand_average function a try.

best regards,
mads

> hi Maria,
>
> your best option is to do a first for loop to get the list of all
> channels to drop,
> then drop them with evoked.drop_channels and then average.
>
> also pay attention to the number of epochs if it varies, as the +
operator
> uses it.
>
> any volunteer to add a mne.evoked.grand_average function?
>
> HTH
> Alex
>
>
>> Hi all,
>>
>> I have computed grand average over subjects as follows:
>>
>> for subject in subjects:
>> evoked = mne.read_evokeds(filename, baseline=(None, 0),
>> proj=True,verbose=False)
>> if flag == 1:
>> evoked_all = evoked[0]
>> flag = 0
>> else:
>> evoked_all = evoked_all+evoked[0]
>> evoked_all = evoked_all / len(subjects)
>>
>> However, a problem arises when the evoked files don't contain the same
>> channels (this is because I have excluded bad channels and they are not
same
>> in all files):
>>
>> AssertionError: <Evoked | comment : 'Unknown', time : [-0.099994,
>> 2.999808], n_epochs : 147, n_channels x n_times : 305 x 3721> and
<Evoked |
>> comment : 'Unknown', time : [-0.099994, 2.999808], n_epochs : 154,
>> n_channels x n_times : 306 x 3721> do not contain the same channels
>>
>> I wonder if there is any way to get the grand average over subjects if
bad
>> channels are excluded?
>>
>> Many thanks already in advance!
>>
>> Regards,
>> Maria
>>
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> Mne_analysis Info Page
>>
>>
>> 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
>> MyComplianceReport.com: Compliance and Ethics Reporting . 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
> Mne_analysis Info Page
>
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20141117/ba9fd1d4/attachment.html

I will try mne.evoked.grand_average.

this function does not exist yet. Mads volunteered to write it.

A