## Local similarity

A common way to measure the similarity between two signals is to calculate the global correlation coefficient: (8)

where is the global correlation coefficient, denotes the number of samples of the signals and . In order to calculate the similarity between two signals locally, one can use the localized correlation coefficient: (9)

where denotes the local correlation coefficient, is the local window size.
Fomel (2007a) designed an elegant way to calculate the local similarity:  (10)  (11)  (12)

Equation 10 represents that the local similarity can be expressed as the product of two vectors that are the solutions of two minimization problems. is a regularization operator for constraining and . can be chosen as a local triangular smoother to enforce the smoothness of vectors and , and then equations 11 and 12 can be solved using the shaping regularization (Fomel, 2007b):  (13)  (14)

where is a diagonal operator composed from the elements of : and is a diagonal operator composed from the elements of : . is a smoothing operator, and and are two parameters controlling the physical dimensionality and enabling fast convergence when inversion is implemented iteratively. These two parameters can be chosen as the least-squares norms of and (Fomel, 2007a).

The local similarity algorithm can be used for the calculation of signals of any dimension. For 1D signals, the meanings of equations 13 and 14 are intuitive. For 2D or higher-dimensional signals, each signal is first reshaped into a 1D signal and then follows equations 13 and 14 to calculate the local similarity vector. The smoothing operator is applied to the 2D or multi-dimensional form of the original signal to enforce the smoothness in any dimension. Figures 3 and 4 show demonstrations for both 1D and 2D signals. Figures 3a and 3b show the same trace with different level of noise. Figure 3c shows the calculated local similarity for the 1D signal. Figures 4a and 4b show the same flattened gather with different level of noise. Figure 4c shows the calculated local similarity for the 2D signal. From the two examples, we can conclude that the local similarity can effectively obtain smooth and reasonable measurements for both 1D and 2D signals. The peaks in the calculated local similarity indicate the position of useful wavelets correctly. trace-comp
Figure 3.
Local similarity for 1D signal. (a) & (b) The same trace with different level of noise. (c) Calculated local similarity.    flat-comp
Figure 4.
Local similarity for 2D signal. (a) & (b) The same flattened gather with different level of noise. (c) Calculated local similarity.   2020-04-11