Problem with plot_sensors_connectivity

  • MNE version: 0.24.1
  • operating system: Windows 10

I have problem in plotting connectivity in sensor space. I wrote the following code.

import mne
from mne_connectivity import spectral_connectivity
from mne.datasets import sample
from mne_connectivity.viz import plot_sensors_connectivity
import os 

raw ='../Validation/RawData For Code Validation/S3.edf', preload=True)
epochs = mne.make_fixed_length_epochs(raw, duration=2, overlap=0, preload=True)
sfreq =['sfreq']
con = spectral_connectivity(
    epochs, method='pli', mode='multitaper', sfreq=sfreq, fmin=0.5, fmax=40,
    faverage=True, mt_adaptive=False, n_jobs=1)
plot_sensors_connectivity(,con.get_data(output='dense')[:,:, 0])

I got the following error from the last line, I could not find where is the problem:

ValueError: zero-size array to reduction operation maximum which has no identity

Hi, does your data have the location of EEG. Maybe use raw.get_montage() to see that.

1 Like

Hi, Thank you so much for your help. As you guess my data had not EEG locations.