Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 24, 2024
1 parent b918ea8 commit ab009bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 8 additions & 3 deletions mne/tests/test_epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def my_reject_2(epoch_data):
for kwarg in ("reject", "flat"):
with pytest.raises(
TypeError,
match=r".* must be an instance of numeric, got <class 'function'> instead."
match=r".* must be an instance of numeric, got <class 'function'> instead.",
):
Epochs(
raw,
Expand Down Expand Up @@ -2227,7 +2227,9 @@ def test_callable_reject():
baseline=None,
preload=True,
)
epochs.drop_bad(reject=dict(eeg=lambda x: ((np.median(x, axis=1) > 1e-3).any(), "eeg median")))
epochs.drop_bad(
reject=dict(eeg=lambda x: ((np.median(x, axis=1) > 1e-3).any(), "eeg median"))
)

assert epochs.drop_log[2] == ("eeg median",)

Expand All @@ -2239,7 +2241,9 @@ def test_callable_reject():
baseline=None,
preload=True,
)
epochs.drop_bad(reject=dict(eeg=lambda x: ((np.max(x, axis=1) > 1).any(), ("eeg max",))))
epochs.drop_bad(
reject=dict(eeg=lambda x: ((np.max(x, axis=1) > 1).any(), ("eeg max",)))
)

assert epochs.drop_log[0] == ("eeg max",)

Expand Down Expand Up @@ -3354,6 +3358,7 @@ def test_drop_epochs():
("a", "b"),
]


@pytest.mark.parametrize("preload", (True, False))
def test_drop_epochs_mult(preload):
"""Test that subselecting epochs or making fewer epochs is similar."""
Expand Down
8 changes: 6 additions & 2 deletions tutorials/preprocessing/20_rejecting_bad_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@
preload=True,
)

epochs.drop_bad(reject=dict(eeg=lambda x: ((np.max(x, axis=1) > 1e-2).any(), "max amp")))
epochs.drop_bad(
reject=dict(eeg=lambda x: ((np.max(x, axis=1) > 1e-2).any(), "max amp"))
)
epochs.plot(scalings=dict(eeg=50e-5))

# %%
Expand All @@ -401,7 +403,9 @@
preload=True,
)

epochs.drop_bad(reject=dict(eeg=lambda x: ((np.median(x, axis=1) > 1e-4).any(), "median amp")))
epochs.drop_bad(
reject=dict(eeg=lambda x: ((np.median(x, axis=1) > 1e-4).any(), "median amp"))
)
epochs.plot(scalings=dict(eeg=50e-5))

# %%
Expand Down

0 comments on commit ab009bc

Please sign in to comment.