WelchSpectrum.compute#

WelchSpectrum.compute()[source]#

Estimate the density matrix.

Walks the sample in steps of half a segment, demeans and Hann-tapers each block, and averages the blocks’ cross-periodograms on the segment’s Fourier grid.

Return type:

SpectrumEstimate

Returns:

The SpectrumEstimate on segment // 2 + 1 frequencies, with degrees_of_freedom = 36 B / 19 for the B segments used and bandwidth = 2 pi / segment.

Example

>>> rng = np.random.default_rng(0)
>>> est = WelchSpectrum(rng.standard_normal((512, 2)), segment=64).compute()
>>> est.method, est.frequencies.shape, round(est.degrees_of_freedom, 1)
('welch', (33,), 28.4)