MNE version: 1.1.1
Operating system: macOS 11.2.3
Hi there!
I am trying to create an event dictionary, however, I am running into some problems. For each event of interest (i.e.: 222) I have three preceedings event IDs which encode item number, sentence version, and condition information respectively. I am interested in the condition information only. More precisely, for each event 222, I want to concatenate the previous value, thus creating my conditions, namely 222 - 101; 222 - 109; 222 - 201; 222 - 209. I cannot seem to find any information about working with these types of event IDs as I have noticed that event IDs are usually not repeated. I have concatenated all 222 with their previous value, so for each 222, I get the condition value attached. However, I am not sure if this would allow me to create an event dictionary. I am including my code below. I would highly appreciate any help you might want to share!
##load data and find events
data_path = ('/xx/xx/xx/xx.vhdr')
raw = mne.io.read_raw(''/xx/xx/xx/xx.vhdr'', preload=True)
events = mne.events_from_annotations(raw)
raw.pick_types(meg=False, stim=False, eog=False, eeg=True)
print(events)
##list of line index where the third column == 222
index = [i for i, x in enumerate(events[0]) if x[2] == 222]
print(index)
##build item concatenating 222 and condition
item_by_condition = []
for i in index:
item = ['{} - {}'.format('222', events[0][i - 1][2]), events[0][i][0]],
item_by_condition.append(item)
print(item_by_condition)
[(['222 - 201', 4739],), (['222 - 101', 9067],), (['222 - 109', 13712],), (['222 - 209', 18040],), (['222 - 109', 22685],), ....
##create event dictionary
event_dict = {'reg_correct': 222-201, 'reg_incor': 222-109, 'irreg_correct': 222-201,
'irreg_incorrect': 222-209}