mne.time_frequency.psd_welch

mne.time_frequency.psd_welch(inst, fmin=0, fmax=inf, tmin=None, tmax=None, n_fft=256, n_overlap=0, picks=None, proj=False, n_jobs=1, verbose=None)

Compute the power spectral density (PSD) using Welch’s method.

Calculates periodigrams for a sliding window over the time dimension, then averages them together for each channel/epoch.

Parameters:

inst : instance of Epochs or Raw or Evoked

The data for PSD calculation

fmin : float

Min frequency of interest

fmax : float

Max frequency of interest

tmin : float | None

Min time of interest

tmax : float | None

Max time of interest

n_fft : int

The length of the tapers ie. the windows. The smaller it is the smoother are the PSDs. The default value is 256. If n_fft > len(inst.times), it will be adjusted down to len(inst.times).

n_overlap : int

The number of points of overlap between blocks. Will be adjusted to be <= n_fft. The default value is 0.

picks : array-like of int | None

The selection of channels to include in the computation. If None, take all channels.

proj : bool

Apply SSP projection vectors. If inst is ndarray this is not used.

n_jobs : int

Number of CPUs to use in the computation.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose).

Returns:

psds : ndarray, shape (..., n_freqs)

The power spectral densities. If input is of type Raw, then psds will be shape (n_channels, n_freqs), if input is type Epochs then psds will be shape (n_epochs, n_channels, n_freqs).

freqs : ndarray, shape (n_freqs,)

The frequencies.

Notes

New in version 0.12.0.