Annotation Plot Error

  • MNE version: 1.0.3
  • operating system: Windows 10

Hello all,

I have been running into an issue with the annotation of the plot. After I raw.plot() and press “a” to get the annotation menu. If I click “Add Description” if completely freezes the plot permanently. The only way to stop it is to go into task manager. I have been trying to add a “BAD” description to cut out a bad portion of data, but whenever I try I freeze the program. I would like to add that MNE and spyder still function fine, but all plots that have been made are frozen. And yes, I am plotting in a separate window from spyder if that is a possible source of the issue.
Has any one else seen this and is their a way around it.

as a side note I have also found that the plot itself seems backwards in color. With the offset of raw.plot(bgcolor=‘w’, color=‘k’) I get a black background with white traces. If I type in the opposite raw.plot(bgcolor=‘k’, color=‘w’) I get a white background with black traces.

Best,
Matt

I have the same problem, have you found a fix for this?

I am working on a mac OS, and the MNE version is 1.3.0

Hi @Dannapnt1, unfortunately no, I have not found a solution. I just found a different way to preprocess the data to avoid needing to add annotations.

Hello @Dannapnt1, welcome to the forum!

Could you please share the output of:

import mne
mne.sys_info()

This may help us narrow down the problem. Also, how do you run your MNE script? From the command line? From a development environment? Which one?

Thanks!

Richard

Hi @richard I am running this on the Spyder development environment. This is the output

Platform: macOS-10.16-x86_64-i386-64bit
Python: 3.8.15 | packaged by conda-forge | (default, Nov 22 2022, 08:53:40) [Clang 14.0.6 ]
Executable: /Users/dannapinto1/opt/anaconda3/envs/mne/bin/python
CPU: i386: 4 cores
Memory: 8.0 GB

mne: 1.3.0
numpy: 1.23.5 {OpenBLAS 0.3.21 with 4 threads}
scipy: 1.10.0
matplotlib: 3.6.2 {backend=Qt5Agg}

sklearn: 1.2.0
numba: 0.56.4
nibabel: 4.0.2
nilearn: 0.10.0
dipy: 1.5.0
openmeeg: 2.5.5
cupy: Not found
pandas: 1.5.2
pyvista: 0.37.0 {OpenGL 4.1 INTEL-18.8.5 via Intel(R) Iris™ Graphics 6100}
pyvistaqt: 0.9.0
ipyvtklink: 0.2.3
vtk: 9.2.5
qtpy: 2.3.0 {PyQt5=5.15.6}
ipympl: Not found
pyqtgraph: 0.13.1
pooch: v1.6.0

mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: 0.4.0
mne_connectivity: Not found
mne_icalabel: Not found

I cannot reproduce this with MNE-Python 1.3.0 with the mne-qt-browser backend on macOS:

# %%
import mne

sample_dir = mne.datasets.sample.data_path()
sample_fname = sample_dir / 'MEG' / 'sample' / 'sample_audvis_raw.fif'

raw = mne.io.read_raw_fif(sample_fname, preload=True)
raw.crop(tmax=60)

with mne.viz.use_browser_backend('qt'):
    raw.plot(bgcolor='k', color='w')

produces a figure with black background an white traces.

Regarding the problem with the qt-browser backend when running from Spyder, maybe @marsipu has an idea?

Best wishes,
Richard

I don’t really have an idea for a solution. I just remembered another Spyder-related issue, that was solely appearing when starting from a spyder-console. It was resolved over time by unknown cause. @Dannapnt1 Are you running on the latest spyder-kernels?

Hi @richard, Yes, I believe this particular issue with the coloring of the plots is due to one of the spyder preferences for dark mode, particularly for the editor being changed in an update. Although the typical color change schemes in preferences in the appearances menu of is still there, but there was another color scheme option in the editor menu of the preferences that controlled plots in separate windows. It seems to have disappeared in newer versions of spyder. I did use the Windows download MNE package, so I figured this might be a problem others are having but it could also just be the alignment of the different anaconda dependencies on my computer. I only get this on my windows machine, my linux cluster does not have this problem.

As for the freezing when I try to annotate and add a new annotation description, that happens for me on both windows and linux.

yes, I very recently updated to the most current version. I think I will try to run this from the terminal and see what happens.

Hello,

It’s difficult to debug from the information provided. I use Spyder on all 3 OS, and I can not reproduce the issue.

@marsipu The issue you mentioned was resolved by remove add/remove objects for view-range by marsipu · Pull Request #139 · mne-tools/mne-qt-browser · GitHub

Mathieu

1 Like