Skip to content

FIX: Keep extras when combining Annotations#14028

Open
sametSeckiiin wants to merge 3 commits into
mne-tools:mainfrom
sametSeckiiin:fix-combine-annotations-extras
Open

FIX: Keep extras when combining Annotations#14028
sametSeckiiin wants to merge 3 commits into
mne-tools:mainfrom
sametSeckiiin:fix-combine-annotations-extras

Conversation

@sametSeckiiin

Copy link
Copy Markdown
Contributor

Fixes #14022 What does this implement/fix?

When combining annotations using _combine_annotations (e.g., during raw concatenations or appending), the extras list associated with the annotations was being dropped. While onset, duration, and description arrays were properly concatenated, the new Annotations object was constructed without passing the combined extras keyword argument.

This PR fixes the issue by:

  • Merging the extras lists from the input annotation objects (list(one.extras) + list(two.extras)).
  • Passing the merged extras list to the returned Annotations constructor so that metadata like response times or stimulus details are preserved after concatenation.

Additional information

Here is a minimal script to verify the fix:
`import mne
a1 = mne.Annotations([1], [1], ['stim'], extras=[{'res': 1}])
a2 = mne.Annotations([2], [2], ['stim'], extras=[{'res': 2}])
print((a1 + a2).extras)

Output is now correctly: [{'res': 1}, {'res': 2}] instead of [{}]

@welcome

welcome Bot commented Jul 6, 2026

Copy link
Copy Markdown

Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Concatenated raws lose combined annotations extras lists.

1 participant