mne.preprocessing.mark_flat

mne.preprocessing.mark_flat(raw, bad_percent=5.0, min_duration=0.005, picks=None, verbose=None)[source]

Mark flat segments of raw data using annotations or in info[‘bads’].

Parameters
rawinstance of Raw

The raw data.

bad_percentfloat

The percentage of the time a channel can be bad. Below this percentage, temporal bad marking (Annotations) will be used. Above this percentage, spatial bad marking (info['bads']) will be used. Defaults to 5 (5%).

min_durationfloat

The minimum duration (sec) to consider as actually flat. For some systems with low bit data representations, adjacent time samples with exactly the same value are not totally uncommon. Defaults to 0.005 (5 ms).

picksstr | list | slice | None

Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g., ['meg', 'eeg']) will pick channels of those types, channel name strings (e.g., ['MEG0111', 'MEG2623'] will pick the given channels. Can also be the string values “all” to pick all channels, or “data” to pick data channels. None (default) will pick good data channels.

verbosebool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

Returns
rawinstance of Raw

The modified raw instance. Operates in place.

Notes

This function is useful both for removing short segments of data where the acquisition system clipped (i.e., hit the ADC limit of the hardware) and for automatically identifying channels that were flat for a large proportion of a given recording.

This function may perform much faster if data are loaded in memory, as it loads data one channel at a time (across all time points), which is typically not an efficient way to read raw data from disk.

New in version 0.18.