Dear mne team,
I tried to replicate the following example " Permutation statistic for time-frequencies"
I met a problem when I ran:
cluster_stats = spatio_temporal_cluster_test(X, n_permutations=1000, threshold=tfr_threshold, tail=1, n_jobs=1,
buffer_size=None, adjacency=tfr_adjacency)
With the following error message " n_samples, n_times, n_vertices = X[0].shape
ValueError: too many values to unpack (expected 3)"
Could you help me to resolve this issue ?
Thank in advance
W
the code:
#Permutation statistic for time-frequencies
decim = 4
freqs = np.arange(7, 30, 3) # define frequencies of interest
n_cycles = freqs / freqs[0]
epochs_power = list()
for condition in [Sound_3_R1_R04[k] for k in ('3001', '3004')]:
this_tfr = tfr_morlet(condition, freqs, n_cycles=n_cycles,
decim=decim, average=False, return_itc=False)
this_tfr.apply_baseline(mode='ratio', baseline=(None, 0))
epochs_power.append(this_tfr.data)
# transpose again to (epochs, frequencies, times, channels)
X = [np.transpose(x, (0, 2, 3, 1)) for x in epochs_power]
adjacency, ch_names = find_ch_adjacency(Sound_3_R1_R04.info, ch_type='eeg')
# our data at each observation is of shape frequencies × times × channels
tfr_adjacency = combine_adjacency(
len(freqs), len(this_tfr.times), adjacency)
# This time we don't calculate a threshold based on the F distribution.
# We might as well select an arbitrary threshold for cluster forming
tfr_threshold = 15.0
# run cluster based permutation analysis
cluster_stats = spatio_temporal_cluster_test(X, n_permutations=1000, threshold=tfr_threshold, tail=1, n_jobs=1,
buffer_size=None, adjacency=tfr_adjacency)