Issue with plotting epochs

  • MNE version: 1.8.0
  • operating system: Windows 10

When I plot the epochs (epochs_stim.plot), I need to force block=True, otherwise the window that appears after running the code does not respond. Has anyone else experienced that? And do you know why it happens?

The code I run is for CTF data:

import mne

ctf_file =  r"C:\Users\user\Documents\MSc-CNS\Courses\Internship\data-thesis\sub-01\meg\squid\sub-01_ses-01_task-MedianNervesStim_squid.ds"

raw = mne.io.read_raw_ctf(ctf_file, verbose="warning")

# Define the epochs parameters
epochs_params = {
    'event_id': 1, # 1 corresponds to the stimulation trials, 4 to omission
    'tmin': -0.2,
    'tmax': 0.4,
    'baseline': (None, 0),  # equivalent to [-Inf 0] in FieldTrip
    'picks': 'meg',  # select MEG channels
    'preload': True,  # load the data into memory
}

events = mne.find_events(raw, stim_channel="UPPT001")

# Create epochs
epochs_stim = mne.Epochs(raw, events, **epochs_params)

epochs_stim.plot(block=True)

Thank you :slight_smile:

Hi, can you share the output of

import mne
mne.sys_info()

Thanks!

The output is:

Platform             Windows-10-10.0.19045-SP0
Python               3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Executable           C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe
CPU                  Intel64 Family 6 Model 140 Stepping 1, GenuineIntel (8 cores)
Memory               15.7 GB

Core
β”œβ˜’ mne               1.8.0 (outdated, release 1.9.0 is available!)
β”œβ˜‘ numpy             1.24.1 (unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl'))
β”œβ˜‘ scipy             1.12.0
β””β˜‘ matplotlib        3.6.3 (backend=QtAgg)

Numerical (optional)
β”œβ˜‘ nibabel           5.2.1
β”œβ˜‘ pandas            2.2.3
β””β˜ unavailable       sklearn, numba, nilearn, dipy, openmeeg, cupy, h5io, h5py

Visualization (optional)
β”œβ˜‘ pyqtgraph         0.13.7
β””β˜ unavailable       pyvista, pyvistaqt, vtk, qtpy, ipympl, mne-qt-browser, ipywidgets, 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, mffpy, pybv

To update to the latest supported release version to get bugfixes and improvements, visit https://mne.tools/stable/install/updating.html

Interestingly, in Pycharm it works fine, in VS code it works in the interactive window (that looks like the Jupyter notebooks) but not when I run it in the terminal or the python REPL

I get the same issue with popup windows (also when I use mne.viz.plot_topomap) when I work with the MNE development environment:

Platform             Windows-10-10.0.19045-SP0
Python               3.12.7 | packaged by conda-forge | (main, Oct  4 2024, 15:47:54) [MSC v.1941 64 bit (AMD64)]
Executable           C:\Users\user\anaconda3\envs\mnedev\python.exe
. : File C:\Users\user\Documents\WindowsPowerShell\profile.ps1 cannot be loaded because running scripts is disabled on 
this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
+ . 'C:\Users\user\Documents\WindowsPowerShell\profile.ps1'
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
CPU                  11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (8 cores)
Memory               . : File C:\Users\user\Documents\WindowsPowerShell\profile.ps1 cannot be loaded because running scripts is disabled on 
this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
+ . 'C:\Users\user\Documents\WindowsPowerShell\profile.ps1'
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
15.7 GiB
Core
 X mne               1.9.0.dev92+g460899541 (outdated, release 1.9.0 is available!)
 + numpy             1.26.4 (OpenBLAS 0.3.28 with 8 threads)
 + scipy             1.14.1
 + matplotlib        3.9.2Backend tkagg is interactive backend. Turning interactive mode on.
 (backend=qtagg)