Hi Everyone!
- MNE version: 0.24.1
- operating system: Windows 10 Pro build number: 19041.1415
I tried to filter my raw data (fif file) using mne.filter.notch_filter
.
The code:
raws = mne.io.read_raw(filepath, preload=True)
raw = mne.io.concatenate_raws(raws)
emg_channel_pick = mne.pick_types(raw.info, emg=True)
sampling_rate = raw.info['sfreq']
freqs = 50.0
raw_filtered = mne.filter.notch_filter(raw, sampling_rate, freqs, picks=emg_channel_pick)
I also tried using mne.pick_channels
for the emg_channel_picks, or not using picks at all, or writing the channel names or type directly to the command, but always got the same error.
And the error message says:
Traceback (most recent call last):
File "cmc_process.py", line 99, in <module>
raw_filtered = mne.filter.notch_filter(raw, sampling_rate, freqs, picks='emg')
File "<decorator-gen-105>", line 24, in notch_filter
File "C:\Anaconda\lib\site-packages\mne\filter.py", line 1190, in notch_filter
xf = filter_data(x, Fs, highs, lows, picks, filter_length, tb_2, tb_2,
File "<decorator-gen-103>", line 24, in filter_data
File "C:\Anaconda\lib\site-packages\mne\filter.py", line 815, in filter_data
data = _check_filterable(data)
File "C:\Anaconda\lib\site-packages\mne\filter.py", line 1374, in _check_filterable
x = np.asanyarray(x)
File "C:\Anaconda\lib\site-packages\numpy\core\_asarray.py", line 136, in asanyarray
return array(a, dtype, copy=False, order=order, subok=True)
File "C:\Anaconda\lib\site-packages\mne\io\base.py", line 807, in __getitem__
return self._getitem(item)
File "C:\Anaconda\lib\site-packages\mne\io\base.py", line 810, in _getitem
sel, start, stop = self._parse_get_set_params(item)
File "C:\Anaconda\lib\site-packages\mne\io\base.py", line 742, in _parse_get_set_params
sel = _picks_to_idx(self.info, item[0])
File "C:\Anaconda\lib\site-packages\mne\io\pick.py", line 1069, in _picks_to_idx
raise ValueError('All picks must be < n_channels (%d), got %r'
ValueError: All picks must be < n_channels (67), got 67
Thank you for any help!