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

annotate_break() should ignore `New Segment` annotations by default

Open hoechenberger opened this issue 2 years ago • 1 comments

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

hoechenberger avatar Oct 28 '23 14:10 hoechenberger

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!

natinew77-creator avatar Dec 08 '25 14:12 natinew77-creator