'Program not responding' when I try to visualize

  • MNE version: e.g. 1.0.1
  • Python Version: 3.9.9
  • operating system: Windows 10
  • Using Jupyter Notebook

When I try to visualize my data, I get a pop-up screen that is supposed to display it, but before that it stops responding. The following is the code I am using:

import os.path as op
import numpy as np

import mne
from mne.datasets import eegbci
from mne.datasets import fetch_fsaverage

info = raw.info

evoked_epochs = epochs.average()

fs_dir = fetch_fsaverage(verbose = True)
subjects_dir = op.dirname(fs_dir)
src = op.join(fs_dir, 'bem', 'fsaverage-ico-5-src.fif')
bem = op.join(fs_dir, 'bem', 'fsaverage-5120-5120-5120-bem-sol.fif')

fwd = mne.make_forward_solution(info, 'fsaverage', src, bem, meg = False, eeg = True)

cov = mne.compute_raw_covariance(raw)

inv_op = mne.minimum_norm.make_inverse_operator(info, fwd, cov)

stc = mne.minimum_norm.apply_inverse(evoked_epochs, inv_op, method = 'MNE')

stc.plot(subjects_dir = subjects_dir)

It goes as far as displaying the blank surface space before not responding.

Is it plotting in line in the notebook? Maybe try adding

%matplotlib

to the top of the cell. That makes it so that matplotlib-based plots pop out of the notebook so that they can be interactive.

That seems to have solved it. Thanks!