## 2 Methodology  
In ultrasonic testing, the excitation sequence is known, and the inspectors generally look for signals with the same characteristics in the time domain to find their signals of interest, such as a defect in materials. In UGW, one of the common excitation sequences is a 10-cycle Hann windowed signal with different frequency, depending on the testing conditions. However, these signals are typically polluted by coherent noise which has similar temporal characteristics to those of defect signals.  
It was mentioned beforehand that in the guided-wave, torsional waves are nondispersive and axisymmetric. The flexurals, which are the main source of coherent noise in the tests, are dispersive and nonaxisymmetric. In the power spectrum of an inspected pure torsional wave, the same characteristics of the spectrum of the excitation sequence must be observed; this is not the case for flexural waves due to their temporal and spatial variances. It should also be mentioned that asymmetric features (which is the case for most defects) generally reflect both torsional and flexural waves; where their corresponding reflection coefficients depends on the geometry of the feature. However, in this research, we focus our detection based on the detection of the torsional waves. The torsional wave is always reflected, and it is received symmetrically around the pipe circumference regardless of the features' geometry or the wave propagation distance. Furthermore, in some cases, the flexural waves are considered as the coherent noise received due to mode conversion from the known features, leading to detection of false alarms in the tests. Hence, the focus is in detection of torsional wave in order to find the location of features.  
In this paper, we propose a condition-based comparison of the power spectrum achieved from a moving window of the received signal and the spectrum of the normal excitation sequence. Keeping in mind that, since both flexural and torsional waves have the same main bandwidth (BW), correlating them would not be sufficient for distinguishing between them. Nonetheless, using this proposed method the torsional wave is identifiable. Another advantage of this method is that it is relying on the excitation sequence, which is known and set manually by the inspectors.  
This algorithm consists of three main aspects: (1) initialisation, which initialises the excitation sequence and extract the required features for comparison; (2) main loop, that uses the advancing window and carries out the pre- and postprocessing of the conditions; and (3) conditions, which constitute the main processing, where the spectrum of each iteration is compared with the one achieved from excitation sequence.  
Since the signals are processed digitally, and due to the limited resolution in this domain, in the following section all formulae and definitions are presented based on the sample number for the time-domain and bin number for the power spectrum. In doing so, better performance, in terms of speed is achieved as no unnecessary interpolation, is needed. The sampling frequency (Fs) used in the tests is 1 MHz which is a fairly common sampling frequency of guided-wave inspection devices.