obspy.signal.cross_correlation.xcorr_max

xcorr_max(fct, abs_max=True)[source]

Return shift and value of maximum xcorr function

Parameters:
  • fct (ndarray) xcorr function e.g. returned by xcorr
  • abs_max (bool) determines if the absolute maximum should be used.
Returns:

shift, value - Shift and value of maximum xcorr.

Example

>>> fct = np.zeros(101)
>>> fct[50] = -1.0
>>> xcorr_max(fct)
(0.0, -1.0)
>>> fct[50], fct[60] = 0.0, 1.0
>>> xcorr_max(fct)
(10.0, 1.0)
>>> fct[60], fct[40] = 0.0, -1.0
>>> xcorr_max(fct)
(-10.0, -1.0)
>>> fct[60], fct[40] = 0.5, -1.0
>>> xcorr_max(fct, abs_max=True)
(-10.0, -1.0)
>>> xcorr_max(fct, abs_max=False)
(10.0, 0.5)