How to change the annotations/events of EEG data with MNE

Dear MNE experts,

I’m using MNE to process EEG/ERP data and need to change the annotations/events of the raw data. I changed the values and ID of events and saved the raw data as a new file. But when I load the data again, the events data I saved seems changed. Did you guys encounter this kind of problem?

The codes I used to change the events and id are as follows:
raw = read_raw_edf(f,preload=True)
events, event_id = mne.events_from_annotations(raw)
events = [[177239,0,2],
[183835,0,2],
[190428,0,2]]
event_id = {‘Left’:1,‘Right’:2}

  • MNE version: mne 1.0.3
  • operating system: Windows 10

How did you save to a new file? Did you export to EDF or save to FIFF?

I exported it to an EDF file

Events are not preserved when exporting to EDF. You need to edit the annotations and then export to EDF. What exactly do you want to change?