cross_correlation¶
- sunkit_image.time_lag.cross_correlation(signal_a, signal_b, lags: Unit('s'))[source]¶
Compute cross-correlation between two signals, as a function of lag
By the convolution theorem the cross-correlation between two signals can be computed as,
\[\begin{split}\mathcal{C}_{AB}(\tau) &= \mathcal{I}_A(t)\star\mathcal{I}_B(t) \\ &= \mathcal{I}_A(-t)\ast\mathcal{I}_B(t) \\ &= \mathscr{F}^{-1}\{\mathscr{F}\{\mathcal{I}_A(-t)\}\mathscr{F}\{\mathcal{I}_B(t)\}\}\end{split}\]where each signal has been centered and scaled by its mean and standard deviation,
\[\mathcal{I}_c(t)=\frac{I_c(t)-\bar{I}_c}{\sigma_{c}}\]Additionally, \(\mathcal{C}_{AB}\) is normalized by the length of the time series.
- Parameters:
signal_a (array-like) – The first dimension should correspond to the time dimension and must have length
(len(lags) + 1)/2
.signal_b (array-like) – Must have the same dimensions as
signal_a
.lags (
Quantity
) – Evenly spaced time lags corresponding to the time dimension ofsignal_a
andsignal_b
running from-max(time)
tomax(time)
. This is easily constructed usingget_lags()
- Returns:
array-like – Cross-correlation as a function of
lags
. The first dimension will be the same as that oflags
and the subsequent dimensions will be consistent with dimensions ofsignal_a
andsignal_b
.
See also
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)
Appendix C in Barnes, W.T., Bradshaw, S.J., Viall, N.M. Understanding Heating in Active Region Cores through Machine Learning. I. Numerical Modeling and Predicted Observables ApJ, 880, 56, 2019 (https://doi.org/10.3847/1538-4357/ab290c)