Rejecting an epoch for only some channels

Hi all,

We are working with sEEG data using MNE. In the data, in some epochs, artifacts are only seen in a subset of channels and for a duration of time. We don’t want to reject the epoch from all channels and we also don’t want to reject these channels from all epochs, we want to be able to reject an epoch from a subset of channels. I have searched the documentation and forum but could not find a resolved way to reject an epoch from only a subset of channels, is there a way to do this?

Thanks a lot

Hello, I’ve never done this before, but you might be able to use @wmvanvliet’s MNE-FASTER to achieve what you want, or at least follow the approach that is demonstrated in the accompanying example:

It basically loops over all epochs for which you know bad channels exist, one by one; marks the bad channels as bad just for that epoch; interpolates the bad channels; and re-injects the “repaired” epoch into the set of all epochs it was originally taken from.

@agramfort @larsoner I think we should have a public API for this…

Edit We’re actually tracking this at ENH: Repair channels on a per-epoch basis · Issue #8950 · mne-tools/mne-python · GitHub

Hi,

than what would you do with this? averaging becomes a problem as you don’t have all channels
all the time for example.

Alex

I’m not sure I understand … in MNE-FASTER the approach is such that in the end, all bad channels are interpolated, meaning all epochs have the same set of (good) channels.

The tricky & interesting part is how to get there. The “default” MNE-Python approach is, mark a channel as bad globally (i.e., across all epochs); and then you may interpolate it or not.

In MNE-FASTER, you basically create new “sets” of epochs – with a set size of 1 at the time – from your input set of all epochs. This allows you to mark different channels as bad in these epochs (i.e., say you have N epochs; you split these into N Epochs instances, allowing you to have N independent sets of bads). Then, you interpolate the bad channels – again, individually for each epoch; and then you merge it all together again into a single Epochs object that now contains all epochs again, and with all problematic channels interpolated.

Thank you for your fast response Richard. We were thinking interpolating as well, but we didn’t know a way to interpolate channels for one epoch and merging these epochs. This approach makes a lot of sense, we will attempt to do that. Thanks.

Following the default rejection pipeline, we would lose lots of valuable data. Most epochs have seizures in them but only in subset of channels. Also most channels have seizure-related activity but not in all epochs. (We are rejecting seizure-related activity). But, yes, you are right unequal number of channels in epochs would be an issue for analysis later on. However, I think using the approach Richard suggested, we would end up with all epochs having the same number of channels.

there is no interpolation method for iEEG data in MNE.

so to me the problem remains.

What you want to do? estimate PSDs? connectivity measures?

ALex

Oh. Sorry, my bad. You’re right, of course.

Oh I didn’t know that, sorry.

Our analysis consists of mostly channel-specific analyses similar to ter Wal et al..

For instance, we want to look at average spectral power per area and compare conditions.

As I understood, we cannot use MNE tools out-of-the box. For example, to plot time-frequency map for a condition, we need to treat channels independently:
For each channel,

  • Drop bad epochs
  • Compute time-frequency map.

Then, average time-frequency maps over channels ourselves.

Does this approach make sense?

as long as you compare between conditions for one channel at the time I think it’s safe
but I would not compare channels with different number of good epochs blindly.

what you could do is to have one epochs object per channel?

Alex