mne.time_frequency.psd_array_multitaper#

mne.time_frequency.psd_array_multitaper(x, sfreq, fmin=0.0, fmax=inf, bandwidth=None, adaptive=False, low_bias=True, normalization='length', remove_dc=True, output='power', n_jobs=None, *, max_iter=150, n_per_seg=None, n_overlap=0, average='mean', verbose=None)[source]#

Compute power spectral density (PSD) using a multi-taper method.

The power spectral density is computed with DPSS tapers [1].

Parameters:
xarray, shape=(…, n_times)

The data to compute PSD from.

sfreqfloat

The sampling frequency.

fmin, fmaxfloat

The lower- and upper-bound on frequencies of interest. Default is fmin=0, fmax=np.inf (spans all frequencies present in the data).

bandwidthfloat

Frequency bandwidth of the multi-taper window function in Hz. For a given frequency, frequencies at ± bandwidth / 2 are smoothed together. The default value is a bandwidth of 8 * (sfreq / n_times).

adaptivebool

Use adaptive weights to combine the tapered spectra into PSD (slow, use n_jobs >> 1 to speed up computation).

low_biasbool

Only use tapers with more than 90% spectral concentration within bandwidth.

normalization‘full’ | ‘length’

Normalization strategy. If “full”, the PSD will be normalized by the sampling rate as well as the length of the signal (as in Nitime). Default is 'length'.

remove_dcbool

If True, the mean is subtracted from each segment before computing its spectrum.

outputstr

The format of the returned psds array, 'complex' or 'power':

  • 'power' : the power spectral density is returned.

  • 'complex' : the complex fourier coefficients are returned per taper.

n_jobsint | None

The number of jobs to run in parallel. If -1, it is set to the number of CPU cores. Requires the joblib package. 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_config context manager that sets another value for n_jobs.

max_iterint

Maximum number of iterations to reach convergence when combining the tapered spectra with adaptive weights (see argument adaptive). This argument has not effect if adaptive is set to False.

n_per_segint | None

Length of each segment (windowed with DPSS tapers). Defaults to None, which uses the entire signal length without segmentation.

New in v1.14.

n_overlapint

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

New in v1.14.

averagestr | None

How to average the segments. If 'mean' (default), calculate the arithmetic mean across segments. If 'median', calculate the median, corrected for its bias relative to the mean. If None, returns the unaggregated segments. Must be None when output="complex".

New in v1.14.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Returns:
psdsndarray

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 (and tapers dimension if output='complex'). If average=None, the returned array will also include an additional segment dimension.

freqsarray

The frequency points in Hz of the PSD.

weightsndarray

The weights used for averaging across tapers. Only returned if output='complex'.

Notes

New in v0.14.0.

References