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)
the process of reading the
channels.tsvis getting hard for me to reason about.Reconciliation between raw channel names and
channels.tsvhappens in multiple places: Deduplication is handled in_handle_channels_reading, mismatches betweenchannels.tsvandraw.ch_nameshappens in_handle_channels_mismatch.. Except for the special-case mismatch ofSTI 014being present inrawbut notchannels.tsv.. That is handled in_handle_channels_reading..Also, now,
_handle_channels_mismatch is Truemeans "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_readingcan 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)