Repository navigation
Improve find_ch_adjacency and read_ch_adjacency - #12293
Open
mscheltienne wants to merge 7 commits into
Open
mscheltienne wants to merge 7 commits into
mscheltienne wants to merge 7 commits into
Conversation
mscheltienne
requested review from
agramfort,
dengemann,
drammock,
jasmainak and
larsoner
as code owners
December 13, 2023 12:32
mscheltienne
commented
Dec 13, 2023
Comment on lines
+502
to
+518
| # TODO: This test is strange, raw and bti148 adjacency matrix do not have the same | ||
| # channel names. Previously, it was loading the bti148 adjacency matrix without the | ||
| # 'mag' channel selection confirming the existence of the channel names in the raw | ||
| # object, and asserting: | ||
| # assert 'A1' in ch_names # returned by find_ch_adjacency | ||
| # while in practice, 'A1' is not in raw.ch_names | ||
| bti_fname = testing_path / "BTi" / "erm_HFH" / "c,rfDC" | ||
| bti_config_name = testing_path / "BTi" / "erm_HFH" / "config" | ||
| raw = read_raw_bti(bti_fname, bti_config_name, None) | ||
| _, ch_names = find_ch_adjacency(raw.info, "mag") | ||
| assert "A1" in ch_names | ||
| with pytest.raises(ValueError, match="could not be interpreted as channel names"): | ||
| find_ch_adjacency(raw.info, "mag") | ||
|
|
||
| # TODO: same as above, with 'assert "MLC11" in ch_names'. | ||
| ctf_fname = testing_path / "CTF" / "testdata_ctf_short.ds" | ||
| raw = read_raw_ctf(ctf_fname) | ||
| _, ch_names = find_ch_adjacency(raw.info, "mag") | ||
| assert "MLC11" in ch_names | ||
| with pytest.raises(ValueError, match="could not be interpreted as channel names"): | ||
| _, ch_names = find_ch_adjacency(raw.info, "mag") |
Member
Author
There was a problem hiding this comment.
Channel names in raw and adjacency matrix do not match. What should be the correct and tested behavior here?
Member
There was a problem hiding this comment.
Can you try it with read_raw_bti(..., rename_channels=False)? If so I think we might need to detect somehow the BTi-ness of the data (probably by MEG coil type) and internally be willing to tolerate the renaming to MEGXXX-style naming when rename_channels=True.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12292
This PR:
ch_typeinfind_ch_adjacencyin favor ofpicksinforead_ch_adjacency: thepicksargument can not be a list of indices and can not interact with an non-existinginfo["bads"]list.IMO, the test
test_find_ch_adjacencyhas something wrong with thebtiandctfsegments. It loads adjacency matrix with different channel names than theraw recording. Changes to pass the test highlighted below, any input would be welcome as I am unfamiliar with those 2 MEG systems.