carltape at geodynamics.org carltape at geodynamics.org
Mon Nov 24 09:07:54 PST 2008

Author: carltape
Date: 2008-11-24 09:07:54 -0800 (Mon, 24 Nov 2008)
New Revision: 13383

Modified:
Log:
Notes on cross-correlation.

===================================================================
(Binary files differ)

___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream

===================================================================
+++ seismo/3D/ADJOINT_TOMO/flexwin/latex/cc_notes.tex	2008-11-24 17:07:54 UTC (rev 13383)
@@ -0,0 +1,84 @@
+\documentclass[11pt]{article}
+%\documentclass[extra]{gji}
+\usepackage{graphicx}
+\usepackage{rotating}
+\usepackage{a4wide}
+\usepackage{setspace}
+%\usepackage[utf8]{inputenc}
+\usepackage[latin1]{inputenc}
+\usepackage{amsmath}
+\usepackage{natbib}
+\usepackage[noend]{algorithmic}
+
+%\doublespacing
+\onehalfspacing
+\setlength\parindent{0in}
+
+\input{def_base}
+
+\begin{document}
+
+\section*{Notes on normalized cross-correlation}
+
+
+\subsection*{Cross-correlation formula}
+
+First, we list the following formula:
+%
+$$+\Gamma(t) = \frac {\int \widetilde{s}(t') \widetilde{d}(t'-t)\,\rmd t'} + { \left[\int \widetilde{s}^2(t')\,\rmd t' \int \widetilde{d}^2(t'-t)\,\rmd t' \right]^{1/2}} +$$
+%
+My point about this has nothing to do with what we implement.  It's that, in the absence of integration limits for convolution-like expressions, one would assume $[-\infty,\infty]$ limits.  In that case, it doesn't matter how you shift $d^2(t)$, because the result is the same:
+%
+$$+\int_{\infty}^{\infty} \widetilde{d}^2(t'-t)\,\rmd t' += \int_{\infty}^{\infty} \widetilde{d}^2(t'+t)\,\rmd t' += \int_{\infty}^{\infty} \widetilde{d}^2(t')\,\rmd t' +$$
+%
+That is why the limits are important, and the limits are essentially included in Equation~(2) in the PDF that you sent.  What would (2) look like for us?  In our case, I suppose we have
+
+$d$ is the image and the sum over $t$ under the window containing the feature $s$ positioned at $t'$
+
+And then (2) looks like
+%
+\begin{eqnarray}
+\gamma(t') &=& \frac{\sum_{t}[d(t) - \bar{d}_{t'} ][s(t-t') - \bar{s}] }
+{\{\sum_{t} [d(t) - \bar{d}_{t'}]^2 \sum_{t} [s(t-t') - \bar{s} ]^2 \}^{1/2} }
+\\
+\bar{d}_{t'} &=&
+\\
+\bar{s} &=&
+\end{eqnarray}
+%
+This is only a start.  It is still sloppy, considering the mix of continuous and discrete notation, and the vague summation (integration) limits.  If this is the formula we are trying to implement, would you please adapt it to what we want to use, and also include explicit integration limits?  Then we can see how it is implemented.
+
+\pagebreak
+\subsection*{Limiting time-shift searches in CC calculation on the basis of maximum allowed time-shift}
+
+\begin{quote}
+I do not think this is a good idea for window selection. The time-shift should be the shift at which the maximum cross-correlation is achieved.  Say your true maximum cross-correlation is at 5 seconds, but you  have limited your search to 4 seconds: you will have a value of cross-correlation which would be maximal at 4 seconds, and you would  therefore say the time-shift between your two signals is 4 s, when in fact it is 5.  I would much prefer taking the solution you have in the measurement code, i.e. using the entire window length as the time-shift search limits, then rejecting those windows that have larger time-shifts than we demand. The fact that we work essentially with box-car tapered windows means there is no danger of bringing in information from outside the windows themselves.
+\end{quote}
+%
+First, your are right in one thing: it is not the energy outside the window.  It's the energy {\em inside} the window.  This will be an issue when a window is longer than the allowable time shift, which is always the case, I think.
+
+Okay, consider this.  If the real time shift is 5~s, but you think it should generally be no more than 4~s, then you pick 4~s as the cross-correlation.  But the max CC value is probably not going to have a passable value to have this window picked.  And if it does, then I still think the 4~s shift is much better than rejecting the window.  It would be better to use this in the inversion than nothing at all.  All it means is using a 4~s weight on the adjoint source rather than a 5~s weight.
+
+All we care about is picking the right windows, and the heart of the matter is that $\Gamma(t)$ has local maxima, and typically it is the local maximum with the smaller time shift that should be preferred over the (possible) global maximum whose time shift is too large and thus the window will be rejected.  For example, you limit your search to 4~s, and the actual time shift is 1~s and $CC_{1s} = 0.80$.  However, $CC_{5s} = 0.85$, because it has found another peak that happens to line up better.  The 5~s shift is used, and then the window is rejected due to the 4~s limit.
+
+
+%----------------------------------
+
+\bibliographystyle{plainnat}
+\bibliography{AM-allcitations}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\end{document}
+%========================================