Skip to content

Commit 358545b

Browse files
committed
remove warn with specified on_ch_mismatch
1 parent 23a6911 commit 358545b

File tree

2 files changed

+7
-38
lines changed

2 files changed

+7
-38
lines changed

mne_bids/read.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ def _handle_channel_mismatch(raw, on_ch_mismatch, ch_names_tsv, channels_fname):
774774
f"Either align channel names in channels.tsv with the raw file, or call "
775775
f"read_raw_bids(on_ch_mismatch='reorder'|'rename') to proceed."
776776
)
777-
warn(
777+
logger.info(
778778
"Channel mismatch between "
779779
f"{channels_fname} and the raw data file detected. "
780780
f"Using mismatch strategy: {on_ch_mismatch}."

mne_bids/tests/test_read.py

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,16 +1464,7 @@ def test_channels_tsv_raw_mismatch(tmp_path):
14641464
raw.reorder_channels(ch_names_new)
14651465
raw.save(raw_path, overwrite=True)
14661466

1467-
with (
1468-
pytest.warns(
1469-
RuntimeWarning,
1470-
match=(
1471-
r"Channel mismatch between .*channels\.tsv and the raw data file "
1472-
r"detected\. Using mismatch strategy: reorder\."
1473-
),
1474-
),
1475-
):
1476-
raw = read_raw_bids(bids_path, on_ch_mismatch="reorder")
1467+
raw = read_raw_bids(bids_path, on_ch_mismatch="reorder")
14771468
assert raw.ch_names == ch_names_orig
14781469

14791470

@@ -1566,9 +1557,7 @@ def test_channel_mismatch_raise(tmp_path):
15661557
raw, _, _, channels_fname, _, _ = _setup_nirs_channel_mismatch(tmp_path)
15671558
with pytest.raises(
15681559
RuntimeError,
1569-
match=(
1570-
r"Channel mismatch between .*channels\.tsv and the raw data file detected\."
1571-
),
1560+
match=("Channel mismatch between .*channels"),
15721561
):
15731562
_handle_channels_reading(channels_fname, raw.copy(), on_ch_mismatch="raise")
15741563

@@ -1578,18 +1567,7 @@ def test_channel_mismatch_reorder(tmp_path):
15781567
raw, _, ch_order_bids, channels_fname, orig_name_to_loc, orig_name_to_data = (
15791568
_setup_nirs_channel_mismatch(tmp_path)
15801569
)
1581-
with (
1582-
pytest.warns(
1583-
RuntimeWarning,
1584-
match=(
1585-
r"Channel mismatch between .*channels\.tsv and the raw data file "
1586-
r"detected\. Using mismatch strategy: reorder\."
1587-
),
1588-
),
1589-
):
1590-
raw_out = _handle_channels_reading(
1591-
channels_fname, raw, on_ch_mismatch="reorder"
1592-
)
1570+
raw_out = _handle_channels_reading(channels_fname, raw, on_ch_mismatch="reorder")
15931571
assert raw_out.ch_names == ch_order_bids
15941572
for i, new_name in enumerate(raw_out.ch_names):
15951573
np.testing.assert_allclose(
@@ -1610,18 +1588,9 @@ def test_channel_mismatch_rename(tmp_path):
16101588
orig_name_to_loc,
16111589
orig_name_to_data,
16121590
) = _setup_nirs_channel_mismatch(tmp_path)
1613-
with (
1614-
pytest.warns(
1615-
RuntimeWarning,
1616-
match=(
1617-
r"Channel mismatch between .*channels\.tsv and the raw data file "
1618-
r"detected\. Using mismatch strategy: rename\."
1619-
),
1620-
),
1621-
):
1622-
raw_out_rename = _handle_channels_reading(
1623-
channels_fname, raw.copy(), on_ch_mismatch="rename"
1624-
)
1591+
raw_out_rename = _handle_channels_reading(
1592+
channels_fname, raw.copy(), on_ch_mismatch="rename"
1593+
)
16251594
assert raw_out_rename.ch_names == ch_order_bids
16261595
for i in range(len(ch_order_bids)):
16271596
orig_name_at_i = ch_order_snirf[i]

0 commit comments

Comments
 (0)