mne.preprocessing.annotate_break#
- mne.preprocessing.annotate_break(raw, events=None, min_break_duration=15.0, t_start_after_previous=5.0, t_stop_before_next=5.0, ignore=('bad', 'edge'), *, verbose=None)[source]#
Create
Annotationsfor breaks in an ongoing recording.This function first searches for segments in the data that are not annotated or do not contain any events and are at least
min_break_durationseconds long, and then proceeds to creating annotations for those break periods.- Parameters
- rawinstance of
Raw The continuous data to analyze.
- events
None|array, shape (n_events, 3) If
None(default), operate based solely on the annotations present inraw. If an events array, ignore any annotations in the raw data, and operate based on these events only.- min_break_duration
float The minimum time span in seconds between the offset of one and the onset of the subsequent annotation (if
eventsisNone) or between two consecutive events (ifeventsis an array) to consider this period a “break”. Defaults to 15 seconds.Note
This value defines the minimum duration of a break period in the data, not the minimum duration of the generated annotations! See also
t_start_after_previousandt_stop_before_nextfor details.- t_start_after_previous, t_stop_before_next
float Specifies how far the to-be-created “break” annotation extends towards the two annotations or events spanning the break. This can be used to ensure e.g. that the break annotation doesn’t start and end immediately with a stimulation event. If, for example, your data contains a break of 30 seconds between two stimuli, and
t_start_after_previousis set to5andt_stop_before_nextis set to3, the break annotation will start 5 seconds after the first stimulus, and end 3 seconds before the second stimulus, yielding an annotated break of30 - 5 - 3 = 22seconds. Both default to 5 seconds.Note
The beginning and the end of the recording will be annotated as breaks, too, if the period from recording start until the first annotation or event (or from last annotation or event until recording end) is at least
min_break_durationseconds long.- ignoreiterable of
str Annotation descriptions starting with these strings will be ignored by the break-finding algorithm. The string comparison is case-insensitive, i.e.,
('bad',)and('BAD',)are equivalent. By default, all annotation descriptions starting with “bad” and annotations indicating “edges” (produced by data concatenation) will be ignored. Pass an empty list or tuple to take all existing annotations into account. Ifeventsis passed, this parameter has no effect.- verbosebool |
str|int|None Control verbosity of the logging output. If
None, use the default verbosity level. See the logging documentation andmne.verbose()for details. Should only be passed as a keyword argument.
- rawinstance of
- Returns
- break_annotationsinstance of
Annotations The break annotations, each with the description
'BAD_break'. If no breaks could be found given the provided function parameters, an emptyAnnotationsobject will be returned.
- break_annotationsinstance of
Notes
New in version 0.24.