time_lag

sunkit_image.time_lag.time_lag(signal_a, signal_b, time: Unit('s'), lag_bounds: (Unit('s'), None) = None, **kwargs)[source]

Compute the time lag that maximizes the cross-correlation between signal_a and signal_b.

For a pair of signals \(A,B\), e.g. time series from two EUV channels on AIA, the time lag is the lag which maximizes the cross-correlation,

\[\tau_{AB} = \mathop{\mathrm{arg\,max}}_{\tau}\mathcal{C}_{AB},\]

where \(\mathcal{C}_{AB}\) is the cross-correlation as a function of lag (computed in cross_correlation()). Qualitatively, this can be thought of as how much signal_a needs to be shifted in time to best “match” signal_b. Note that the sign of \(\tau_{AB}`\) is determined by the ordering of the two signals such that,

\[\tau_{AB} = -\tau_{BA}.\]
Parameters:
  • signal_a (array-like) – The first dimension must be the same length as time.

  • signal_b (array-like) – Must have the same dimensions as signal_a.

  • time (Quantity) – Time array corresponding to the intensity time series signal_a and signal_b.

  • lag_bounds (Quantity, optional) – Minimum and maximum lag to consider when finding the time lag that maximizes the cross-correlation. This is useful for minimizing boundary effects.

  • array_check_hook (function) – Function to apply to the resulting time lag result. This should take in the lags array and the indices that specify the location of the maximum of the cross-correlation and return an array that has used those indices to select the lags which maximize the cross-correlation. As an example, if lags and indices are both ndarray objects, this would just return lags[indices]. It is probably only necessary to specify this if you are working with arrays that are something other than a ndarray or Array object.

Returns:

array-like – Lag which maximizes the cross-correlation. The dimensions will be consistent with those of signal_a and signal_b, i.e. if the input arrays are of dimension (K,M,N), the resulting array will have dimensions (M,N). Similarly, if the input signals are one-dimensional time series (K,), the result will have dimension (1,).

References