raw.plot saving annotations

  • MNE-Python version: 3.8.8
  • operating system: Windows

I am trying to visualize raw EEG signal on a plot, add annotations manually and save it in a new annotation file. The plot does open, and I am able to add annotations. However, after I close out of the plot, the new annotation file does not get saved, and the code never ‘completes’ execution, as if it crashed. Any suggestions?

eog_ratio=1.0
raw.plot(color=color, order=order, block=True, highpass=1.0,
             lowpass=35.0, scalings=dict(eeg=60e-6, eog=eog_ratio*60e-6),
             n_channels=len(chans))
raw.annotations.save(str("sub_s602_m06_annot_blinks.txt"), overwrite=True)

hi,

raw.plot is a non-blocking function. It means it’s possible raw.annotations.save is called before you even start to mark your annotations.

is that a possibility?

Alex

I would think that no, since they’re passing block=True in the example code

not really an answer, but could it be the environment? → are you doing this in a simple .py script started from the terminal, or in an ipython session or a jupyter notebook?

Yes, it turned out to be the environment - it worked when I switched to using Spyder instead of jupyter notebook. Thank you for your assistance!

1 Like

Thank you for your input!

It turned out to be the environment (my reply to sappelhoff below). Thank you for the input!