【问题标题】:Array stockwell transform - tuple index out of range数组斯托克韦尔变换 - 元组索引超出范围
【发布时间】:2019-09-12 08:33:53
【问题描述】:

我已经从 EEG 信号表中构建了一个矩阵,并从该矩阵中导出了一个数组。数组是 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: 元组索引超出范围

【问题讨论】:

    标签: python numpy machine-learning signal-processing


    【解决方案1】:

    看起来它分别在 3D 数组(您提供的是 2D 数组)中期望(时期、通道、时间)。虽然文档字符串说:

    要转换的信号。只要最后一个维度是时间,就支持任何维度。

    ...the code 似乎另有说法。

    我对 EEG 数据了解得不够多,无法说其他任何内容,但也许这可以让您了解正在发生的事情。如果没有,我会尝试这样做:

    tfr = tfr[None, :, :]
    

    添加一个“纪元”维度(假设时间已经在tfr 的最后一个轴上)。

    【讨论】:

      猜你喜欢
      • 2015-02-21
      • 1970-01-01
      • 1970-01-01
      • 2013-07-28
      • 2021-03-02
      • 2018-11-16
      • 2016-04-04
      • 2020-06-08
      相关资源
      最近更新 更多