# Estimation of Mental Distress from Photoplethysmography
## 2 Materials and Methods
### Photoplethysmography Processing  
The signal acquisition was held using the wearable PPG sensor at a sampling rate of 60 Hz and a 22-bit resolution. This sampling rate was chosen as minimum sampling frequency to prevent PPG signal distortion, since useful PPG information is located between 0 and 30 Hz [26]. However, in order to increase the reliability of the subsequent validation analysis and accuracy of PRV series computation, the acquired PPG was interpolated by using a cubic splines algorithm, increasing time resolution up to an equivalent sampling frequency of 1000 Hz. This type of interpolation has been used previously to increase the sampling rate in similar contexts [27].  
Moreover, several factors, such as sensor location, electrical sources, ambient lights, skin properties or temperature, may affect quality of PPG signals [28]. These factors add different artifacts and noisy components to the waveform, which augments difficulty in signal characterization. Therefore, different filtering and processing techniques are applied to eliminate possible interferences and enhance the waveform before characterizing the signal. In this regard, power line interference is one of the most common noise sources. Indeed, ambient electromagnetic signals are present everywhere, modulating PPG signal over a sinusoidal component at its fundamental frequency. Moreover, variation in temperature or poor contact of photo sensor are only some of the causes of baseline in PPG signal [28]. Hence, baseline wander, high-frequency noise and power-line interference are removed by computing a forward/backward filtering approach. More concretely, baseline drift is removed by applying a 0.5 Hz cut-off high-pass, linear-phase FIR filter. Similarly, a 30 Hz cut-off low-pass, linear-phase FIR filter is applied to remove high-frequency noise and power-line interferences.  
In this regard, approaches based on adaptive threshold have been extensively employed to detect peaks on PPG signals [29]. Nevertheless, PPG signals contain inherent noise (Gaussian noise), sudden amplitude changes or different morphologies caused by premature ventricular contractions or movements. Therefore, the use of a robust and reliable PPG peak detection algorithm is a key factor to face these difficulties. The algorithm has to deal with the detection of beats and artifacts while operating with a minimum computational burden in real-time. Considering all these premises, in this work an incremental-merge segmentation algorithm was used for PPG peak detection [30]. This algorithm extracts morphological features of PPG signal that are used as line segments. Next, these segments  
Figure 2: Experimentation time-line. IAPS: International Affective Picture System.  
are classified as pulse or artifacts through using adaptive thresholds. More precisely, a PPG signal is converted into line segments by connecting the first and the last point of the line, depending of a tuning parameter \(m\) (length of line segments) which depends directly on the sampling rate. Then, line segments are classified such that pulse peaks are identified as endpoints of the validated up-slopes. On the other hand, horizontal lines are labeled as clipping or disconnection, so that up-slopes preceding and succeeding a horizontal line are labeled as artifacts. In this way, pulses from PPG corresponding to artifacts are identified and suppressed from beat-to-beat computation. Finally, PRV is estimated by measuring the time variation in consecutive PPG peaks.