Hello MNE community!
I’ve been trying to compute EEG connectivity over epoched data from the eegbci dataset but encountered an error while using the mne_connectivity.spectral_connectivity_time() function.
Here is my code:
# loading preprocessed BIDS data
data = mne.io.read_raw_brainvision(vhdr_fname = "C:/...BIDS_preprocessed/...sub-001_ses-03_task-T1f_eeg.vhdr",preload = True)
data.set_montage('standard_1020');
data_csd = mne.preprocessing.compute_current_source_density(data)
# raw into epochs
events = mne.events_from_annotations(data_csd)
t0_epochs = mne.Epochs(data, events[0], event_id = 1, preload = True)
average_t0 = t0_epochs.average()
# computing PLI
alpha_fr = np.arange(8, 13.5, 0.5)
con_t0 = mne_connectivity.spectral_connectivity_time(
data = average_t0,
freqs = alpha_fr,
method = 'pli',
fmin = 8.0,
fmax = 13.0
)
The error which I encounter while using the mne_connectivity.spectral_connectivity_time() function is the following:
ValueError: not enough values to unpack (expected 3, got 0)
I also tried to give unaveraged data to the funciton and setting the parameter average = True, but then another error occurs:
con_t0 = mne_connectivity.spectral_connectivity_time(
data = t0_epochs,
freqs = alpha_fr,
method = 'pli',
average = True,
fmin = 8.0,
fmax = 13.0
)
ValueError: At least one value in n_cycles corresponds to a
wavelet longer than the signal. Use less cycles,
higher frequencies, or longer epochs.
This is my first time analyzing epoched EEG data and I’m slightly puzzled. I will be grateful for some help.
If it is of any use, the average_t0.get_data().shape gives (64, 113). Also, the preprocessed BIDS file can be found here.
- MNE version: 1.6.1
- operating system: Windows 11