**4. Discussion**

Although several CWT-based algorithms have been proposed for gait event detection, the validation of such algorithms especially on hemiplegic patients and the investigation into an appropriate mother wavelet selection has rarely been conducted to date. Thus, there is a need to embark on the current study. This study systematically investigated different wavelet selection criteria across the 32 commonly applied mother wavelets towards obtaining the appropriate mother wavelet required for consistently accurate gait event detection especially for hemiplegic patients. The mother wavelets were individually incorporated into a proposed general CWT algorithm for the recognition of HS and TO gait events, and the algorithm was validated with datasets from hemiplegic patients as well as healthy subjects.

It should be noted that the proposed general CWT algorithm showed a good performance for HS and TO gait event detection in terms of consistently achieving high accuracy and low time-error particularly when the appropriate mother wavelet was applied to both healthy and hemiplegic subjects. The gait event detection results for the healthy subjects were observed to be comparatively stable and consistent with that reported in previous studies which utilized only a specific single mother

wavelet [13,22,26]. Interestingly, we also found that the validation results of the estimated gait events for the hemiplegic subjects were observed to be consistent with the results obtained for healthy subjects. One possible reason is due to the use of time-frequency analysis and the domain knowledge about gait events and gait cycles. Since functional gait after stroke is usually affected by spasticity, muscle weakness, and balance disorder [40], hemiplegic gait is often characterized by reduced speed, cadence, stride length and joint angular excursions, and asymmetry in temporal and spatial domains [41]. In addition, limb circumduction is clearly observed on the hemiplegic subjects during walking due to the increased lateral displacement of the foot during the swing in the paretic limb [41], and these factors may increase the complexity of recognizing the gait patterns of hemiplegic patients. However, with the proposed CWT algorithm that incorporates time-frequency information, the gait events of both hemiplegic and healthy subjects can be adequately identified as shown in Figure 3. Therefore, the CWT based algorithm that integrates the optimal wavelet function shows its robustness in HS and TO event detection, which indicates its superiority with no need to readjust the thresholds in comparison with some purely data-driven approaches that are often dependent on threshold and parameter tuning. Hence, this again proves the potential of applying an appropriate mother wavelet to the proposed general CWT algorithm for gait event detection in real-life applications.

When considering the selection of the appropriate mother wavelet, the criteria based on some accuracy and quantitative measures were investigated. For the accuracy-based criteria, time-error and F1-score measures were applied to evaluate the performance of a range of mother wavelets employed by the proposed CWT algorithm to detect the HS and TO gait events. From the analysis results, we found that the "db6" mother wavelet achieved relatively higher F1-scores and yielded the lowest average time-error values for both healthy and hemiplegic subjects. The possible reason is that the "db6" mother wavelet provide the most precise scale for CWT based gait event detection in comparison to the other 31 analyzed mother wavelets. With respect to the quantitative-based criteria, the cross-correlation coefficient (*Xcorr*) and energy-to-Shannon entropy ratio (*ESER*) were investigated to check whether the above two metrics could be considered as effective wavelet selection criteria for the appropriate mother wavelet in detecting gait events. Since the CWT are essentially based on finding the correlation between the analyzed signal (the acceleration signal) and the shifted/scaled mother wavelet, it is obvious that an initial criterion for appropriate wavelet selection could be the cross-correlation (*Xcorr*) that reflects the similarity. However, we found that the results of cross-correlation (*Xcorr*) analysis were not consistent with the actual performances of HS and TO gait event detection in both healthy subjects and hemiplegic patients. This may be due to the fact that cross-correlation (*Xcorr*) is only appropriate for those wavelet-based processing methods based on the resemblance between signals and mother functions [31], but not for our models which extract and distinguish the feature points based on the frequency relationship of the signal itself. After investigating the correlation between the wavelet and the analyzed signal (*Xcorr*), we also wanted to check if there were significant differences that exist in the wavelet coefficients themselves by using different mother wavelets for CWT. Which is to say, the energy concentration and entropy that reflects information lost were integrated to check whether the energy-to-Shannon entropy ratio (*ESER*) could be considered as one of the effective wavelet selection criteria. As pointed out in the previous study [42], maximization of time/frequency energy concentration, minimization of the bias, and the unique relationship that exists between scale and frequency contribute to desirable continuous analytic wavelets. However, we also found that the results of the ESER analysis across different mother wavelets had no significant difference, which might not be appropriate for the wavelet selection in our study. In other words, the results of the *ESER* analysis revealed that the energy concentration and entropy distribution were almost the same across different mother wavelets in the aspect of gait event detection. Therefore, the accuracy-based criteria including time-error and F1-score is suggested as effective wavelet selection criteria in the context of gait event analysis.

Despite the interesting findings observed in this study, there are still some limitations that should be addressed in the future work. For instance, the proposed general CWT algorithm was validated using the dataset from post-stroke hemiplegic patients who were said to be in stages V and IV according to the Brunnstrom assessment scale, excluding patients with severe stroke (perhaps in stages II and III on the Brunnstrom assessment scale). Therefore, there is need to conduct further studies with this population since they have the most drop foot issues, and their gait patterns maybe somewhat different from those in stages V and IV considered in the current study. Besides that, different sensor placement configuration as well as different walking terrains would normally influence gait patterns in real-life applications. In the future, we would further investigate the performances of different mother wavelets in the presence of both factors, and perhaps make adjustment, if necessary, to the mother wavelet selection criteria examined in this study.
