Skip to content

Break detection

find_breaks module-attribute

Python
find_breaks: bool = False

During an experimental run, the recording might be interrupted by breaks of various durations, e.g. to allow the participant to stretch, blink, and swallow freely. During these periods, large-scale artifacts are often picked up by the recording system. These artifacts can impair certain stages of processing, e.g. the peak-detection algorithms we use to find EOG and ECG activity. In some cases, even the bad channel detection algorithms might not function optimally. It is therefore advisable to mark such break periods for exclusion at early processing stages.

If True, try to mark breaks by finding segments of the data where no experimental events have occurred. This will then add annotations with the description BAD_break to the continuous data, causing these segments to be ignored in all following processing steps.

Example

Automatically find break periods, and annotate them as BAD_break.

Python
find_breaks = True

Disable break detection.

Python
find_breaks = False

min_break_duration module-attribute

Python
min_break_duration: float = 15.0

The minimal duration (in seconds) of a data segment without any experimental events for it to be considered a "break". Note that the minimal duration of the generated BAD_break annotation will typically be smaller than this, as by default, the annotation will not extend across the entire break. See t_break_annot_start_after_previous_event and t_break_annot_stop_before_next_event to control this behavior.

Example

Periods between two consecutive experimental events must span at least 15 seconds for this period to be considered a "break".

Python
min_break_duration = 15.

t_break_annot_start_after_previous_event module-attribute

Python
t_break_annot_start_after_previous_event: float = 5.0

Once a break of at least min_break_duration seconds has been discovered, we generate a BAD_break annotation that does not necessarily span the entire break period. Instead, you will typically want to start it some time after the last event before the break period, as to not unnecessarily discard brain activity immediately following that event.

This parameter controls how much time (in seconds) should pass after the last pre-break event before we start annotating the following segment of the break period as bad.

Example

Once a break period has been detected, add a BAD_break annotation to it, starting 5 seconds after the latest pre-break event.

Python
t_break_annot_start_after_previous_event = 5.

Start the BAD_break annotation immediately after the last pre-break event.

Python
t_break_annot_start_after_previous_event = 0.

t_break_annot_stop_before_next_event module-attribute

Python
t_break_annot_stop_before_next_event: float = 5.0

Similarly to how t_break_annot_start_after_previous_event controls the "gap" between beginning of the break period and BAD_break annotation onset, this parameter controls how far the annotation should extend toward the first experimental event immediately following the break period (in seconds). This can help not to waste a post-break trial by marking its pre-stimulus period as bad.

Example

Once a break period has been detected, add a BAD_break annotation to it, starting 5 seconds after the latest pre-break event.

Python
t_break_annot_start_after_previous_event = 5.

Start the BAD_break annotation immediately after the last pre-break event.

Python
t_break_annot_start_after_previous_event = 0.