Skip to content

Reorder channels stopped working when preceded with add_reference_channels #8300

@mmagnuski

Description

@mmagnuski

I have a file reader for some of my files, which worked well some time ago but fails on master when trying to reorder channels:

  File "C:\src\DiamSar\__init__.py", line 140, in read_raw
    raw.reorder_channels(chan_ord)

  File "c:\src\mne-python\mne\channels\channels.py", line 874, in reorder_channels
    return self._pick_drop_channels(idx)

  File "c:\src\mne-python\mne\channels\channels.py", line 938, in _pick_drop_channels
    self._read_picks = [r[idx] for r in self._read_picks]

  File "c:\src\mne-python\mne\channels\channels.py", line 938, in <listcomp>
    self._read_picks = [r[idx] for r in self._read_picks]

IndexError: index 63 is out of bounds for axis 0 with size 63

it seems that the problem arises because in my reader first a reference channel is added (mne.add_reference_channels(raw, 'Cz', copy=False)) and then raw.reorder_channels() is called. I can change the order of operations in my code, but thought I should let you know. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions