Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRG: Correctly handle reading when BIDS channel order differs from Raw #1171

Merged
merged 3 commits into from
Sep 27, 2023

Conversation

hoechenberger
Copy link
Member

@hoechenberger hoechenberger commented Sep 26, 2023

Fixes #1170

@moritz-gerster does this fix your problem?

Merge checklist

Maintainer, please confirm the following before merging.
If applicable:

  • All comments are resolved
  • This is not your own PR
  • All CIs are happy
  • PR title starts with [MRG]
  • whats_new.rst is updated
  • New contributors have been added to CITATION.cff
  • PR description includes phrase "closes <#issue-number>"

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

Merging #1171 (3c9fbaf) into main (2de8536) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1171      +/-   ##
==========================================
- Coverage   97.63%   97.57%   -0.06%     
==========================================
  Files          40       40              
  Lines        8655     8662       +7     
==========================================
+ Hits         8450     8452       +2     
- Misses        205      210       +5     
Files Coverage Δ
mne_bids/read.py 95.87% <100.00%> (-0.02%) ⬇️
mne_bids/tests/test_read.py 99.71% <100.00%> (+<0.01%) ⬆️

... and 3 files with indirect coverage changes

@moritz-gerster
Copy link
Contributor

@moritz-gerster does this fix your problem?

Yes, that works! :)

@hoechenberger hoechenberger changed the title Correctly handle reading when BIDS channel order differs from Raw MRG: Correctly handle reading when BIDS channel order differs from Raw Sep 26, 2023
@hoechenberger hoechenberger marked this pull request as ready for review September 26, 2023 13:47
Copy link
Member

@sappelhoff sappelhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor, but we need to be aware that unfortunately, the channel order in channels.tsv only SHOULD (not MUST) correspond to the ordering in the raw file. Don't ask me why, I don't like it either.

So the change we are doing here may lead to breakage, but I think that's fine, as IMHO the channels.tsv file channel order really should should should correspond to that in the raw file.

@hoechenberger
Copy link
Member Author

I believe a common use case is that you realize two EEG electrodes were accidentally swapped, hence you change their order in channels.tsv. With this PR branch, you don't have to worry about fixing the raw file too

@hoechenberger hoechenberger merged commit 51d0da3 into mne-tools:main Sep 27, 2023
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read_raw_bids() messes up the channel order and therefore loading raw fails
3 participants