使用MNE包计算Stockwell变换的语法?

2024-06-28 19:35:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试计算EEG信号的Stockwell变换,但似乎找不到使用scipy中的任何命令来执行此操作。在2015年的一篇帖子(Stockwell transform in Python)中,@Jariani建议使用我熟悉的MNE EEG分析软件包。但是,https://mne.tools/0.11/auto_examples/time_frequency/plot_stockwell.html的命令使用文档要求首先构造“事件”和“纪元”

我想要的只是一个通道的变换,如果可能的话,不需要首先定义这些量。以下是我迄今为止的代码:

import mne as mn
from mne.time_frequency import tfr_stockwell
# Read in raw EEG file and pick off data and times:
raw=mn.io.read_raw_edf('/Users/fishbacp/Desktop/myfile.edf', preload=True)
data,times=raw[:,:]

# Constuct the data matrix of dimension numnber_of_times -by- number_of_channels:
X=data.T

# Try to compute Stockwell transform for first channel, where frequencies from 6 to 30 Hz:

power = tfr_stockwell(X[:,0], fmin=6., fmax=30., width=.3, return_itc=False)

错误消息中还声明了“TypeError:inst必须是Epochs或Evoked”,这让我相信我不能为一个通道输入简单的时间序列

如能正确使用语法或建议使用其他方法计算Stockwell变换,将不胜感激。我在https://github.com/claudiodsf/stockwell尝试了这个包,但似乎无法遵循安装过程


Tags: ofinhttps命令datarawtimetransform