hi everyone,
iâm trying to subselect epochs by condition. my event descriptions are pretty long because ideally i want to be able to subselect different parts of my data. a selection from the events dictionary below:
âCW/fill/adv/close/mv/malinâ: 1220,
âCW/stim/adv/dist/g/furieuxâ: 1129,
âonset/stim/adj/close/mg/luxurianteâ: 49,
iâve annotated my raw data and can see the annotations when i plot my data. however when i make my epochs and try to select a subsection with epochs['onset']
to take out only the epochs that fall into condition âonsetâ i get the error message below.
it seems like itâs looking in the trigger codes and not the descriptions, but when i go back a few steps to where i created the annotations, using
event_annotations = mne.annotations_from_events(events=events, sfreq=rawmff.info['sfreq'], orig_time=rawmff.info['meas_date'], event_desc=eventsdict, verbose=True)
rawmff.set_annotations(rawmff.annotations + event_annotations)
and i try to FLIP the keys and the values in my event_desc=eventsdict dictionary, i get an error âTypeError: Event names must be an instance of str or None, got <class âintâ> instead.â. so the structure of my dictionary seems to be correct - i create the annotations ok. itâs just after, when i try to use them in the epoched data, i canât seem to get through to them.
mne v. 1.2.3, mac os 12.3.1.
many thanks for your help,
bissera
âTraceback (most recent call last):
File â/Users/ivanova/opt/anaconda3/envs/eegProc/lib/python3.9/site-packages/IPython/core/interactiveshell.pyâ, line 3433, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File ââ, line 1, in
epochsreref[âonsetâ]
File â/Users/ivanova/opt/anaconda3/envs/eegProc/lib/python3.9/site-packages/mne/utils/mixin.pyâ, line 144, in getitem
return self._getitem(item)
File â/Users/ivanova/opt/anaconda3/envs/eegProc/lib/python3.9/site-packages/mne/utils/mixin.pyâ, line 195, in _getitem
select = inst._item_to_select(item)
File â/Users/ivanova/opt/anaconda3/envs/eegProc/lib/python3.9/site-packages/mne/utils/mixin.pyâ, line 153, in _item_to_select
select = self._keys_to_idx(item)
File â/Users/ivanova/opt/anaconda3/envs/eegProc/lib/python3.9/site-packages/mne/utils/mixin.pyâ, line 242, in _keys_to_idx
for k in match_event_names(self.event_id, keys)]),
File â/Users/ivanova/opt/anaconda3/envs/eegProc/lib/python3.9/site-packages/mne/event.pyâ, line 1493, in match_event_names
_on_missing(
File â/Users/ivanova/opt/anaconda3/envs/eegProc/lib/python3.9/site-packages/mne/utils/check.pyâ, line 991, in _on_missing
raise error_klass(msg)
KeyError: âEvent name âonsetâ could not be found. The following events are present in the data: 10, 11, 12, 13, 14, 15, MY HUNDRED TRIGGER CODES, 1219, 1220, 1221, 1222, 1223, 1224â
/Applications/DataSpell.app/Contents/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_utils.py:609: FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.
for item in s.iteritems():â