## 2 Materials and Methods
### SMD Algorithm
#### 2.2.2 Step 2  
In the first step we determine the position (\(w_{r}\) and \(w_{c}\)) of a specific point, or element, that describes a part of a coherent wave. Thus, we know the position of said wave in only one of the columns, namely the waveform column (\(w_{c}\)). In the second step, we find the row position of its waveform in the remaining columns of \(\mathbf{M}\), and in doing so we build the shift vector. In this context, the shift vector records the row position of the waveform in each of the columns, relative to the position of the waveform row (\(w_{r}\)). Therefore, the waveform position in any column \(j\) is equal to the sum of the waveform row \(w_{r}\) and the \(j\)th element of the shift vector \(s\). The location of the waveform in the remaining columns is found using a cross-correlation procedure.  
We select a sequence (\(\psi\)) from the waveform column that contains all the elements between rows \(w_{r}-w\) and \(w_{r}+w\) (Figure 8a,b). The parameter \(w\) represents the window size when determining the sequence (\(\psi\)), and its value is determined in the machine learning stage. The sequence of elements \(\psi\) is supposed to represent the waveform, or the greater part of it, and we refer to it as the waveform sequence. The position of the waveform in other columns is then determined by finding in each column a sequence of elements that has the highest correlation with the waveform sequence (Figure 8c).  
We start from the columns adjacent to the waveform column \(w_{c}\). The waveform position in columns adjacent to \(w_{c}\) must be between \(w_{r}-m\) and \(w_{r}+m\), where \(m\) is the maximum dip rounded up to the nearest integer. To reduce computation time, and to make sure to follow the same wave throughout all the columns, in adjacent columns we search for the \(\psi\) sequence from row \(w_{r}-m-w\) to row \(w_{r}+m+w\). Initially, the range of rows in which we search for the \(\psi\) sequence is entirely dependent on the waveform position in the closest column. For any column position \(j>w_{c}\), we search for the \(\psi\) sequence from row \(w_{r}+s_{j-1}-m-w\) to row \(w_{r}+s_{j-1}+m+w\).  
Once we have determined the waveform position in columns ranging from position \(w_{c}-2l\) to position \(w_{c}+2l\), we narrow the search window for the following columns. The value of the parameter \(l\) is determined in the machine learning stage. At this point, for a column \(j>w_{c}+2l\) we search for the waveform sequence from row \(i_{e}-1-w\) to \(i_{e}+1+w\).  
The row position \(i_{e}\) in column \(j\) is determined by following the parabolic trend of waveform positions in columns \(j-1\), \(j-1-l\), and \(j-1-2l\). Fitting parabolas to shift vectors will also be used in the Discussion section, for estimating the velocities of the recorded waves. While arrival times are usually modeled with a hyperbola, we use a parabola because it requires fewer points on the shift vector to find its coefficients. Since most parts of the hyperbola can locally be fairly accurately described with a parabola, our parabolic estimates are sufficiently accurate. Narrowing the search window allows us to estimate the waveform position in each column more quickly and to make estimating waveform position more resilient to perturbations from noise and other waves. The optimal values for parameters \(w\) and \(l\) are determined in the machine learning stage. Moreover,  
Figure 7: **(a)** The original data matrix \(\mathbf{M}\). **(b)** The filter’s result \(\mathbf{F}\) with the indicated waveform row and waveform column.  
if the maximum correlation with the waveform sequence in a certain column is below 0 the step terminates, as at that point we can be certain that the waveform is no longer present.