mne-tools / mne-features

MNE-Features software for extracting features from multivariate time series
https://mne-tools.github.io/mne-features/
BSD 3-Clause "New" or "Revised" License
141 stars 32 forks source link

FIX: deal with flat epochs in feature extraction #7

Open jbschiratti opened 6 years ago

jbschiratti commented 6 years ago

The function extract_features extracts features from a data array X, shape (n_epochs, n_channels, n_times) epoch by epoch. If an epoch is flat (that is, if np.allclose(X[j, :, :], 0) is True), then most feature functions will either return arrays of 0 or fails (log of negative values, division by 0,...).

Possible fix: The utility function _apply_extractor should check if the epoch is flat and, if so, deal with it (for example: return 0 for all the features + warning to the user).

agramfort commented 6 years ago

I would fix each feature function individually as depending on method 0 is a good default or not.