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
andsignal_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 muchsignal_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 seriessignal_a
andsignal_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 thelags
which maximize the cross-correlation. As an example, iflags
andindices
are bothndarray
objects, this would just returnlags[indices]
. It is probably only necessary to specify this if you are working with arrays that are something other than andarray
orArray
object.
- Returns:
array-like – Lag which maximizes the cross-correlation. The dimensions will be consistent with those of
signal_a
andsignal_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
Viall, N.M. and Klimchuk, J.A. Evidence for Widespread Cooling in an Active Region Observed with the SDO Atmospheric Imaging Assembly ApJ, 753, 35, 2012 (https://doi.org/10.1088/0004-637X/753/1/35)