How to average epochs excluding a list of channels?

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

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

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