Skip to content

fix(preprocessing): flatten list-valued event_id in RawToEvents - #1367

Open
kalomak wants to merge 1 commit into
NeuroTechX:developfrom
kalomak:fix-raw-to-events-list-event-id
Open

kalomak wants to merge 1 commit into
NeuroTechX:developfrom
kalomak:fix-raw-to-events-list-event-id

Conversation

@kalomak

@kalomak kalomak commented Nov 19, 2026 •

Copy link
Copy Markdown

Bug

RawToEvents fails when an event_id value is a list of codes, e.g. {"left": [1, 3]}. It passes the nested list to mne.pick_events, which raises ValueError: operands could not be broadcast together.

from moabb.datasets.preprocessing import RawToEvents

# raw: mne.io.Raw with a stim channel holding codes 1, 2, 3, 4
RawToEvents(event_id={"left": [1, 3], "right": [2, 4]}, interval=(0, 1)).transform(raw)
# ValueError: operands could not be broadcast together

SetRawAnnotations, RawToEventsP300, RawToEpochs and EventsToLabels already accept list codes and flatten them, and Kojima2024B uses them. So I assumed RawToEvents should too.

Fix

  • Flatten the codes with the existing _get_event_id_values.

@kalomak
kalomak force-pushed the fix-raw-to-events-list-event-id branch from 8957e4e to df71282 Compare November 19, 2026 09:45
@kalomak
kalomak marked this pull request as draft November 19, 2026 09:50
@kalomak
kalomak marked this pull request as ready for review November 19, 2026 09:56

This branch has not been deployed

No deployments
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.

1 participant