solarspatialtools.signalproc.correlation
- solarspatialtools.signalproc.correlation(baseline, estimation, scaling='coeff')
Compute the cross correlation between two signals, including the full range of possible time lags.
The value of correlation at lags==0 is the traditional cross-correlation without allowing for time shifting.
This function is essentially a wrapper for scipy.stats.correlate, providing pre-baked scaling options, and always returning the lags.
Parameters
- baselinenumeric or pandas.Series
The baseline signal
- estimationnumeric or pandas.Series
The predicted signal
- scalingstr
a string for the type scaling to use.
- Options are:
- energy:
scales by the energy of the autocorrelation of the input
- coeff:
scales the output to the correlation coefficient (always removes the mean from both signals)
- unbiased_energy:
similar to energy, but normalizes based on lag to account for the fewer points used in the convolution. Removes bias towards small lags.
- unbiased_coeff:
similar to coeff, but normalizes based on lag to account for the fewer points used in the convolution. Removes bias towards small lags.
Returns
- corrnumeric
A vector of the cross correlations
- lagnumeric
A vector of the lag for each cross correlation