# Application of Dynamic Time Warping to Determine the Shear Wave Velocity from the Down-Hole Test
## 4 Methodology
### Determination of the Wave Speed  
The speed of the wave relative to the height can be determined based on the difference in the arrival times of the wave at both geophones (\(\Delta t\)). In practice, it means finding the shift value between two waves in the time domain. The DTW method is mainly used to determine the similarity between signals, and it also plays this role in the analysis of signal quality discussed in the Section 4.2. However, the assumption of the method of matching signals with the possibility of shifts in time also makes it achievable to determine the value of this shift for each signal value. Ideally, this shift should be constant for each value. In practice, however, the signals will never be identical, and the DTW algorithm will try to match them as much as possible using different shift values. Therefore, it is necessary to establish a standard for determining the primary shift, and it seems most intuitive to use the median value, which is the most frequently occurring value. It was assumed that s\({}_{1}\) is the shear wave recorded using the first geophone and s\({}_{2}\) is the shear wave recorded using the second geophone, where the distance from the wave source to the first geophone is greater than the distance to the second one. Using the DTW algorithm, the optimal match of s\({}_{1}\) to s\({}_{2}\) was determined, obtaining a path (X,Y), where X is a vector of index numbers for the signal s\({}_{1}\), and Y is a vector of index numbers for s\({}_{2}\). Thus, the shifts between the values of the signals (in the case of optimal matching) are equal:  
\[\mathrm{D}=\mathrm{X}-\mathrm{Y}, \tag{15}\]  
This vector, based on the assumption about the distance of the geophones from the wave source, should take positive values (the signal will reach the first geophone later). However, due to real, non-ideal conditions, negative values may also appear in the result, which are certainly not related to the real difference in the arrival times of the wave. For this reason, it was decided to exclude them from the analysis:  
\[\mathrm{D}_{+}=\left\{\begin{aligned} & D_{,}\text{ if }\mathrm{D}>0\\ & 0_{,}\text{ if }\mathrm{D}\leq 0\end{aligned}\right.. \tag{16}\]  
The main signal shift was determined by the median Q\({}_{2}\)(D\({}_{+}\)). Knowing that the measurements are made with a frequency of 0.2 ms, it can be defined as  
\[\Delta t=\mathrm{Q}_{2}(\mathrm{D}_{+})\cdot 0.2\cdot 10^{-3}[\mathrm{s}]. \tag{17}\]  
The distance d between the geophones is fixed (0.5 or 1 m depending on SCPT cone model); therefore, the speed of the wave can be determined by  
\[\mathrm{v}=\frac{\mathrm{d}}{\Delta t}. \tag{18}\]  
An example of a shear wave recorded using both geophones is shown in Figure 5a. The signals, in this case, are of a good quality; Q = 0.83. The result of shifting the wave recorded using the second geophone by the \(\Delta t\) value determined by employing the proposed method is shown in Figure 5b. There is a clear coincidence of both waves, which means that the shift value was correctly determined.  
Figure 5: Examples of a selected shear wave recorded using two geophones (**a**), and after shifting by the determined value \(\Delta t\), the wave recorded using geophone 2 (**b**).