annotate_break() should ignore `New Segment` annotations by default
Describe the new feature or enhancement
Currently, annotate_break() ignores annotations starting with bad and edge.
I'm working with BrainVision data, and each recording run starts with a New Segment annotation that is added by the acquisition system and is not an experimental event. It should be added to the list of annotations that is ignored when calculating break durations in annotate_break().
Describe your proposed implementation
Add New Segment annotations to list of ignored annotations in annotate_break().
Describe possible alternatives
–
Additional context
–
Hi, I'd like to work on this enhancement!
My understanding of the issue:
The annotate_break() function currently ignores annotations starting with "bad" and "edge" by default (line 446 in mne/preprocessing/artifact_detection.py). However, BrainVision data includes "New Segment" annotations that mark recording run starts - these are system-generated and not experimental events, so they should also be ignored when calculating break durations.
Proposed fix:
Add "new segment" to the default ignore tuple:
# Before
ignore=("bad", "edge"),
# After
ignore=("bad", "edge", "new segment"),
Since the comparison is case-insensitive (line 554), using lowercase "new segment" will match "New Segment" annotations.
I will also:
- Add a test to verify the new behavior
- Update the docstring if needed
Could you please assign this issue to me? Thank you!