# PPG PROCESSING Compute: x’(t) = first derivative of the PPG signal emin(t) = inferior envelope of x’(t) emax(t) = superior envelope of x’(t) x’norm(t) = min-max normalization of x’(t) as in Equation (4) # HEARTBEAT DETECTION Define: thENV = threshold for the identification of heartbeats from x’norm(t); set to 0.8 Find: tpeaks = occurrence time of the local maxima of x’norm(t) exceeding thENV # FALSE POSITIVES REDUCTION Define: = median peak-to-peak distance between all the elements in tpeaks N = number of peaks in tpeaks i = 1 While i < N
Take the occurrence time of the i-th peak (ti)
Calculate the difference between ti and the occurrence time of all the other elements in tpeaks: ti
− t1, ti − t2, …, ti − tN
Compare these differences to by using Equation (2), from which d = [d1, d2, …, dN] is obtained
-
For each i < k ≤ N, find the lowest dk and define:
j = k-th peak that minimizes d
Discard all the peaks included between i and j-1 from tpeaks, if any, as they are false positives
Update as in Equation (4) and set i = j for the next iteration
End # IBI CALCULATION Compute: IBIENV = difference between consecutive elements of the remaining occurrence times in tpeaks
|
# PPG PROCESSING Define: x(t) = PPG signal N = number of samples in x(t) # HEARTBEAT DETECTION Define: RP = refractory period; initialized to 0.6 s RPchange = multiplier for RP updates; set to 0.6 slope = slope coefficient for the adaptive threshold; initialized to 0.2*max(x(t)) tinit = occurrence time of the first increasing segment found in x(t) th(t) = adaptive threshold, initialized to x(tinit) i = sample of x(t) corresponding to tinit While i < N
Increase i until a peak is found on x(t); define j as the sample of x(t) corresponding to this peak
Add tj (occurrence time of the peak) to the array of the peaks found so far (tpeaks)
Make th(t) = x(t) until the j-th sample is reached
Update the slope parameter as shown in Equation (2) of [41]
Linearly decrease th(t) starting from the peak found on x(t), using the updated slope
-
When th(t) intersects x(t):
If RP has passed
Proceed to step 7
Else
Continue to linearly decrease th(t) and
repeat this check at the next point of
intersection
End
Compute the average IBI () from the tpeaks found so far and update RP for the next iteration: RP = RPchange ∗
Update i to the sample where th(t) intersected x(t) and proceed with the next iteration
End # IBI CALCULATION Compute: IBISLOPE = difference between consecutive elements of tpeaks
|