Skip to content

Commit

Permalink
Update mne/utils/mixin.py
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Larson <[email protected]>
  • Loading branch information
withmywoessner and larsoner authored Jan 10, 2024
1 parent 5a7a618 commit 98b92c4
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions mne/utils/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,14 @@ def _getitem(
key_selection = inst.selection[select]
drop_log = list(inst.drop_log)
if reason is not None:
# Used for multiple reasons
if isinstance(reason, tuple):
reason = list(reason)

if isinstance(reason, list):
for i, idx in enumerate(
np.setdiff1d(inst.selection, key_selection)
):
r = reason[i]
if isinstance(r, str):
r = (r,)
if isinstance(r, list):
r = tuple(r)
drop_log[idx] = r
else:
for idx in np.setdiff1d(inst.selection, key_selection):
drop_log[idx] = (reason,)
_validate_type(reason, (list, tuple, str), "reason")
if isinstance(reason, str):
reason = (reason,)
reason = tuple(reason)
for i, idx in enumerate(
np.setdiff1d(inst.selection, key_selection)
):
drop_log[idx] = reason
inst.drop_log = tuple(drop_log)
inst.selection = key_selection
del drop_log
Expand Down

0 comments on commit 98b92c4

Please sign in to comment.