v2.0.0
Loading...
Searching...
No Matches
spectral.h File Reference

Multi-taper spectral estimation: tapered FFT, power and cross-spectral density, DPSS weighting. More...

#include "math_global.h"
#include <vector>
#include <utility>
#include <Eigen/Core>
#include <QString>
#include <QPair>
#include <QSharedPointer>
Include dependency graph for spectral.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  UTILSLIB::TaperedSpectraInputData
 Per-row input bundle for parallel multi-taper spectral estimation (data row, taper matrix, FFT length). More...
class  UTILSLIB::Spectral
 Static multi-taper spectra, PSD and CSD estimator for MEG/EEG time series. More...

Namespaces

namespace  UTILSLIB
 Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).

Detailed Description

Multi-taper spectral estimation: tapered FFT, power and cross-spectral density, DPSS weighting.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
March 2026

UTILSLIB::Spectral implements the multi-taper / Welch family of spectral estimators that the connectivity and time-frequency pipelines in mne-cpp rely on. A single segment of length N is windowed by each of K Slepian (DPSS) tapers, FFT'd to length iNfft, and the K complex spectra are combined into a power spectral density (PSD) or a cross-spectral density (CSD) matrix; multi-tapering reduces the variance of the estimator by roughly 1/K at the cost of (K+1)/(NW) of spectral resolution.

The class is static and operates row-wise on Eigen matrices so it can fan out across channels via QtConcurrent without touching any shared state. PSD scaling follows the one-sided convention (factor 2 on bins 1…Nyquist-1, no doubling at DC or Nyquist) so results are directly comparable to MNE-Python's psd_array_multitaper, and CSD matrices are returned as one complex matrix per frequency bin for direct ingestion by CONNECTIVITYLIB's coherence and phase estimators.

Reference: Percival & Walden (1993) "Spectral Analysis for Physical Applications", chapters 7–8.

Definition in file spectral.h.