ValueError: source space does not contain any vertices for 1 label: ['unknown-lh']

  • MNE version: 1.2
  • operating system: Ubuntu 20.04.5 LTS

Dear MNE community,

I’m trying to perform this functional connectivity tutorial using my own data:

“Compute source space connectivity and visualize it using a circular graph”

I’ve previously created the inverse operator using the fsaverage template.

However, when I run the function “spectral_connectivity_epochs”, I get the following error:

ValueError: source space does not contain any vertices for 1 label:


Here is my code:

path_epochs_Tfr = '/home/(...)/epochs_OGT_Tfr_p004_A-epo.fif'
epochs_Tfr = mne.read_epochs(path_epochs_Tfr, preload=True)
fname_inv = '/home/(...)/p004_A-inv.fif'
inverse_operator = read_inverse_operator(fname_inv)
subj = 'p004_A'


# Compute the inverse solution for this data

# Returns the sources / source activity that I’ll use in computing connectivity. 

# I can specify particular frequencies to include in the connectivity with the fmin and fmax flags. 

# mne-python does:

# reads an epoch from the raw file
# applies SSP and baseline correction
# computes the inverse to obtain a source estimate
# averages the source estimate to obtain a time series for each label
# includes the label time series in the connectivity computation
# moves to the next epoch.

# Compute inverse solution and for each epoch. By using "return_generator=True"
# stcs will be a generator object instead of a list.
snr = 1.0  # use lower SNR for single epochs
lambda2 = 1.0 / snr ** 2
method = "dSPM"  # use dSPM method (could also be MNE or sLORETA)
stcs = apply_inverse_epochs(epochs_Tfr, inverse_operator, lambda2, method,
                            pick_ori="normal", return_generator=True)

# Get labels for FreeSurfer 'aparc' cortical parcellation with 34 labels/hemi
labels = mne.read_labels_from_annot(subj, parc='aparc',

label_colors = [label.color for label in labels]

# Average the source estimates within each label using sign-flips to reduce
# signal cancellations, also here we return a generator
src = inverse_operator['src']
label_ts = mne.extract_label_time_course(
    stcs, labels, src, mode='mean_flip', return_generator=True)#, allow_empty=True)

fmin = 8.
fmax = 13.
sfreq =['sfreq']  # the sampling frequency

con_methods = ['pli', 'wpli2_debiased', 'ciplv']

con = spectral_connectivity_epochs(
    label_ts, method=con_methods, mode='multitaper', sfreq=sfreq, fmin=fmin,
    fmax=fmax, faverage=True, mt_adaptive=True, n_jobs=1)

# con is a 3D array, get the connectivity for the first (and only) freq. band
# for each method
con_res = dict()
for method, c in zip(con_methods, con):
    con_res[method] = c.get_data(output='dense')[:, :, 0]

I already read the following topic, where it’s suggested to add `allow_missing=True:

If I do it as suggested, I receive the following error, when trying to make a connectivity plot:

ValueError: node_order has to be the same length as node_names

my node_order variable has length ‘70’ and the node_names variable was not created, but the variable ‘name’ has just the string ‘unknown-lh’ in it.

Do you have any hints, why this happens? How could I proceed with my analysis?

I’d be pleased to post any additional information and would greatly appreciate any help.



Would be really great to get a feedback, I’m still struggling with this issue :slight_smile:

1 Like

What if you just drop the unknown label/s. Those aren’t important.

labels = mne.read_labels_from_annot(subj, parc=‘aparc’,

#The code is something like the following
labels = [i for i in labels if ‘unknown’ not in]



It worked greatly! Thanks a lot!!