- MNE version: 1.1.1
- operating system: ManjaroLinux 21.3.6
I want to rename my annotations. Calling mne.events_from_annotations
I can see that the event_id variable looks like this
{
'New Segment/': 99999,
'Stimulus/S240': 240,
'Stimulus/S241': 241,
'Stimulus/S242': 242,
'Stimulus/S243': 243,
'Stimulus/S244': 244,
'Stimulus/S245': 245,
'Stimulus/S246': 246,
'Stimulus/S247': 247
}
as the keys are not good descriptors I want to rename the annotations by using mne.annotations.rename
EEG.annotations.rename({'Stimulus/S240': 'Rest',
'Stimulus/S241': 'Right/Open',
'Stimulus/S242': 'Right/Close',
'Stimulus/S243': 'Right/Two',
'Stimulus/S244': 'Left/Open',
'Stimulus/S245': 'Left/Close',
'Stimulus/S246': 'Left/Two',
'Stimulus/S247': 'Prepare'})
which changes the event_id variable to
{
'Left/Close': 10001,
'Left/Open': 10002,
'Left/Two': 10003,
'New Segment/': 99999,
'Prepare': 10004,
'Rest': 10005,
'Right/Close': 10006,
'Right/Open': 10007,
'Right/Two': 10008
}
as you will notice, while the keys changed, the values did too. However, I want to preserve the values. Why does mne.annotations.rename
behave like this and how to handle this?
EDIT:
I noticed that this also happens when saving a raw file to fif with fmt=‘double’. After loading the file, the values have changed.