PIA-Group / BioSPPy

Biosignal Processing in Python
Other
577 stars 273 forks source link

Empty vector `zeros` not handled in `eda` function #94

Closed ferdiu closed 2 years ago

ferdiu commented 2 years ago

Discovered using a real ~60 seconds long EDA BITalino recording.

It rises both applying the transfer function or not to the original signal.

The provided python script file to reproduce the error contains the original signal after applying the transfer function.

To reproduce

error-example.zip

$ unzip error-example.zip
$ python error-example.py
Traceback (most recent call last):
  File "/home/user/error-example.py", line 7, in <module>
    eda(s, sr)
  File "/home/user/.local/lib/python3.10/site-packages/biosppy/signals/eda.py", line 82, in eda
    onsets, peaks, amps = kbk_scr(
  File "/home/user/.local/lib/python3.10/site-packages/biosppy/signals/eda.py", line 226, in kbk_scr
    if np.all(df[zeros[-1] :] > 0):
IndexError: index -1 is out of bounds for axis 0 with size 0
afonsocraposo commented 2 years ago

Hello @ferdiu , I'm very sorry for the late reply. I'm not an expert in EDA, but from what I see on "Emotion recognition system using short-term monitoring of physiological signals" by K. H. Kim, the EDA signal you attached is very different from the one highlighted in the original paper. The EDA signal you shared does not show any SCR pulses, therefore, the algorithm used for its detection is not capable of identifying them.