question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC: get_channel_types polysemy

See original GitHub issue

I’ve stumbled on a not-so-nice aspect of the API when working on #7486:

  1. 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).
  2. 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.
  3. <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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
drammockcommented, Mar 21, 2020

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.

0reactions
agramfortcommented, Mar 21, 2020

this is now what the PR from Dan does. Except using a short function name

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found