我从脑电信号表中构造了一个矩阵,并从矩阵中导出了一个数组。数组是形状(4097*100)但是当我在数组stockwell变换函数中传递这个数组时,我得到一个错误:元组索引超出范围
#data1 = np.asarray(matrix)
matrix.shape (4097, 100)
tfr = tfr_array_stockwell(matrix,173)
IndexError Traceback (most recent call last) <ipython-input-78-abab5d5223f4> in <module>
1 #data1 = np.asarray(matrix)
2
----> 3 tfr = tfr_array_stockwell(matrix,173)
~/.local/lib/python3.6/site-packages/mne/time_frequency/_stockwell.py in tfr_array_stockwell(data, sfreq, fmin, fmax, n_fft, width, decim, return_itc, n_jobs)
170 """
171 n_epochs, n_channels = data.shape[:2]
--> 172 n_out = data.shape[2] // decim + bool(data.shape[2] % decim)
173 data, n_fft_, zero_pad = _check_input_st(data, n_fft)
174
IndexError: tuple index out of range
看起来它在一个3D数组中分别期望(epochs、channels、time)(您提供的是一个2D数组)。尽管文件上说:
。。。the code似乎不是这样说的。你知道吗
我对脑电数据了解不够,所以不能说别的,但也许这能给你一个线索。如果没有,我会尝试做:
添加单个“epoch”维度(假设时间已经在
tfr
的最后一个轴上)。你知道吗相关问题 更多 >
编程相关推荐