I am new to EEG data preprocessing and have some rather basic questions:
Autoreject seems to be recommended in the previous questions for excluding bad channels. However, it only works on epoched data.
Is there a way to detect bad channels automatically on raw data (I thought marking them at the very beginning of the preprocessing would be best)?
Is there anything against running an auto-detection of bad channels on raw data? Why does it not seem to be common/easily implemented?
P.S. I also tried find_bad_channels_maxwell, but even when I played around with the threshold it did not detect visually bad channels.
My raw data (BrainVision) did not include any “bads”.
When does raw.info[“bads”] initially include the bad channels?
Is that something often manually done during data collection, or do software other than BrainVision do online detection and store it in the raw data during collection?
Hi Deniz,
Personally I always, in the first place, investigate visually the data.
MNE plots has a great graphic user interface in which you can select manually which channels are bad (by clicking on them).
There is a great tutorial here: Handling bad channels — MNE 1.6.0 documentation
For a more “unsupervised” way I would suggest you to take a look at the prep algorithm ref. Here is the python package.
I would recommend to read your EEG trace to be able to recognize artifacts and bad channels by eyes before jumping in more automated way.
find_bad_channels_maxwell only works for MEG sensors. It relies on the fact of a spherical shell of space between the brain sources and the sensors; with on-scalp EEG sensors you cannot construct such a sphere.
Yes, I use pyprep, which works quite well for my data. I commonly call the find_bad_by_correlation(), find_bad_by_deviation(), and find_bad_by_ransac() methods, in that order. Before that, I also mark break periods as “bad” via annotate_break(), but I’m not sure if that even matters to pyprep.
Do you then exclude any channel that is bad by any of the three methods (or, for example, if only found bad by more than one…)?
Somehow these functions found channels that did not look all that bad to my bear eyes (could be that my eyes are not trained enough), what do you do in such a scenario?
I followed the steps on this tutorial for ransac (Run RANSAC — pyprep 0.4.3+7.ge4840d9 documentation), interestingly, this method did not find any bad channels for any of my participants. I wonder if I did something wrong (do I need to mark bads found by the previous two functions) or if the method is just more conservative?
noisy_data = NoisyChannels(raw_resampled_line_reref, random_state=1337)
# find bad by corr
noisy_data.find_bad_by_correlation()
print(noisy_data.bad_by_correlation)
# find bad by deviation
noisy_data.find_bad_by_deviation()
print(noisy_data.bad_by_deviation)
#find bad by ransac: finds nothing, do I first have to mark bads from the methods before?
noisy_data.find_bad_by_ransac(channel_wise=True, max_chunk_size=1)
print(noisy_data.bad_by_ransac)
in the original PREP pipeline, RANSAC is the last step of finding bad channels and it is run on data that is already “cleaned” by the additional steps for finding bad channels in the PREP pipeline. So yes, perhaps you do need to run the steps in order for this algorithm to produce meaningful results. I don’t know though. A good reference might be the paper: https://doi.org/10.3389/fninf.2015.00016