Skip to content

clean up test_interpolate_bridged_electrodes() in test_interpolate() - #14456

Open
CarinaFo wants to merge 2 commits into
mne-tools:mainfrom
CarinaFo:clean_up_test_interpolate_bridged_electrodes
Open

CarinaFo wants to merge 2 commits into
mne-tools:mainfrom
CarinaFo:clean_up_test_interpolate_bridged_electrodes

Conversation

@CarinaFo

Copy link
Copy Markdown
Contributor

While cleaning up this test, I noticed that bad data from a bridged channel leaks into its own repair via the virtual channel.

The merged PR #14287 excluded non-bridged bads from the interpolation, but the virtual channel is still built from all channels in the group, including ones marked bad (ll. 161ff in interpolate.py), which makes the current test fail:

  # a bridged bad must be repaired, with no trace of its 1 V bad data
  raw.apply_function(lambda x: np.full_like(x, 1.0), picks="EEG 001")
  out = interpolate_bridged_electrodes(raw.copy(), pairs)
  assert np.abs(out.get_data(picks="EEG 001")).max() < 1e-3
  assert out.info["bads"] == ["EEG 001", "EEG 003"]

FAILED mne/preprocessing/tests/test_interpolate.py::test_interpolate_bridged_electrodes_bads - AssertionError: assert np.float64(0.32628997413460664) < 0.001

TBD:

  • Should a bad channel be excluded from the virtual channel?

@larsoner

Copy link
Copy Markdown
Member

I am not 100% sure I understand the consequences, but I think bad channels should probably be excluded in virtual channels

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants