Skip to content

refactor / dedup channel names getting reconciled #1608

@drammock

Description

@drammock

the process of reading the channels.tsv is getting hard for me to reason about.

Reconciliation between raw channel names and channels.tsv happens in multiple places: Deduplication is handled in _handle_channels_reading, mismatches between channels.tsv and raw.ch_names happens in _handle_channels_mismatch.. Except for the special-case mismatch of STI 014 being present in raw but not channels.tsv.. That is handled in _handle_channels_reading..

Also, now, _handle_channels_mismatch is True means "skip setting channels metadata on the raw object", which isn't very intuitive..

It might be worthwhile to centralize all this data munging in a helper function that is called very early in _handle_channels_reading. Then the rest of _handle_channels_reading can focus on applying channel types/units and 'bads' etc.

Perhaps the MNE sprint this summer will be a good time to do such a refactor.

Originally posted by @scott-huberty in #1603 (review)

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