mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

Dissapearing annotations

Open MaxNentwich opened this issue 1 month ago • 3 comments

Description of the problem

Hi,

I just updated to the current stable version (1.11.0 from 1.9.0), because I wanted to use the 'annotation_regex' argument in the plot function, which is very useful.

However, when editing annotations, moving some around in time, removing others, adding some, all exisiting annotations dissapear at some point.

Can work around this adding annotions after plotting, but seems like a bug.

I plot a raw object and edit in the GUI (see code below).

The screenshots attached show the annotations before editing. I edit 'BAD_' annotations as some artifacts are taken care of by rereferencing. The other trial based annotations are hidden in the plot, but are somehow deleted.

Best, Max

Steps to reproduce

fig = ieeg_preproc.plot(show=True, block=True, remove_dc=True, 
                                duration=15.0, n_channels=16, 
                                annotation_regex='BAD_',
                                title='{:s} - preprocessed'.format(file))

Link to data

No response

Expected results

Image

Actual results

Image

Additional information

Platform Linux-6.14.0-35-generic-x86_64-with-glibc2.39 Python 3.13.3 | packaged by conda-forge | (main, Apr 14 2025, 20:44:03) [GCC 13.3.0] Executable /home/max/miniconda3/envs/ieeg2nwb/bin/python CPU 13th Gen Intel(R) Core(TM) i9-13900KF (32 cores) Memory 125.6 GiB

Core ├☑ mne 1.11.0 (latest release) ├☑ numpy 2.2.5 (OpenBLAS 0.3.28 with 32 threads) ├☑ scipy 1.15.2 └☑ matplotlib 3.10.1 (backend=qtagg)

Numerical (optional) ├☑ sklearn 1.6.1 ├☑ numba 0.61.2 ├☑ nibabel 5.3.2 ├☑ nilearn 0.11.1 ├☑ pandas 2.2.3 ├☑ h5py 3.13.0 └☐ unavailable dipy, openmeeg, cupy, h5io

Visualization (optional) ├☑ pyvista 0.45.2 (OpenGL 4.5.0 NVIDIA 580.95.05 via NVIDIA GeForce RTX 3060/PCIe/SSE2) ├☑ pyvistaqt 0.11.2 ├☑ vtk 9.4.2 ├☑ qtpy 2.4.3 (PyQt5=5.15.14) ├☑ ipywidgets 8.1.7 └☐ unavailable ipympl, pyqtgraph, mne-qt-browser, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional) └☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, curryreader, mffpy, pybv, antio, defusedxml

MaxNentwich avatar Nov 26 '25 19:11 MaxNentwich

I suspect it has to do with the annotation_regex... it's likely that interacting with that subset of annotations won't index properly back into the original raw.annotations to update them or something similar

larsoner avatar Nov 26 '25 19:11 larsoner

The issue is specfic to the matplotlib backend. I installed the 'mne-qt-browser' and set the backend with 'mne.viz.set_browser_backend('qt')'. Didn't experience any issues with that.

MaxNentwich avatar Nov 26 '25 21:11 MaxNentwich

I can't replicate this on windows? @MaxNentwich Could you please tell me if you have any idea on how to replicate the same on Windows 11? So that I can understand this better and start working on a fix.

1himan avatar Dec 06 '25 08:12 1himan