WaveletCoherence.compute#
- WaveletCoherence.compute(first, second)[source]#
Compute coherence and phase between two aligned series.
Builds the scale grid for the sample length, transforms both series, smooths and normalizes the cross-wavelet, marks the cone of influence, and – if surrogates were requested – draws the AR(1) surrogates and their per-scale significance level.
- Parameters:
- Return type:
- Returns:
- Raises:
DimensionError – If either series is not one-dimensional or the second does not match the first’s length.
SpecificationError – If they are shorter than 32.
Example
>>> rng = np.random.default_rng(0) >>> a, b = rng.standard_normal(128), rng.standard_normal(128) >>> res = WaveletCoherence(per_octave=2, surrogates=0).compute(a, b) >>> res.coherence.shape, res.significance is None, bool(res.cone[-1].all()) ((13, 128), True, True) >>> WaveletCoherence(surrogates=0).compute(a, b[:100]) Traceback (most recent call last): ... cultivars.exceptions.DimensionError: second must be one-dimensional with length 128; ...