Skip to content

[IO] Remove the EEG prefix of EDF channel labels - #750

Closed
arnodelorme wants to merge 1 commit into
developfrom
agent/issue-746
Closed

arnodelorme wants to merge 1 commit into
developfrom
agent/issue-746

Conversation

@arnodelorme

Copy link
Copy Markdown
Collaborator

pop_fileio and pop_biosig now run eeg_checkchanlocs after an MNE read, so EDF labels lose the EEG prefix (EEG Fp1 becomes Fp1) as in every EEGLAB import. On test.edf the 15 common labels now equal EEGLAB's and the data are unchanged (largest difference 1.3e-6 microvolt). Two lines of code and one test.

Fixes #746
Part of #735

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

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

Claude finished @arnodelorme's task in 42s —— View job


Code review

  • Overall assessment: The PR looks good. It's a small, targeted change that matches what the description claims.
  • Highest-risk area: Label cleanup now also runs on every other import that goes through MNE (.bdf, .gdf, .mff, .cnt), not just EDF. That matches EEGLAB, which normalizes channel locations on every import.
  • Merge recommendation: Safe to merge, once the MATLAB reference question below is settled.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None. test_edf_labels_lose_the_eeg_prefix_as_in_eeglab writes a real EDF with pyedflib, which is already a non-emscripten runtime dependency and is used elsewhere in the tests. It checks both pop_biosig and pop_fileio, so it would catch the regression this PR fixes.

EEGLAB parity notes

  • Matches EEGLAB: eeg_checkchanlocs._clean_labels removes the EEG-, EEG and EEG prefixes. It does this only when fewer than 30 labels are numeric once EEG is removed, which is the same guard EEGLAB's eeg_checkchanlocs.m uses. Running it once after mne_raw_to_eeg gives the import the label normalization EEGLAB applies through eeg_checkset.
  • No risk of chanlocs and data falling out of step: eeg_checkchanlocs moves channels typed fid/ignore into chaninfo.nodatchans, which would leave fewer chanlocs than data rows. That can't happen here, because mne_raw_to_eeg sets "type": "EEG" on every channel (_file_io.py:272).
  • Selection still works on the new labels: _select_imported_data runs after the call, so selecting channels by label now uses the cleaned names (Fp1, not EEG Fp1), as EEGLAB does.
  • Reference-suite run: under AGENTS.md, a PR that changes an EEGLAB-ported function needs one MATLAB reference-suite run (or a .github/workflows/eeglab-reference.yml dispatch) recorded in the PR body. This change only affects labels, and the description already compares against EEGLAB on test.edf. If maintainers count pop_fileio as a core function, though, that run (or a note that it isn't needed) belongs in the PR body before merge.

I read the code and EEGLAB's behavior by hand but couldn't run any tests: the command needed approval this job doesn't have. The test run, lint and pre-commit results come from CI.

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

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

Superseded by #749, which strips the EEG prefix once in mne_raw_to_eeg.

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