Hello, I’m trying to calculate the spectral connectivity between my electrodes from an EEG.fif file (already fully pre-processed and concatenated to contain only the participant’s eyes closed resting state data in a block sense without epochs) with the function mne_connectivity. SpectralConnectivity function, but I get the following error message: ‘ValueError: cannot reshape array of size 10682485 into shape (121,121,88285)’. I understand that there’s a shape compatibility problem between my arrays, but I don’t understand why.
- MNE version: 1.6.1
- operating system: Windows 10
import pandas as pd
import numpy as np
import seaborn as sns
import os.path as op
import mne
from mne_connectivity import SpectralConnectivity
from mne_connectivity.viz import plot_sensors_connectivity
eeg_file = 'REC-190517-B-RS_eeg.fif'
#ch_names = np.loadtxt('ch_names.txt', dtype=str)
beta_band = [14, 30]
raw = mne.io.read_raw_fif(eeg_file, preload=True)
raw = raw.drop_channels(['E14', 'E17', 'E21', 'E48', 'E119', 'E126', 'E127'])
start_time = raw.times[0] + 1.0
end_time = raw.times[-1] - 1.0
raw_band = raw.crop(tmin=start_time, tmax=end_time)
freqs = np.linspace(beta_band[0], beta_band[1], num=raw_band.n_times)
raw_band=raw_band.get_data()
connectivity = SpectralConnectivity(raw_band, n_nodes=121, freqs=freqs, spec_method='welch', method='coh')
Connectivity_band=connectivity.get_data()
Error message : ValueError: cannot reshape array of size 10682485 into shape (121,121,88285)