This example will reimplement the local coherence misfit proposed in paper Full Waveform Inversion Using a High-Dimensional Local-Coherence Misfit Function, Yu et al(2023). It is a combination of the normalized cross-correlation and the structural similarity index(SSIM), which meaures the coherence between the windowed observed and synthetic data.
The local-coherence misfit function is defined as:
$$
J(\mathbf{m})=1-\frac{1}{N} \sum_{i=1}^{N} C\left(\mathbf{x}r, t\right)
$$
where $N$ is the number of windows, $\mathbf{m}$ is the model parameter, $\mathbf{x}r$ is the receiver position, and $t$ is the time. The local coherence $C$ is defined as:
$$
C\left(\mathbf{x}r, t\right)=\frac{\tilde{D}{\mathrm{syn}} \cdot \tilde{D}{\mathrm{obs}} }{{|| \tilde{D}{\mathrm{syn}} ||^2} {|| \tilde{D}{\mathrm{obs}} ||^2}}
$$
where $\tilde{D}{\mathrm{syn}}=D_{\mathrm{syn}}-\mathrm{mean}(D_{\mathrm{syn}})$ and $\tilde{D}{\mathrm{obs}}=D{\mathrm{obs}}-\mathrm{mean}(D_{\mathrm{obs}})$ are the moved data by subtracting their mean value,
The Gaussian window function is defined as:
$$
g(h,\tau)=\frac{\Delta \tau \Delta h}{\sigma_t \sigma_h} \exp \left(-\frac{h^2}{2 \sigma_h^2}\right) \exp \left(-\frac{{\tau}^2}{2 \sigma_{\tau}^2}\right)
$$
where
For calculate the local coherence, we first simulate the observed data and initial data with ground-truth model and initial model, respectively. Then we calculate the local coherence using the script show_lc.py.
In this script, a ricker example is also implemented to show the local coherence. The results are shown in the following figures.

