I am processing an EEG signal acquired by showing 10 image of each of 40 different classes. I want to label the signals converted to epochs to their corresponding class labels.
raw = mne.io.read_raw_bdf(raw_file, preload =True)
events=mne.find_events(raw, stim_channel = None,
initial_event = True, consecutive='increasing', output='step',
uint_cast=True, verbose=None)
The events return
array([[ 0, 0, 65280],
[ 3085, 65280, 65533],
[ 44751, 65280, 65281],
...,
[4962462, 65280, 65281],
[4974818, 65280, 65281],
[5021696, 65280, 0]], dtype=int64)
The third column from events is the event code, that are the same for all events 65281, except for initial event.
I made an event dict, by combining the events[2], and the class labels which were shown:
event_dictt = []
for event, class_label in zip(events, class_labels):
event_dictt.append((class_label,event[2]))
print(event_dictt)
The event_dictt
is a list that contains data
[('initial event', 65280), ('initial event', 65533), ('airliner', 65281), ('watch', 65281), ('folding chair', 65281), ('radio telescope', 65281), ('jack-o-lantern', 65281),
As i plot the epochs to view the class labelling
epochs.plot(n_channels=10, events=events, event_id=event_dictt)
I gives the error
event_id[0] must be an int, got <class ‘tuple’>
if i convert the event_dictt to a dictionary, the epochs.plot works but the epoch labelling is incorrect,The epochs are plotted but the label from the second last class label ‘Pool table’ is used only:
All initial class labels are ignored.
The epochs are not correctly labelled