## 2 Materials and Methods
### Spectral Signal Processing
#### 2.3.2 Automatic Peak-Finding Algorithm  
The Doppler shift caused by the motion of the scatterer is determined by identifying the highest value in the power spectrum of the echo signal. According to the characteristics of the power spectrum of echo signal, a method of automatically retrieving peak value is proposed. The flowchart of the automatic peak-finding algorithm (APFA) is shown in Figure 10.  
Figure 10: Flowchart of adaptive local peak-retrieval algorithm.  
Figure 9: Example results of accumulated spectrum estimation.  
Firstly, based on the Automatic Multiscale-Based Peak Detection (AMPD) method [40], the local maximum matrix \(M\) (\(m\)\(\times\)\(n\)) of the data sequence is established, where \(m\) = floor \((n/2)\) - 1, \(n\) = 14,336.  
\[M=\begin{bmatrix}m_{11}&m_{12}&\dots&m_{1n}\\ m_{21}&m_{21}&\dots&m_{2n}\\ \vdots&\vdots&\ddots&\vdots\\ m_{m1}&m_{m2}&\dots&m_{mn}\end{bmatrix}=(m_{i,j}), \tag{11}\]  
Secondly, the local maximum dimension of \(M\) should be controlled. The distribution of the 0 elements in the row vectors in the \(M\) matrix indicates the number of local maxima of the sequence within the moving window. The number of 0 elements in all row vectors in the \(M\) matrix is counted and the row with the greatest number of 0 elements is found, denoted as \(p\) (\(p\) = max [sum (\(m_{i,j}\) = 0)]). The matrix \(M\) is reshaped by deleting row vectors with row \(i\)\(>\)\(p\) to form a new matrix \(M^{\prime}\) (\(p\)\(\times\)\(n\)).  
Thirdly, peak positioning and compensation are performed. When all the elements of a column are zero, the element in the data series corresponding to that column is a candidate peak point. In addition, if a data point follows the trend of the left-hand proximity rising and the right-hand proximity falling within a certain window, it also needs to be classified as a peak point. If the corresponding new matrix \(M^{\prime}\) column vector satisfies (1) the first element of the column vector is 0; (2) the number of consecutive 0 elements from the first row \(H\)\(\geq\) floor (\(q/2\)); and (3) the candidate peak point satisfies the threshold condition, then the data point is added within the candidate peak point.  
Finally, peaks that are not in the peak-searching area are filtered out, and the peak-searching area is shown in the yellow area in Figure 9d.  
The first few range gates store the noise and mirror data, which should be removed after the peak search. The results of adaptive local peak retrieval of the measured power spectrum are given in Figure 11. The red asterisk represents the result of the peak search at each range gate. The horizontal coordinate represents the iteration of the set of frequencies in the spectrum with a sampling frequency of 1 GHz. Notably, the amplitude of the echo signal becomes increasingly faint as the detection distance increases, with the signal gradually being drowned out by noise at around 30 range gates (the corresponding sampling point is 3360). Therefore, the horizontal axis stopped at 3500. Vertical coordinate (PSD) is the result of a logarithmic operation on the sampling data to facilitate observation of the peak-finding results. The formula for logarithmic functions is y\({}^{\prime}\) = 10 \(\times\) 10g10(y), where y is the vertical coordinate data in Figure 9, and y\({}^{\prime}\) is the vertical coordinate data in Figure 11. Figure 11a shows the raw accumulated spectrum without spectra splicing. Circled in the diagram's red rectangular box is the signal drowned out by the noise; Figure 11b shows the peak-finding results, i.e., further processing in Figure 9d, with the red asterisks indicating the peak-finding results at each range gate. The APFA algorithm has the advantage of a low probability of false peaks and a strong identification of weak peaks, providing a fast, accurate, and adaptive method for the online analysis of CWML in the field.