Closed nitin710 closed 2 years ago
in processElectrodermalResponse()
{
// static variables
float* data;
size_T dataLen;
edrAmplitudeHighPassFilter // highPass digital Filter // used to segment out the sharp changes
edaAmplitudeLowPassFilter // low pass digital Filter // used to provide a baseline that works as a reference for threshold
edrFrequencyFilter // lowPass digital filter
static float threshold; // maybe this should be a percentage of the current EDA value? ~ 0.1
static uint16 interResposeSampleCount; // to count number of samples passed between EDR events
float interResponseTime;
// Load latest EDA signal dataLen = dataDoubleBuffer[EDA]->getData();
// process EDA for(dataLen) { lowPassfilteredSignal = edaAmplitudeLowPassFilter (data[i]); highPassfilteredSignal = edrAmplitudeHighPassFilter(data[i]); if((highPassfilteredSignal) / lowPassfilteredSignal > threshold) { // add (highPassfilteredSignal - lowPassfilteredSignal ) to _outDataPacket
// calculate the time between response
interResponseTime = lowPassFilter( interResponseSampleCount/samplingFreq);
// Add (1/interResponseTime) to _outDataPackets
} else { interResponseSampleCount++; } }
## Questions
1. Should we consider a `+ve` and `-ve` swing in EDA to count as a EDR?
- If yes, how do we represent that?
- Do we just send a `+ve` and `-ve` value?
@produceconsumerobot what do you think of the draft? Still trying to think of a way to bypass typeTag
rise time
as wellin processElectrodermalResponse()
{
float* bufferData;
uint32_t timestamp;
size_T bufferSize;
edrAmplitudeHighPassFilter // for bandpass @ 0.5Hz
edaAmplitudeLowPassFilter // for bandpass @1.5Hz
edaAmplitudeBaselineFilter // @0.1Hz // used to provide a baseline that works as a reference for threshold
edrFrequencyFilter // lowPass digital filter @1Hz
static float threshold; // ~ 0.1 (10%)
static uint16 interResposeSampleCount; // to count number of samples passed between EDR events
float interResponseTime;
static const float timePeriod = 1/ samplingFreq;
static bool onsetDetected;
static float baseEdrAmplitude;
float riseTime;
// Load latest EDA signal
bufferSize = dataDoubleBuffers[EDA]->getData(&bufferData, ×tamp, false);
// process EDA
for(bufferSize)
interResponseSampleCount++;
{
lowPassfilteredSignal = edaAmplitudeLowPassFilter (data[i]);
highPassfilteredSignal = edrAmplitudeHighPassFilter(lowPassfilteredSignal); // creates a bandpass by cascading low and high
if(!onsetDetected)
{
if( highPassfilteredSignal / lowPassfilteredSignal > threshold)
{
// set onset detected.
// record onset time(by back-calculating based on frequency)
// set base edr amplitude
baseEdrAmplitude = data[i]
// calculate the time between response
interResponseTime = lowPassFilter( interResponseSampleCount * timePeriod);
// Add interResponseTime _outDataPackets
// interResponseSampleCount = 0;
}
}
else // after onset has been detected
{
if(data[i] < data[i-1]) // peak detected
{
amplitude = data[i-1] - baseEdrAmplitude;
}
// calculate the rise time
riseTime = interResponseSampleCount * timePeriod;
// send TimePeriod
// onsetDetected = false;
}
}
acquireData.EdrAmplitude
in the code as well to be able to toggle it on and offSCR duration is also a somewhat commonly used term, e.g. from Handler et al. 2012 An EDA Primer for Polygraph Examiners
from Setz et al 2010 Discriminating Stress From Cognitive Load Using a Wearable EDA Device
From Boucsein's 2012 book
A Guide for Analysing Electrodermal Activity (EDA) & Skin Conductance Responses (SCRs) for Psychological Experiments https://www.birmingham.ac.uk/Documents/college-les/psych/saal/guide-electrodermal-activity.pdf
@produceconsumerobot as discussed, we may want to move the EDR:FREQ
to a periodic channel. Let's pool that discussion into this issue.
Early draft:
Moving processElectrodermalActivity() into EmotiBitEda
EmotiBitEda()
classdataDoubleBuffers[(uint8_t)EmotiBit::DataType::EDA]
is replaced with the class private member DoubleBufferFloat
addPacket
EmotiBitEda
possible typetags between E series and S series |
Signal name | Typetag(S series) | Typetag(E series) |
---|---|---|---|
EDA | EA | EA | |
EDL | EL | EL | |
EDR | ER | ER | |
Skin Conductance Response Amplitude | SA | EC(electrodermal change) | |
Skin Conductance Response Frequency | SF | EF | |
Skin Conductance Response Rise Time | SR | ET | |
Skin Conductance Response Recovery Time | ST | E? | |
Skin Conductance Response Duration | SD | ED | |
Skin Conductance Response Latency | SL | E? |
Reasons to have S series
note: when we add Skin conductance duration, need to resolve conflict with type tag SD-Card percentage.
Reasons not to have S series
Reasons to Have E series
Reasons not to have it
Here U1
represents a bandpass filtered eda, which is being used to determine the SCR derivatives. bandpass [0.3-1] Hz
Description
Lit Rev
TypeTag considerations
recovery
TimeOfOnset
explicitely.EC
- Electrodermal change?SA
- Skin conductance AmplitudeEF
- Electrodermal Response FrequencySF
- Skin conductance FrequencyET
- rise time?SR
- Skin conductance Rise TimeR
in case we want to add Recovery