# Detection and Characterization of Physical Activity and Psychological Stress from Wristband Data
## 2 Materials and Methods
### Signal Processing
#### 2.2.1 Blood Volume Pulse
The PPG signal is highly correlated with the ACC readings when motion artifacts are present, and the ANC is applied three times in series for the x, y, and z axes, resulting in the signal with significantly reduced motion artifacts. Equations (1)-(5) describe the mathematical representation of adaptive filter implementation, with \(e(k)\) as an enhancement signal; \(U\) as the accelerometer measurements; \(s(k)\) as the ideal signal, which does not contain any noise; \(d(k)\) as motion artifacts or noise desired to be removed; and \(d^{\prime}(k)\) as the noise estimates from adaptive filter. The adaptive filter tries to minimize \(d(k)-d^{\prime}(k)\) using Equations (1)-(5), to obtain a signal as close as possible to \(s(k)\), and the filtering equations are as follows:  
\[e(k)=s(k)+\left(d(k)-d^{\prime}(k)\right) \tag{1}\] \[\alpha(k)=\frac{\lambda^{-1}P(k-1)U(k)}{1+\lambda^{-1}U^{T}(k)P( k-1)U(k)}\] (2) \[\omega(k)=\omega(k-1)+\alpha(k)e(k)\] (3) \[P(k)=\lambda^{-1}\left(1-\alpha(k)U^{T}(k)\right)P(k-1),P(0)= \gamma I_{M}\] (4) \[d^{\prime}(k)=\omega(k)^{T}U(k) \tag{5}\]  
The detailed diagram for noise cancellation with an adaptive filter is presented in Figure 5.  
ANC presents a useful solution for PPG signal processing. However, ANC only provides good results when ACC readings correlate with the PPG signal, which occurs generally during motion artifacts caused by physical activity. Thus, some additional noise may still remain after ANC. Decomposition algorithms (wavelet decomposition, empirical mode decomposition, and singular signal decomposition) are able to break down signals into different constituent signals at different sub-frequencies. Some sub-frequency sets may be related to additional noise, which can be easily eliminated from the signal. Wavelet decomposition was used in this work for further removing noise from the PPG signal processing [12, 51, 52]. In this work, the Symlets 4 wavelet function was used with 4 decomposition levels for denoising the PPG signal. The efficacy of the ANC and denoising algorithms was evaluated using a ground-truth measurement. A few experiments were conducted with the bioPLUX (bioPLUX, PLUX Wireless Biosignals SA, Portugal [53]), which is a finger-worm device. The bioPLUX collects PPG data at a 1 kHz frequency compared to the 32 Hz frequency of the Empatica E4. The bioPLUX is worn on a hand held constant to reduce motion artifacts and interference, and the data from the bioPLUX were used as a ground-truth to evaluate the improvement made by the PPG filtering and artifact removal algorithm. Data were collected from the other wrist with Empatica E4 during TR without any restrictions in movement. The results of the signal processing algorithms were compared with raw Empatica E4 BVP measurements, the Empatica E4 BVP data processed with the proposed technique, and the bioPLUX measurements as the ground-truth data. Figure 6 presents an example of the improvement in the raw BVP signal achieved with the proposed method. The time frame (5 s) was scaled with common up-sampled frequency (64 kHz) and data were normalized to the [0-1] range. The processed signal significantly enhanced the signal quality.