You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've stumbled on a not-so-nice aspect of the API when working on #7486:
mne.io.pick.get_channel_types (source) takes no input, gets all known channel types as dict keys (values are FIFF constants for kind and coil_type).
mne.io.pick._get_channel_types (source) takes an Info, picks, boolean unique, and boolean whether to restrict to data channels only. Returns a list or set depending on unique.
<Raw/Epochs/Evoked>.get_channel_types (source) method (via the ContainsMixin). Returns list of channel types.
Number 1 is called once in a test, and nowhere else in the codebase. I'd like to propose renaming it from get_channel_types to get_all_channel_types, show_all_channel_types, or get_channel_types_dict. I prefer the first option. This is a public function so it would be an API change w/ deprecation cycle. If acceptable, I could roll it into #7486 or do it in a separate PR.
Number 1 is called once in a test, and nowhere else in the codebase. I'd like to propose renaming it from get_channel_types to get_all_channel_types, show_all_channel_types, or get_channel_types_dict. I prefer the first option.
That was for @cbrnr in #4842 so perhaps he should comment. But I agree that inst.get_channel_types is probably more widely used and that the overlap is problematic, so +1 for renaming mne.io.pick.get_channel_types to get_all_channel_type_constants or something similar (a variant of names you suggested that makes it clearer it's giving a mapping between ch types and their constants, in this case via a dict)
I'm fine with renaming the function, but I'd prefer a slightly shorter name if possible. Also, I haven't checked the return values of mne.io.pick.get_channel_types and mne.io.pick._get_channel_types, but can/should we de-duplicate code by calling the private function inside the public one?
Also, I haven't checked the return values of mne.io.pick.get_channel_types and mne.io.pick._get_channel_types, but can/should we de-duplicate code by calling the private function inside the public one?
Not possible, they do completely different things, which is why I proposed to rename one of them.
What I have done is deduplicate the instance methods and the private function, which were doing (roughly) the same thing.
Activity
larsoner commentedon Mar 21, 2020
That was for @cbrnr in #4842 so perhaps he should comment. But I agree that
inst.get_channel_typesis probably more widely used and that the overlap is problematic, so +1 for renamingmne.io.pick.get_channel_typestoget_all_channel_type_constantsor something similar (a variant of names you suggested that makes it clearer it's giving a mapping between ch types and their constants, in this case via a dict)agramfort commentedon Mar 21, 2020
cbrnr commentedon Mar 21, 2020
I'm fine with renaming the function, but I'd prefer a slightly shorter name if possible. Also, I haven't checked the return values of
mne.io.pick.get_channel_typesandmne.io.pick._get_channel_types, but can/should we de-duplicate code by calling the private function inside the public one?agramfort commentedon Mar 21, 2020
drammock commentedon Mar 21, 2020
Not possible, they do completely different things, which is why I proposed to rename one of them.
What I have done is deduplicate the instance methods and the private function, which were doing (roughly) the same thing.
closes mne-tools#7487 (rename get_channel_types -> get_channel_type_c…