## 4 Results  
The potential of the S-transform to highlight pace artifacts in an ECG recording corrupted with EMG is illustrated in Figure 2. Although the amplitude of the pace artifacts is comparable to the EMG amplitude, their positions are distinctly localized in Figure 2b. Figure 2c shows the calculated Shannon energy, which is suitable for subsequent analysis via the designed simple threshold-based rule. The results achieved during the adjustment of the amplitude threshold \(K\) are presented via the Se and PPV curves in Figure 3. Three values of \(K\) (8, 10, 12) lead to Se \(>\) 99% and PPV \(>\) 99% over the training dataset. The analysis over the validation dataset highlighted \(K\) = 10 as the value that assures the most balanced accuracy (see Table 1). Figure 3: Sensitivity (Se) and positive predictive value (PPV) achieved over the training dataset (312 ECG+EMG recordings) for different values of the adjustable parameter \(K\). Figure 2: Example of 3 s ECG signal with pace artifacts taken from the training dataset (**a**), the result of the applied S-transform (**b**) and the calculated Shannon’s energy (**c**). The positions of the pace artifacts are marked with a red asterisk (*) in the first subplot. The results achieved via the designed threshold-based rule with \(K=10\) over the test dataset (for both clean ECG and ECG+EMG) are presented in Table 2, once in total for all analyzed ECG recordings and a second time as mean \(\pm\) standard deviation, median value and min-max range. Additionally, the Se and PPV values over the entire test dataset are illustrated in Figure 4. \begin{table}
\begin{tabular}{c c c} \hline \hline \(K\) & **Se (\%)** & **PPV (\%)** \\ \hline
8 & 100 & 98.2 \\
**10** & **99.9** & **98.3** \\
12 & 97.4 & 98.7 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Se and PPV achieved over the validation dataset (390 clean ECGs) for 3 settings of the parameter \(K\). \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multicolumn{2}{c}{**Se, PPV Computed over**} & \multicolumn{2}{c}{**Distribution of Se and PPV Computed Individually for Each ECG**} \\ \multicolumn{2}{c}{**all ECG Recordings**} & \multicolumn{2}{c}{**Recording**} \\ \hline  & & \multicolumn{2}{c}{**Mean \(\pm\) std**} & \multicolumn{2}{c}{**Median (min-max Range)**} \\ \hline
**Test dataset** & **Se (\%)** & **PPV (\%)** & **Se (\%)** & **PPV (\%)** & **Se (\%)** & **PPV (\%)** \\ \hline ECG+EMG & 100 & 98.0 & 100 \(\pm\) 0.0 & 98.5 \(\pm\) 4.8 & 100 (100–100) & 100 (83.3–100) \\ Clean ECGs & 99.9 & 98.3 & 99.9 \(\pm\) 0.8 & 98.2 \(\pm\) 4.7 & 100 (87.5–100) & 100 (81.8–100) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Accuracy of the designed threshold-based algorithm for pace pulses detection over the test dataset (390 clean ECGs, 312 ECG+EMG) for \(K=10\). Se and PPV are presented once as values calculated for all ECG recordings, and for a second time as the distributions of their values calculated for individual ECG recordings. Figure 4: Observed Se and PPV values over the test dataset. (**a**) ECG recording number in the test dataset (ECG+EMG); (**b**) ECG recording number in the test dataset (clean ECG). The influence of SNR on the accuracy is illustrated in Figure 5 in terms of PPV. As could be seen from Figure 4a, the SNR does not affect the Se, which is 100% (i.e., all pace pulses in the ECG+EMG test dataset are detected, despite the SNR). Examples of ECG+EMG signals with correctly detected and not detected pace artifacts, when \(K\) is set to 12, and erroneously detected pace artifacts, when \(K\) is set to 10, are presented in Figures 6-8, respectively. Figure 5: Influence of SNR on PPV (represented as mean, min, max values over the test dataset (ECG+EMG)). Figure 6: Example of true positive (TP) detections of pace artifacts. ECG (blue trace), the calculated Shannon energy (ShE, black trace), the ShE threshold (red line). Pace pulses are annotated with red asterisks “*’. The amplitude of the ShE is cropped within the range of the ECG signal.