mne == 1.0.3
CODE part:
filt_raw = raw.copy().filter(l_freq=1., h_freq=None)
filt_raw.pick_types(meg=True, eeg=False, exclude='bads', stim=True).load_data()
filt_raw.filter(1, 30, fir_design='firwin')
# peak-to-peak amplitude rejection parameters
reject = dict(mag=4e-12)
# create longer and more epochs for more artifact exposure
events, _ = events_from_annotations(raw)
epochs = Epochs(raw, events=events, event_id=event_id, tmin=-1, tmax=4, proj=True, picks=picks,
baseline=None, preload=True)
ica = ICA(n_components=15, method='fastica', max_iter="auto").fit(epochs)
ecg_epochs = create_ecg_epochs(filt_raw, tmin=-.5, tmax=.5)
ecg_inds, scores = ica.find_bads_ecg(ecg_epochs, threshold='auto')
ica.plot_components(ecg_inds)
error text:
Traceback (most recent call last):
File "C:\Users\22100\Desktop\SCNS3\code\AfterPCA.py", line 79, in <module>
filt_raw.pick_types(meg=True, eeg=False, exclude='bads', stim=True).load_data()
File "<decorator-gen-44>", line 12, in pick_types
File "C:\Users\22100\PycharmProjects\pythonProject\venv\lib\site-packages\mne\channels\channels.py", line 678, in pick_types
self._pick_drop_channels(idx)
File "<decorator-gen-46>", line 12, in _pick_drop_channels
File "C:\Users\22100\PycharmProjects\pythonProject\venv\lib\site-packages\mne\channels\channels.py", line 856, in _pick_drop_channels
pick_info(self.info, idx, copy=False)
File "<decorator-gen-9>", line 12, in pick_info
File "C:\Users\22100\PycharmProjects\pythonProject\venv\lib\site-packages\mne\io\pick.py", line 538, in pick_info
raise ValueError('No channels match the selection.')
ValueError: No channels match the selection.