Skip to content

[IO] Strip EEG channel label prefix on EDF/BDF/GDF import - #749

Merged
arnodelorme merged 2 commits into
developfrom
agent/20261127-fix-746
Nov 27, 2026
Merged

arnodelorme merged 2 commits into
developfrom
agent/20261127-fix-746

Conversation

@claude

@claude claude Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Run eeg_checkchanlocs on the channel list in mne_raw_to_eeg, as every EEGLAB import does, so EDF labels such as EEG Fp1 import as Fp1 through pop_fileio and pop_biosig and channel location lookup succeeds. Adds a regression test on a generated EDF file and a user guide note.

Fixes #746

🤖 Generated with Claude Code

EDF/BDF/GDF/MFF reads now run eeg_checkchanlocs on the channel list, as
EEGLAB imports do, so labels like 'EEG Fp1' become 'Fp1'.

Fixes #746

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @claude[bot]'s task in 50s —— View job


Code review

  • Checked the PR state, head SHA (3529813) and earlier review markers

  • Read AGENTS.md (Testing and Comments sections) and the diff

  • Traced the callers of mne_raw_to_eeg (pop_fileio, the pop_fileio biosig path, pop_mffimport, and pop_biosig through pop_fileio)

  • Compared with the eeg_checkchanlocs port (_clean_labels)

  • Posted the review

  • Overall assessment: Looks good. The fix is small and sits where it should. mne_raw_to_eeg now runs every MNE-backed import's channel list through the existing eeg_checkchanlocs port. That port removes EEG-, EEG and EEG from labels unless 30 or more labels are numbered, which matches EEGLAB.

  • Highest-risk area: other code that looks channels up by label after import. I checked it, and nothing is affected.

  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None. test_edf_import_removes_eeg_label_prefix_like_eeglab writes a real EDF with EEG Fp1, EEG-Fp2 and EEG Cz labels and checks both pop_fileio and pop_biosig. It would have caught #746. pyedflib is already a runtime dependency on non-Pyodide platforms, so the new top-level import is fine.

EEGLAB parity notes

None. What I checked:

  • BioSemi Status channel: pop_biosig still finds it, because the Status label has no EEG prefix and stays the same (pop_biosig.py:217).
  • Channel and reference selection: channels and ref are 1-based indices, not labels, so renaming labels does not change which channels they select.
  • MFF imports: they now go through the same code, but their E1-style names contain no EEG, so they are unchanged.
  • The 30-numbered-label rule: the note added to the docs matches the < 30 threshold in _clean_labels.
  • The MATLAB file: the vendored EEGLAB checkout is not in this CI checkout, so I could not open eeg_checkchanlocs.m to confirm the line number cited in the new comment.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, tests for the changed behavior, and AGENTS.md compliance.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@arnodelorme

Copy link
Copy Markdown
Collaborator

This pull request and #750 fix the same issue (#746). I kept this one because it cleans the labels once in mne_raw_to_eeg, so every MNE-read import gets it, as every EEGLAB import does through eeg_checkset, and it passes only the channel list to eeg_checkchanlocs, where #750 passes the whole dataset and so copies the data once more. Its test also covers the "EEG-" form. I added the missing changelog entry (commit 42ca435). The import tests pass locally (213 passed; the one failure, an MFF test, comes from defusedxml missing in my local environment and fails the same way on other branches). The EEGLAB reference run that AGENTS.md asks for is started: https://github.com/sccn/eegprep/actions/runs/45951378985. #750 can be closed once this one is merged.

— orchestrator

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.

pop_biosig and pop_fileio: EDF channel labels keep the prefix EEG (EEGLAB removes it)

1 participant