mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

annotate_break() may be reporting incorrect break durations / output may be confusing

Open hoechenberger opened this issue 2 years ago • 2 comments

Description of the problem

I just ran:

mne.preprocessing.annotate_break(raw=raw, min_break_duration=15)

and it produced one break segment that is, in my understanding, too short, given my specifications -- but only at the first sight!

Steps to reproduce

I cannot share the data or a MWE right now, but wanted to log this issue for further investigation so I / we don't forget.

I ran

mne.preprocessing.annotate_break(raw=raw, min_break_duration=15)

Link to data

No response

Expected results

In my data I'd expected to find 3 segments >= 15 seconds duration.

Actual results

3 segments are found, great! But the output is confusing:

Detected 3 break periods of >= 15 s duration:
    5.0 – 129.8 s [124.8 s]
    140.9 – 147.6 s [6.8 s]
    160.1 – 184.4 s [24.3 s]
In total, 20.9% of the data (155.8 s) have been marked as a break.

Note the 2nd break period.

I believe what we're actually reporting here are the durations of the Annotations we create, and not the durations of the detected break periods. I was confused at first as seeing that a break period >= 15 s with a duration clearly less than that was reported.

Additional information

Maybe we could improve the output to be something like:

Detected 3 break periods of >= 15 s duration:
    0 – 135 s  --> Annotating range: 5.0 – 129.8 s [124.8 s]
    135 – 152 s --> Annotating range: 140.9 – 147.6 s [6.8 s]
    155 – 189 s --> Annotating range: 160.1 – 184.4 s [24.3 s]
In total, 20.9% of the data (155.8 s) have been marked as a break.

hoechenberger avatar Oct 25 '23 16:10 hoechenberger

I like the improved logging idea

larsoner avatar Oct 25 '23 16:10 larsoner

I also like the improved logging idea.

sappelhoff avatar May 27 '25 11:05 sappelhoff