数组斯托克韦尔变换 - 元组索引超出范围
Array stockwell transform - tuple index out of range
我已经根据 table 脑电图信号构建了一个矩阵,并从该矩阵导出了一个数组。该数组是 shape(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 阵列中分别期待(纪元、通道、时间)(您提供的是 2D 阵列)。虽然文档字符串说:
The signal to transform. Any dimensionality supported as long as the last dimension is time.
... the code 似乎另有说法。
我对 EEG 数据的了解还不够多,无法说出其他任何内容,但也许这可以让您了解正在发生的事情。如果没有,我会尝试做:
tfr = tfr[None, :, :]
添加单个 'epoch' 维度(假设时间已经在 tfr
的最后一个轴上)。
我已经根据 table 脑电图信号构建了一个矩阵,并从该矩阵导出了一个数组。该数组是 shape(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 阵列中分别期待(纪元、通道、时间)(您提供的是 2D 阵列)。虽然文档字符串说:
The signal to transform. Any dimensionality supported as long as the last dimension is time.
... the code 似乎另有说法。
我对 EEG 数据的了解还不够多,无法说出其他任何内容,但也许这可以让您了解正在发生的事情。如果没有,我会尝试做:
tfr = tfr[None, :, :]
添加单个 'epoch' 维度(假设时间已经在 tfr
的最后一个轴上)。