When ICA, meg data can not be loaded, how to train then?

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.

Hello, you don’t have MEG and / or STIM channels in your data, so selecting the channels fails.

Ok with all due respect. I know getting started with MNE and EEG and all that stuff is really hard, but I really have the feeling you should try to find someone from your lab or institute who knows the basics of EEG and MNE, and sits down with you for a bit and goes through your analysis steps together with you. I don’t think this forum is the right place to teach you all those basics you don’t know yet. This isn’t meant to discourage you – everybody started there at one point. But without a competent person by your side, who is physically present and can help you, I believe you will have a very hard time not only getting your processing not to crash, but also to actually make it do what you want it to do (and understand what and why you need to do it).

Personally, I will stop responding to your inquiries for now, it’s just too many tiny things that are getting in your way. Of course, others are still free to respond.

Best wishes,
Richard

Great advice! Thanks so much for your time these days! I am new for mne, I learned mne for my assignment( and tomorrow will be its final presentation). I study in medical and engineering and my lab mainly study in neurons, according to your kindful suggestion, I will consult to a senior about mne systematically after the presentation and final exams.
Again, thanks for all your effort about my silly questions!

Clifford

2 Likes

Great, thanks for taking the time to learn MNE :slight_smile: Say, if we had offered some sort of a beginner’s workshop, would you have been interested in taking it? Because we’re constantly thinking about ways to make MNE more approachable to new users — we know it is hard!

Good luck for your presentation! :crossed_fingers:

Yes I would like to take it (maybe with a acceptable prize? haha.), it surely be useful for my study and work.

Thanks :smiley: