我使用ipython笔记本和biosppy 0.1.2来分析EDA数据。我得到以下索引器:
IndexError Traceback (most recent call last)
<ipython-input-21-0191d6af629b> in <module>()
37 eda_final = eda_real_list
38
---> 39 out = EDA.eda(signal=eda_in_time_ok, sampling_rate=100.0, show=True)
40
41
C:\Python27\Lib\site-packages\biosppy\signals\eda.pyc in eda(signal, sampling_rate, show)
89 amplitudes=amps,
90 path=None,
---> 91 show=True)
92
93 # output
C:\Python27\Lib\site-packages\biosppy\plotting.py in plot_eda(ts, raw, filtered, onsets, peaks, amplitudes, path, show)
351 ax2.plot(ts, filtered, linewidth=MAJOR_LW, label='Filtered')
352
--> 353 ax2.vlines(ts[onsets], ymin, ymax,
354 color='m',
355 linewidth=MINOR_LW,
IndexError: arrays used as indices must be of integer (or boolean) type
这是我的简单代码:
from biosppy.signals import eda as EDA
for pict in blocks_images:
picture = imread('C:\Users\Roberta\Desktop\Arousal-Valence_setup-last\\'+pict)
for subj in range(0,len(blocks[pict]['ecg'])):
time_start=5 # time in seconds of image onset
time_stop=35 # time in seconds of image off
eda_data = blocks[pict]['eda'][subj]
time_eda_1 = [eda[0] for eda in eda_data]
time_eda = np.array(time_eda_1)-time_eda_1[0]
index_start = map(int,list(time_eda)).index(time_start)
index_stop = map(int,list(time_eda)).index(time_stop)
eda_in_time_ok = map(float, [ii[1] for ii in eda_data[index_start:index_stop]if ii[1] != 0.0])
out = EDA.eda(signal=eda_in_time_ok, sampling_rate=100.0, show=True)
我试着按照我在这里发现的没有任何积极结果的其他帖子来解决它。 有人能告诉我问题出在哪里吗?我该怎么解决? 不幸的是,我在编程方面很新,我没有找到很多关于bioSPPy的文档可以帮助我。
非常感谢!
EDA.eda()
需要np.array而不是python列表。添加
import numpy as np
,并更改行为了这个
相关问题 更多 >
编程相关推荐