WaveletCoherenceResult.lead#
- WaveletCoherenceResult.lead(scale_band)[source]#
Mean lead of the first series, in observations, over a band of periods.
The phase difference at each date in the band is converted to time as \(\phi\,\lambda / 2\pi\) and averaged over dates outside the cone of influence and scales whose period lies in
scale_band.- Parameters:
scale_band (
tuple[float,float]) –(low, high)periods, inclusive.- Return type:
- Returns:
Positive when the first series leads, negative when it lags;
nanif every date in the band is inside the cone.- Raises:
SpecificationError – If no scale falls in the band.
Example
A sinusoid and its two-observation delay, both ways round:
>>> t = np.arange(256.0) >>> x = np.sin(2 * np.pi * t / 16) >>> y = np.sin(2 * np.pi * (t - 2) / 16) >>> wc = WaveletCoherence(per_octave=4, surrogates=0) >>> round(wc.compute(x, y).lead((14.0, 18.0)), 1) 2.1 >>> round(wc.compute(y, x).lead((14.0, 18.0)), 1) -2.1 >>> wc.compute(x, y).lead((1000.0, 2000.0)) Traceback (most recent call last): ... cultivars.exceptions.SpecificationError: no scale has a period in [1000.0, 2000.0].