outliers_to_nan

outliers_to_nan(trials: ~mne.epochs.BaseEpochs, outliers: float, copy: bool = False, picks: list = 'data', deviation: callable = <function nanstd>, center: callable = <function nanmean>, tmin: int | float = None, tmax: int | float = None, verbose=None) BaseEpochs[source][source]

Set outliers to nan.

Parameters:
  • trials (mne.epochs.BaseEpochs) – The trials to remove outliers from.

  • outliers (float) – The number of deviations above the mean to be considered an outlier.

  • copy (bool, optional) – Whether to copy the data, by default False

  • picks (list, optional) – The channels to remove outliers from, by default ‘data’

  • deviation (callable, optional) – Metric function to determine the deviation from the center. Default is median absolute deviation.

  • center (callable, optional) – Metric function to determine the center of the data. Default is median.

  • tmin (int | float)

  • tmax (int | float)

Returns:

The trials with outliers set to nan.

Return type:

mne.epochs.BaseEpochs

Examples

>>> import mne
>>> from ieeg.io import raw_from_layout
>>> bids_root = mne.datasets.epilepsy_ecog.data_path(verbose=50)
>>> layout = BIDSLayout(bids_root)
>>> raw = raw_from_layout(layout, subject="pt1", preload=True,
... extension=".vhdr", verbose=False)
Reading 0 ... 269079  =      0.000 ...   269.079 secs...
>>> epochs = trial_ieeg(raw, ['AD1-4, ATT1,2', 'AST1,3', 'G16', 'PD'],
... (-1, 2), preload=True, verbose=False)
>>> outliers_to_nan(epochs, 1, True, [0], verbose=False,
... ).get_data()[1]
array([[            nan,             nan,             nan, ...,
                    nan,             nan,             nan],
       [-4.63276969e-04, -4.67964469e-04, -4.72261344e-04, ...,
         1.41019078e-04,  1.22269102e-04,  9.92222578e-05],
       [-2.84374563e-04, -3.03515188e-04, -3.08593313e-04, ...,
         9.57034922e-05,  5.19535000e-05,  1.40628818e-05],
       ...,
       [-4.69516375e-04, -5.09750688e-04, -5.69906813e-04, ...,
         3.45716687e-04,  3.10951125e-04,  3.25794844e-04],
       [-1.67187703e-04, -1.95703313e-04, -2.23047047e-04, ...,
        -2.52734531e-04, -2.89062656e-04, -2.57422031e-04],
       [-1.98796781e-04, -2.79265281e-04, -3.31218250e-04, ...,
        -2.73129219e-05, -1.52703172e-04, -2.52702875e-04]])
>>> outliers_to_nan(epochs, .1, verbose=False, copy=True,
... deviation=None).get_data()[0]

Examples using ieeg.navigate.outliers_to_nan

PCA-LDA Decoding

PCA-LDA Decoding

Time and Frequency Permutation Cluster Statistics

Time and Frequency Permutation Cluster Statistics

Morlet Wavelet spectrogram plot

Morlet Wavelet spectrogram plot

Morlet Wavelet spectrogram plot

Morlet Wavelet spectrogram plot