Skip to content

EDA analysis: "IndexError: arrays used as indices must be of integer (or boolean) type" #40

@caisdosodre

Description

@caisdosodre

Hey,
During EDA analysis, with some datasets, I noticed that a specific error was raised:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[<ipython-input-2>](https://localhost:8080/#) in <cell line: 8>()
      6 
      7 # process it and plot
----> 8 out2 = eda.eda(signal=signal2,sampling_rate=200, show=True)

1 frames
[/usr/local/lib/python3.10/dist-packages/biosppy/signals/eda.py](https://localhost:8080/#) in eda(signal, sampling_rate, units, path, show)
     99 
    100     # get EDR and EDL
--> 101     edl_signal, edr_signal = biosppy_decomposition(signal=filtered,
    102                                                    sampling_rate=sampling_rate,
    103                                                    method="onsets",

[/usr/local/lib/python3.10/dist-packages/biosppy/signals/eda.py](https://localhost:8080/#) in biosppy_decomposition(signal, sampling_rate, method, onsets, **kwargs)
    269 
    270         # extract edl
--> 271         edl_on = np.hstack((ts[0], ts[onsets], ts[-1]))
    272         edl_amp = np.hstack((signal[0], signal[onsets], signal[-1]))
    273         f = interpolate.interp1d(edl_on, edl_amp)

IndexError: arrays used as indices must be of integer (or boolean) type

My code is below:

from biosppy import storage
from biosppy.signals import eda

# load raw eda signal
signal2, mdata2 = storage.load_txt('signal.txt')

# process it and plot
out2 = eda.eda(signal=signal2,sampling_rate=200, show=True)

The input file is attached (the sampling frequency is 200Hz):
raw_data.txt

I tried to debug the error, and until where I discovered, the error is related to the onsets' determination, using "emotiphai" method, where the onsets array returns empty (onsets=[]), causing the error. The workaround I found to determine the onsets and complete the analysis was to set the EDA events determination method to "basic".

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions