I'm using ipython notebook and biosppy 0.1.2 for analyzing EDA data. I get the following IndexError:
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
this is my simple code:
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)
I try to solve it follow other post I found here withouth any positive results. Can someone expain me what is the problem and how can I fix it? Unfortunately I'm quite new in programming and I did not find a lot of documentation on bioSPPy that can help me.
Thanks a lot!
EDA.eda()
is expecting an np.array not a python list.Add
import numpy as np
, and change the lineto this