mne-tools / mne-tools/mne-python

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

Open
#12,136 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the mne.preprocessing.annotate_break entry point and inspect how detected break periods and created annotations are calculated and reported. Reproduce the behavior with a suitable Raw object and min_break_duration=15; done means the output clearly distinguishes detected break durations from annotation ranges, with tests covering the reported discrepancy.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.