BUG: Evoked.get_data() should exclude bad channels when explicit picks are given#14013
BUG: Evoked.get_data() should exclude bad channels when explicit picks are given#14013evasafi wants to merge 7 commits into
Conversation
|
Hi Eva, thank you for your contribution. Let me discuss that with the other maintainers and get back to you. |
|
Thanks for the context, Carina. That forum thread and the broader consistency question make sense. Happy to keep this PR scoped to the |
Fixes #12577
Epochs.get_data(picks="eeg")excludes channels marked as bad by default,but
Evoked.get_data(picks="eeg")does not. Same method name, samelibrary, inconsistent behavior.
Root cause:
Evoked.get_data()always calls_picks_to_idx(self.info, picks, "all", exclude=()), unconditionallypassing
exclude=().Epochs._get_data()only does this whenpicksis
None; when explicit picks are given, it lets_picks_to_idxfallback to its default of
exclude="bads".This PR mirrors that branching logic in
Evoked.get_data():picks=None: unchanged, bads still included (preserves existing behavior)picks="eeg"): bads now excluded by default,matching
Epochs.get_data()Added a regression test in
test_evoked.py::test_get_datathat failson current
mainand passes with this fix. Also added a changelogentry and added myself to the contributor list.