mne.time_frequency.psd_array_welch

mne.time_frequency.psd_array_welch(x, sfreq, fmin=0, fmax=inf, n_fft=256, n_overlap=0, n_per_seg=None, n_jobs=1, average='mean', verbose=None)[source]

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

Parameters
xarray, shape=(…, n_times)

The data to compute PSD from.

sfreqfloat

The sampling frequency.

fminfloat

The lower frequency of interest.

fmaxfloat

The upper frequency of interest.

n_fftint

The length of FFT used, must be >= n_per_seg (default: 256). The segments will be zero-padded if n_fft > n_per_seg.

n_overlapint

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

n_per_segint | None

Length of each Welch segment (windowed with a Hamming window). Defaults to None, which sets n_per_seg equal to n_fft.

n_jobsint

The number of jobs to run in parallel (default 1). Requires the joblib package.

averagestr | None

How to average the segments. If mean (default), calculate the arithmetic mean. If median, calculate the median, corrected for its bias relative to the mean. If None, returns the unaggregated segments.

New in version 0.19.0.

verbosebool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

Returns
psdsndarray, shape (…, n_freqs) or (…, n_freqs, n_segments)

The power spectral densities. If average='mean or average='median', the returned array will have the same shape as the input data plus an additional frequency dimension. If average=None, the returned array will have the same shape as the input data plus two additional dimensions corresponding to frequencies and the unaggregated segments, respectively.

freqsndarray, shape (n_freqs,)

The frequencies.

Notes

New in version 0.14.0.