- mne.time_frequency.psd_array_welch(x, sfreq, fmin=0, fmax=inf, n_fft=256, n_overlap=0, n_per_seg=None, n_jobs=None, average='mean', window='hamming', remove_dc=True, *, output='power', verbose=None)#
Compute power spectral density (PSD) using Welch’s method.
Welch’s method is described in Welch.
array, shape=(…, n_times)
The data to compute PSD from.
The sampling frequency.
The lower frequency of interest.
The upper frequency of interest.
The length of FFT used, must be
>= n_per_seg(default: 256). The segments will be zero-padded if
n_fft > n_per_seg.
The number of points of overlap between segments. Will be adjusted to be <= n_per_seg. The default value is 0.
Length of each Welch segment (windowed with a Hamming window). Defaults to None, which sets n_per_seg equal to n_fft.
The number of jobs to run in parallel. If
-1, it is set to the number of CPU cores. Requires the
None(default) is a marker for ‘unset’ that will be interpreted as
n_jobs=1(sequential execution) unless the call is performed under a
joblib.parallel_configcontext manager that sets another value for
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 v0.19.0.
Windowing function to use. See
New in v0.22.0.
True, the mean is subtracted from each segment before computing its spectrum.
The format of the returned
'power': the power spectral density is returned.
'complex': the complex fourier coefficients are returned per window.
New in v1.4.0.
- verbosebool |
ndarray, shape (…, n_freqs) or (…, n_freqs, n_segments)
The power spectral densities. If
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.
ndarray, shape (n_freqs,)
New in v0.14.0.