Skip to content

IndexError: too many indices for array #223

@jayfmil

Description

@jayfmil

When attempting to load eeg, we sometimes run into IndexError: too many indices for array. I believe this happens if any of the epochs being loaded fall outside the bounds of the eeg file.

For example:

reader = CMLReader("R1310J", "FR1", 1)
pairs = reader.load("pairs")
events = reader.load("events")
words = events[events["type"] == "WORD"]
eeg = reader.load_eeg(events=words, rel_start=0, rel_stop=1000, scheme=pairs)

If you instead don't exclude some of the last events, it works:

eeg = reader.load_eeg(events=words.iloc[:-26], rel_start=0, rel_stop=1000, scheme=pairs)

This can happen if, for whatever reason, the recording stopped early or if it was a session with multiple eeg files and an event occurs close to the end of the recording.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions