Extracting data from clusters with bad electrodes

  • MNE version: 1.7.0
  • operating system: Windows 10

Hi everyone,

While extracting ERP mean amplitudes, I used to pass explicit channel lists to
evoked.pick(), then computed evoked.data.mean(axis=1).

Some participants had channels in that list marked as bad. pick() included them,
and their artefacted values appeared in .data instead of being ignored (as I expected).

I’ve now returned to using evoked.copy().pick(“eeg”, exclude=“bads”) which solves this issue, and I know I may want to interpolate at an earlier point, but in case others like me end up with a specific pick and expected the bads to be ignored, would a warning be relevant? (In either pick and/or data()?)

Example:

cluster = ["F1", "Fz", "F2", "FC1", "FCz", "FC2"]  # FC2 marked as bad
evoked_cropped = evoked.copy().pick(cluster).crop(tmin=0.3, tmax=0.4)
mean_amp = evoked_cropped.data.mean(axis=1) * 1e6
# FC2 row included with artefacted value — no warning raised

I’m not sure whether this was addressed before though have seen this post

Thanks

Arthur

Hi Arthur,

thanks for bringing this up.
I agree that a warning would be useful, but let me discuss this with the other maintainers.

JFYI: There has been some discussion on .picks() and the default behaviour.

I will get back to you after discussing this and let you know if it makes sense to open an issue or a pull request (if you would like to implement that).

Cheers,

Carina

Update:
I opened a new issue related to your post. Let us know if you want to work on that proposed refactoring.

We also noticed that you are using an old MNE version (1.7.0). You might want to consider updating to a more recent version (1.12) to get the latest features.