- MNE version: e.g. 1.2.1
- operating system: Windows 10
I think I’ve found a bug in the find_bads_muscle algorithm.
I have a 19 channel raw eeg file, 2 of which I have manually marked as bad channels, i.e.
raw.info['bads'] = ['Fp4', 'C3']. When I pass it to the ICA these two channels are excluded correctly:
Fitting ICA to data using 17 channels (please be patient, this may take a while).
However, when I call the
ica.find_bads_muscle(raw) function, the following AssertionError is thrown:
File "***\lib\site-packages\mne\preprocessing\ica.py", line 1791, in find_bads_muscle assert pos.shape == components.shape # pos for each sensor
When debugging, I check that
shape(components) == (17, 17) and
shape(pos) == (19, 2). Logic tells me that pos should have 17 rows, not 19, so it is not taking into account the bad channels.
For my code to work, it is not enough to temporarily remove the bad channels, i.e.
raw.info['bads'] = , but I must remove them completely by
drop_channels (using a
Can you tell me if this is indeed a bug?
Thank you very much!