creating epochs of eeg signal using events and class labels

112 Views Asked by At

i am processing a eeg signal acquired by showing 10 image of each of 40 classes. i want to label the signals converted to epochs to their corresponding class labels.

i extracted events data as:

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 data is as

array([[      0,       0,   65280],
       [   3085,   65280,   65533],
       [  44751,   65280,   65281],
       ...,
       [4962462,   65280,   65281],
       [4974818,   65280,   65281],
       [5021696,   65280,       0]], dtype=int64)

The third col of event data is the event code, which is same 65281 for all 400 images, except the first 2 event code[65280, 65533] being the initial 10 second pause.

event_dict = []
for event, class_label in zip(events, class_labels):
  
    event_dict.append((class_label,event[2]))

print(event_dict)

The event_dict contains data

[('initial event', 65280),
 ('initial event', 65533),
 ('airliner', 65281),
 ('watch', 65281),
 ('folding chair', 65281),
 ('radio telescope', 65281),
 ('jack-o-lantern', 65281),



I am plotting the epochs to view the class labelling

 epochs.plot(n_channels=10, events=events, event_id=event_dict_as_dict)

The epochs are plotted but the label from the second last last 'Pool table is used only.[1]][1]


  [1]: https://i.stack.imgur.com/LyO0k.jpg

the epochs are not correctly labelled
0

There are 0 best solutions below