I think there might be a problem in eda_scr function when used with method='slow' parameter. Here's a MWE (along with some data eda_example_1000hz.zip) and the traceback of the resulting error:
import pickle
import numpy as np
import neurokit as nk
# Loading EDA as numpy array.
with open('eda_example_1000hz.pkl', 'rb') as f:
eda = pickle.load(f)
# Extract SCR responses from EDA using slow method.
nk.bio_eda.eda_scr(eda, method='slow')
Which, in my case, raises the following error:
---------------------------------------------------------------------------`
TypeError Traceback (most recent call last)
<ipython-input-98-6796372979af> in <module>()
11
12 # Extract SCR responses from EDA using slow method.
---> 13 nk.bio_eda.eda_scr(eda, method='slow')
~\Anaconda3\envs\funii-env\lib\site-packages\neurokit\bio\bio_eda.py in eda_scr(signal, sampling_rate, treshold, method)
404
405 # Keep only pairs
--> 406 peaks = peaks[peaks > onsets[0]]
407 onsets = onsets[onsets < peaks[-1]]
408
TypeError: only integer scalar arrays can be converted to a scalar index
Hi,
I think there might be a problem in
eda_scr
function when used withmethod='slow'
parameter. Here's a MWE (along with some data eda_example_1000hz.zip) and the traceback of the resulting error:Which, in my case, raises the following error:
It seems that this problem is caused by an indexing method which only works with numpy arrays, and converting peaks and onsets variables to numpy array should fix this. https://github.com/neuropsychology/NeuroKit.py/blob/fb0fa99f2a2304b91f04ebc43cf551ce3cec95a3/neurokit/bio/bio_eda.py#L406-L407