[Mne_analysis] How to average epochs excluding a list of channels?

Alexandre Gramfort alexandre.gramfort at inria.fr
Fri Aug 28 03:29:44 EDT 2020
Search archives:

        External Email - Use Caution        

hi,

you can pass picks to Epochs eg obtained with pick_types that does
exclude='bads'
by default.

you can also use the .pick methods of raw, epochs or evoked to drop channels
at any step of your pipeline.

HTH
Alex

On Fri, Aug 28, 2020 at 8:16 AM <balandongiv at gmail.com> wrote:
>
>         External Email - Use Caution
>
> Hi Group,
>
>
>
> I would like to calculate the epochs average. There a list of channels that I would like exclude when calculating the average.
>
> Despite assigning these channel as ‘bads’, it seem they were averaged together when run the line epochs.average().
>
>
>
> May I know if there is any setting that I am not aware of.
>
>
>
> Also, is it possible to avoid  assigning these channel as ‘bads’ when calculating the epochs.average, as I would like to use them for other processing down the line later.
>
>
>
> The code is as below
>
>
>
> Thanks for any hint.
>
>
>
> Regards
>
> Rodney
>
>
>
>
>
> Code:
>
>
>
>
>
> raw = mne.io.read_raw_fif(fname_raw, preload=True)
> outer_ch = ['E43', 'E48','E49', 'E56', 'E63', 'E68', 'E73', 'E81', 'E88', 'E94', 'E99',
>                 'E107', 'E113',  'E119', 'E120','E125', 'E126', 'E127', 'E128']
> raw.info['bads'] =outer_ch # is there any approach rather than assign these channel as bad?
> event_id = 1
> duration = 30
> events = mne.make_fixed_length_events(raw, event_id, duration=duration)
> epochs = mne.Epochs(raw, events=events, event_id=event_id, baseline=None,
>                     verbose=False, tmin=0, tmax=duration, preload=True)
>
>
> evoked = epochs.average() # How to calculate average excluding the outer_ch
>
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis



More information about the Mne_analysis mailing list