Python 数组stockwell变换-元组索引超出范围
我从脑电信号表中构造了一个矩阵,并从矩阵中导出了一个数组。数组是形状(4097*100)但当我在数组stockwell变换函数中传递此数组时,我得到一个错误:元组索引超出范围Python 数组stockwell变换-元组索引超出范围,python,numpy,machine-learning,signal-processing,Python,Numpy,Machine Learning,Signal Processing,我从脑电信号表中构造了一个矩阵,并从矩阵中导出了一个数组。数组是形状(4097*100)但当我在数组stockwell变换函数中传递此数组时,我得到一个错误:元组索引超出范围 #data1 = np.asarray(matrix) matrix.shape (4097, 100) tfr = tfr_array_stockwell(matrix,173) IndexError Traceback (most recent cal
#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
#data1=np.asarray(矩阵)
矩阵形状(4097100)
tfr=tfr\u阵列\u斯托克韦尔(矩阵,173)
索引器回溯(最后一次调用)
1#数据1=np.asarray(矩阵)
2.
---->3 tfr=tfr\u阵列\u斯托克韦尔(矩阵,173)
tfr\u数组中的~/.local/lib/python3.6/site-packages/mne/time\u frequency//u stockwell.py\u stockwell(数据、sfreq、fmin、fmax、n\u fft、宽度、分米、返回itc、n\u作业)
170 """
171 n_时代,n_通道=数据。形状[:2]
-->172 n_out=data.shape[2]//decim+bool(data.shape[2]%decim)
173数据,n\u fft,零焊盘=\u检查\u输入\u st(数据,n\u fft)
174
索引器错误:元组索引超出范围
#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
看起来它在3D数组(您提供的是2D数组)中分别出现(时代、频道、时间)。尽管文档字符串中说:
要转换的信号。只要最后一个维度是时间,就支持任何维度
……似乎不是这样说的
我对脑电图数据的了解还不够多,不能说其他任何事情,但也许这会给你一个线索,告诉你发生了什么。如果没有,我会尝试:
tfr = tfr[None, :, :]
添加单个“历元”维度(假设时间已经在tfr
的最后一个轴上)