solarspatialtools.signalproc.compute_delays
- solarspatialtools.signalproc.compute_delays(ts_in, ts_out, mode='loop', scaling='coeff')
Compute the delay between two sets of timeseries using cross correlation. Uses similar methodologies to xcorr_delay, but allows for multiple input timeseries to be computed simultaneously.
Parameters
- ts_in: pd.DataFrame
The time series representing the input signal
- ts_out: pd.DataFrame
The time series representing the output signal
- mode: str (default ‘loop’)
The method to use for computing the delay.
- Options are:
- loop:
loop over each input timeseries pair and compute the xcorr
- fft:
use the fft to compute the xcorr (seems to be slower)
- scaling: str (default ‘coeff’)
Type of scaling to use for cross correlation. Note that debiased scaling options are not available here.
- Valid options are:
- coeff:
computes the correlation coefficient
- none:
no scaling is applied
Returns
- delayarray(float)
Time lag between the two timeseries at the maximum value of the cross correlation. Values are always integer multiples of the sampling period as the max correlation values are limited to the discrete time steps.
- extra_datadict{}
Additional data about the correlations. Values are: ‘peak_corr’ - the peak value of the correlation for each input ts ‘mean_corr’ - the mean correlation for each input timeseries ‘zero_corr’ - the correlation at zero_lag for each input timeseries