mtspec.mt_coherence¶
-
mtspec.multitaper.
mt_coherence
(df, xi, xj, tbp, kspec, nf, p, **kwargs)[source]¶ Construct the coherence spectrum from the yk’s and the weights of the usual multitaper spectrum estimation. Note this code uses the real(4) multitaper code.
INPUT
Parameters: - df – float; sampling rate of time series
- xi – numpy.ndarray; data for first series
- xj – numpy.ndarray; data for second series
- tbp – float; the time-bandwidth product
- kspec – integer; number of tapers to use
- nf – integer; number of freq points in spectrum
- p – float; confidence for null hypothesis test, e.g. .95
OPTIONAL INPUT
Parameters: iadapt – integer 0 - adaptive, 1 - constant weights default adapt = 1 OPTIONAL OUTPUTS, the outputs are returned as dictionary, with keys as specified below and values as numpy.ndarrays. In order to activate the output set the corresponding kwarg in the argument list, e.g.
mt_coherence(df, xi, xj, tbp, kspec, nf, p, freq=True, cohe=True)
Parameters: - freq – the frequency bins
- cohe – coherence of the two series (0 - 1)
- phase – the phase at each frequency
- speci – spectrum of first series
- specj – spectrum of second series
- conf – p confidence value for each freq.
- cohe_ci – 95% bounds on coherence (not larger than 1)
- phase_ci – 95% bounds on phase estimates
If confidence intervals are requested, then both phase and cohe variables need to be requested as well.