我在256Hz的频率下采集了64个通道的脑电数据,我试图对每个通道进行时频分析并绘制一个频谱图。
数据存储在numpy 3d阵列中,其中一个维度的长度为256,每个元素包含在所有采样时间点上读取的微伏(每个数据通道的总长度为1秒)。
需要说明的是:我的3D阵列是64*256*913(电极*电压*试用)。试验只是试验的单一试验。所以我想做的是,从一次试验中,取一个单一的电极,和整个一维电压矢量,并创建一个时频谱图。例如,我想从数据[0,:,0]创建一个光谱图。
对于每个元素,我想要一个图,其中y轴是频率,x轴是时间,颜色/强度是功率
我在python中试过使用这个:
from matplotlib.pyplot import specgram
#data = np.random.rand(256)
specgram(data, NFFT=256, Fs=256)
这给了我这样的东西:
在我看来这是不正确的,因为轴的范围是不正确的
此外,当我对所有的EEG通道运行相同的代码时,在所有的数据上,我得到的是完全相同的图(即使我已经验证了每个通道的数据是不同的)
我对信号处理还不太熟悉,我的数据是如何布局的,还是如何使用我的函数,有什么地方出了问题吗?
从
specgram
函数的documentation:看起来你的问题是你没有传递一维数据。尝试:
相关问题 更多 >
编程相关推荐