Electrodermal Activity analysis module¶
-
electrodermalactivity.
GSRSCRFeaturesExtraction
(filteredGSRSignal, samplerate, peak)[source]¶ This functions extract GSR SCR features: http://eda-explorer.media.mit.edu/static/SCR_withFeatures.png
- Input:
- rawGSRSignal: filtered GSR Signal as list
- samplerate: samplerate of the signak§
- peak: list of peaks [peakStart, max, peakend]
- Output:
- dict: {riseTime,Amplitude,EDAatApex,DecayTime (50%),SCRWidth (50%)}
Parameters: - rawGSRSignal (list) – raw GSR Signal
- samplerate (int) – samplerate of the GSR signal in Hz
- peak (list) – a list containing the peak onset, max and offset indexes (as returned by the function findPeakOnsetAndOffset)
Returns: a dictionary with the results of the extracted features
Return type: dict
-
electrodermalactivity.
analyzeGSR
(rawGSRSignal, samplerate, preprocessing=True, lowpass=1, highpass=0.05, phasic_seconds=10)[source]¶ Entry point for gsr analysis. Signal is filtered and downsampled, then a phasic filter is applied
- Input:
- rawGSRSignal = gsr signal as list
- samplerate = samplerate of the signal
- preprocessing = wether to perform or not a preprocessing of the signal
- lowpass = cutoff for lowpass filter
- highpass = cutoff for highpass filter
- Output:
- dictionary with all the results
Parameters: - rawGSRSignal (list) – raw GSR Signal
- samplerate (int) – samplerate of the GSR signal in Hz
- preprocessing (true) – wether to perform or not an automatic preprocessing of the signal
- lowpass (float) – cutoff frequency for the lowpass filter
- highpass (float) – cutoff frequency for the highpass filter
Returns: a dictionary with the results of the automatic GSR analysis
Return type: dict
-
electrodermalactivity.
butter_highpass
(cutoff, fs, order=5)[source]¶ This functions generates a higpass butter filter
Parameters: - cutoff (float) – cutoff frequency
- cutoff – cutoff frequency
- fs (float) – samplerate of the signal
- order (int) – order of the Butter Filter
Returns: butter highpass filter
Return type: list
-
electrodermalactivity.
butter_highpass_filter
(data, cutoff, fs, order)[source]¶ This functions apply a butter highpass filter to a signal
Parameters: - data (list) – ECG signal
- cutoff (float) – cutoff frequency
- cutoff – cutoff frequency
- fs (float) – samplerate of the signal
- order (int) – order of the Butter Filter
Returns: highpass filtered ECG signal
Return type: list
-
electrodermalactivity.
butter_lowpass
(cutoff, fs, order=5)[source]¶ This functions generates a lowpass butter filter
Parameters: - cutoff (float) – cutoff frequency
- cutoff – cutoff frequency
- fs (float) – samplerate of the signal
- order (int) – order of the Butter Filter
Returns: butter lowpass filter
Return type: list
-
electrodermalactivity.
butter_lowpass_filter
(data, cutoff, fs, order)[source]¶ This functions apply a butter lowpass filter to a signal
Parameters: - data (list) – ECG signal
- cutoff (float) – cutoff frequency
- cutoff – cutoff frequency
- fs (float) – samplerate of the signal
- order (int) – order of the Butter Filter
Returns: lowpass filtered ECG signal
Return type: list
-
electrodermalactivity.
findPeakOnsetAndOffset
(rawGSRSignal, onset=0.01, offset=0)[source]¶ This functions finds the peaks of a GSR signal
- Input:
- rawGSRSignal = GSR signal as list
- onset = onset for Peak Detection (uS)
- offset = offset for Peak Detection (uS)
- Output:
- multi dimensional list, [onsetIndex,maxIndex,offsetIndex] x nPeaks
Parameters: - rawGSRSignal (list) – GSR Signal to analyze
- onset (float) – onset value for peak detection (in uS)
- offset (float) – onset value for peak detection (in uS)
Returns: list of the peaks in the signal
Return type: float
-
electrodermalactivity.
getPhasicAndTonic
(rawGSRSignal, samplerate, seconds=4)[source]¶ This function returns the phasic and tonic components of a singnal.
- Input:
- rawGSRSignal = gsr signal as list
- samplerate = samplerate of the signal
- seconds = number of seconds before and after each timepoint to use in order to compute the filtered value
- Output:
- List containing the phasic and tonic components
Parameters: - rawGSRSignal (list) – raw GSR Signal
- samplerate (int) – samplerate of the GSR signal in Hz
- seconds – seconds to use to apply the phasic filter
- seconds – int
Returns: phasic and tonic signals
Return type: list
-
electrodermalactivity.
phasicGSRFilter
(rawGSRSignal, samplerate, seconds=4)[source]¶ Apply a phasic filter to the signal, with +- X seconds from each sample. Default is 4 seconds
- Input:
- rawGSRSignal = gsr signal as list
- samplerate = samplerate of the signal
- seconds = number of seconds before and after each timepoint to use in order to compute the filtered value
- Output:
- phasic signal
Parameters: - rawGSRSignal (list) – raw GSR Signal
- samplerate (int) – samplerate of the GSR signal in Hz
- seconds – seconds to use to apply the phasic filter
- seconds – int
Returns: filtered signal
Return type: list
-
electrodermalactivity.
tonicGSRFilter
(rawGSRSignal, samplerate, seconds=4)[source]¶ Apply a modified filter to the signal, with +- X seconds from each sample, in order to extract the tonic component. Default is 4 seconds
- Input:
- rawGSRSignal = gsr signal as list
- samplerate = samplerate of the signal
- seconds = number of seconds before and after each timepoint to use in order to compute the filtered value
- Output:
- tonic signal
Parameters: - rawGSRSignal (list) – raw GSR Signal
- samplerate (int) – samplerate of the GSR signal in Hz
- seconds – seconds to use to apply the phasic filter
- seconds – int
Returns: filtered signal
Return type: list