coffeine.power_features.compute_features#

coffeine.power_features.compute_features(inst: ~mne.epochs.BaseEpochs | ~mne.io.base.BaseRaw, features: tuple[str] | list[str] = ('psds', 'covs'), duration: float = 60.0, shift: float = 10.0, n_fft: int = 512, n_overlap: int = 256, fs: float = 63.0, fmin: float = 0.0, fmax: float = 30.0, frequency_bands: dict[str, tuple[float, float]] | None = None, clean_func: callable = <function <lambda>>, cov_method: str = 'oas') tuple[dict, dict]#

Compute features from raw data or clean epochs.

Parameters:
instRaw object | Epochs object

An instance of Raw or Epochs.

featuresstr | list of str

The features to be computed. It can be ‘psds’, ‘covs’, ‘cross_frequency_covs’, ‘cross_frequency_corrs’ or ‘cospectral_covs’. If nothing is provided, defaults to (‘psds’, ‘covs’).

durationfloat

The length of the epochs. If nothing is provided, defaults to 60.

shiftfloat

The duration to separate events by (sliding shift of the epochs). If nothing is provided, defaults to 10.

n_fftint

The length of FFT used for computing power spectral density (PSD) using Welch’s method and the cospectral covariance. If nothing is provided, defaults to 512.

n_overlapint

The number of points of overlap between segments for PSD computation and for the estimation of cospectral covariance matrix. If nothing is provided, defaults to 256.

fsfloat

The sampling frequency of the signal for the estimation of cospectral covariance matrix. If nothing is provided, defaults to 63.0.

fminint

The minimal frequency to be returned for the estimation of cospectral covariance matrix and for PSD computation. If nothing is provided, defaults to 0.

fmaxint

The maximal frequency to be returned for the estimation of cospectral covariance matrix and for PSD computation. If nothing is provided, defaults to 30.

frequency_bandsdict

The frequency bands with which inst is filtered. If nothing is provided, defaults to {‘alpha’: (8.0, 12.0)}.

clean_funclambda function

If nothing is provided, defaults to lambda x: x.

cov_methodstr (default ‘oas’)

The covariance estimator to be used. Ignored for feature types not not related to covariances. Must be a method accepted by MNE’s covariance functions.

Returns:
computed_featuresdict

The features extracted.

resdict

The number of epochs, good epochs, clean epochs and frequencies.