- MNE version: 1.3.0
- Operating system: Windows 10
We ran a task that should have 5 different types of triggers (annotations). However, for some reason, the system only acknowledges 3 annotation types and mislabels some of the events. We are able to correct these in Homer3, but the changes are not reflected in the .snirf file when it’s brought into the MNE platform. I guess this question is two-fold:
1. When trying to view the annotation events, we can see our 15 events reflected when we simply run it with the mislabeled 3 annotation categories (so we can see the 15 events, but they are mislabeled):
events, event_dict = mne.events_from_annotations(raw_intensity, verbose=False)
events, event_dict = mne.events_from_annotations(raw_intensity, verbose=False)
plt.rcParams["figure.figsize"] = (10, 6) # (w, h)
mne.viz.plot_events(events, event_id=event_dict, sfreq=raw_intensity.info['sfreq']);
As mentioned above, we thought we would be able to correct these in Homer3 and using that updated .snirf file with MNE. This obviously did not work the way we wanted:
events, event_dict = mne.events_from_annotations(raw_intensity, verbose=False)
event_dict = {'Happy': 1, 'Sad': 2, 'Anger': 3, 'Disgust': 4, 'Fear': 5}
plt.rcParams["figure.figsize"] = (10, 6) # (w, h)
mne.viz.plot_events(events, event_id=event_dict, sfreq=raw_intensity.info['sfreq']);
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_10380\1458976040.py in <cell line: 2>()
1 plt.rcParams["figure.figsize"] = (10, 6) # (w, h)
----> 2 mne.viz.plot_events(events, event_id=event_dict, sfreq=raw_intensity.info['sfreq']);
<decorator-gen-153> in plot_events(events, sfreq, first_samp, color, event_id, axes, equal_spacing, show, on_missing, verbose)
~\mne-python\1.3.0_0\lib\site-packages\mne\viz\misc.py in plot_events(events, sfreq, first_samp, color, event_id, axes, equal_spacing, show, on_missing, verbose)
689 if this_event not in unique_events:
690 msg = f'{this_event} from event_id is not present in events.'
--> 691 _on_missing(on_missing, msg)
692 keep[ii] = False
693 conditions = [cond for cond, k in zip(conditions, keep) if k]
~\mne-python\1.3.0_0\lib\site-packages\mne\utils\check.py in _on_missing(on_missing, msg, name, error_klass)
1038 on_missing = 'warn' if on_missing == 'warning' else on_missing
1039 if on_missing == 'raise':
-> 1040 raise error_klass(msg)
1041 elif on_missing == 'warn':
1042 warn(msg)
ValueError: 4 from event_id is not present in events.
2. This brings us to the second part:
A. How do we get the .snirf file in MNE to reflect the changes made in Homer3? OR
B. How do we relabel the annotations in MNE and be able to visualize it on a plot (for confirmation purposes)?
Any help on this would be greatly appreciated. We are kind of on a time crunch.
Thank you in advance for your wisdom (because as you can see, it’s seriously lacking on my end…)!
– Pratt
UPDATE: We are able to change the annotations on interactive plots which then carries out throughout the scripts. However, when it gets to epoch analyses, the annotations are shown as the original incorrect ones. Any help would be greatly appreciated!