mne.preprocessing.annotate_flat¶
-
mne.preprocessing.
annotate_flat
(raw, bad_percent=5.0, min_duration=0.005, picks=None, verbose=None)[source]¶ Annotate flat segments of raw data (or add to a bad channel list).
- Parameters
- rawinstance of
Raw
The raw data.
- bad_percent
float
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_duration
float
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).
- picks
str
|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. Note that channels ininfo['bads']
will be included if their names or indices are explicitly provided.- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). If used, it should be passed as a keyword-argument only.
- rawinstance of
- Returns
- annotinstance of
Annotations
The annotated bad segments.
- bads
list
The channels detected as bad.
- annotinstance of
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.