1- # -*- coding: utf-8 -*-
1+ # -*- coding: utf-8 -*-
22"""
33biosppy.signals.eda
44-------------------
2323from .. import plotting , utils
2424
2525
26- def eda (signal = None , sampling_rate = 1000. , show = True ):
26+ def eda (signal = None , sampling_rate = 1000. , show = True , min_amplitude = 0.1 ):
2727 """Process a raw EDA signal and extract relevant signal features using
2828 default parameters.
2929
@@ -35,6 +35,8 @@ def eda(signal=None, sampling_rate=1000., show=True):
3535 Sampling frequency (Hz).
3636 show : bool, optional
3737 If True, show a summary plot.
38+ min_amplitude : float, optional
39+ Minimum treshold by which to exclude SCRs.
3840
3941 Returns
4042 -------
@@ -76,7 +78,7 @@ def eda(signal=None, sampling_rate=1000., show=True):
7678 mirror = True )
7779
7880 # get SCR info
79- onsets , peaks , amps = kbk_scr (signal = filtered , sampling_rate = sampling_rate )
81+ onsets , peaks , amps = kbk_scr (signal = filtered , sampling_rate = sampling_rate , min_amplitude = min_amplitude )
8082
8183 # get time vectors
8284 length = len (signal )
@@ -169,7 +171,7 @@ def basic_scr(signal=None, sampling_rate=1000.):
169171 return utils .ReturnTuple (args , names )
170172
171173
172- def kbk_scr (signal = None , sampling_rate = 1000. ):
174+ def kbk_scr (signal = None , sampling_rate = 1000. , min_amplitude = 0.1 ):
173175 """KBK method to extract Skin Conductivity Responses (SCR) from an
174176 EDA signal.
175177
@@ -181,7 +183,9 @@ def kbk_scr(signal=None, sampling_rate=1000.):
181183 Input filterd EDA signal.
182184 sampling_rate : int, float, optional
183185 Sampling frequency (Hz).
184-
186+ min_amplitude : float, optional
187+ Minimum treshold by which to exclude SCRs.
188+
185189 Returns
186190 -------
187191 onsets : array
@@ -218,7 +222,7 @@ def kbk_scr(signal=None, sampling_rate=1000.):
218222 zeros = zeros [:- 1 ]
219223
220224 # exclude SCRs with small amplitude
221- thr = 0.1 * np .max (df )
225+ thr = min_amplitude * np .max (df )
222226
223227 scrs , amps , ZC , pks = [], [], [], []
224228 for i in range (0 , len (zeros ) - 1 , 2 ):
0 commit comments