Skip to content

Commit 4915ff0

Browse files
committed
Rmoved redundancy
1 parent 68f7039 commit 4915ff0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

mne/channels/tests/test_interpolation.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -421,24 +421,24 @@ def test_nan_interpolation(raw):
421421
assert raw.info["bads"] == ch_to_interp
422422

423423
store = raw.info["chs"][1]["loc"]
424-
# for on_bad_position="warn"
425-
with pytest.warns(RuntimeWarning):
426-
raw.info["bads"] = ch_to_interp
427-
# delibrately set loc elements to np.nan
428-
raw.info["chs"][1]["loc"] = np.full(12, np.nan)
429-
raw.interpolate_bads(on_bad_position="warn")
430-
assert np.isnan(raw.info["chs"][1]["loc"]).any()
431-
432424
# for on_bad_position="raise"
433-
with pytest.raises(ValueError):
425+
with pytest.raises(ValueError, match="have invalid sensor position"):
434426
raw.info["bads"] = ch_to_interp
435427
raw.info["chs"][1]["loc"] = np.full(12, np.nan)
428+
# DOES NOT interpolates at all. So raw.info["bads"] remains as is
436429
raw.interpolate_bads(on_bad_position="raise")
437430
assert np.isnan(raw.info["chs"][1]["loc"]).any()
438431

432+
# for on_bad_position="warn"
433+
with pytest.warns(RuntimeWarning, match="have invalid sensor position"):
434+
# this DOES the interpolation BUT with a warning
435+
# so raw.info["bad"] will be empty again,
436+
# and interpolated channel with be all np.nan
437+
raw.interpolate_bads(on_bad_position="warn")
438+
assert np.isnan(raw.info["chs"][1]["loc"]).any()
439+
439440
# for on_bad_position="ignore"
440441
raw.info["bads"] = ch_to_interp
441-
raw.info["chs"][1]["loc"] = np.full(12, np.nan)
442442
raw.interpolate_bads(on_bad_position="ignore")
443443
assert np.isnan(raw.info["chs"][1]["loc"]).any()
444444

0 commit comments

Comments
 (0)