Skip to content

[GUI] Import recordings with the optional MNE readers - #842

Merged
arnodelorme merged 3 commits into
developfrom
agent/issue-813
Nov 29, 2026
Merged

arnodelorme merged 3 commits into
developfrom
agent/issue-813

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

The MNE-IO menu now opens pop_mneio, which reads a file or recording folder through MNE. Both the import menu and the extension manager can install the optional readers into the running EEGPrep environment. The imported dataset and command appear in the GUI and console.

Linux import menu and dialog

Relative differences on three recordings read from identical files

Maximum signal differences relative to MATLAB on common channels were 2.13 × 10⁻¹⁶ for SET, 3.38 × 10⁻⁸ for EDF and 3.73 × 10⁻⁸ for BDF. All 154 SET event types matched. The largest SET latency difference was 0.0000633 sample. MNE preserved BDF’s Status channel and supplied zero annotations. MATLAB BioSig decoded 41 events.

Editable Word report · PDF report

Cause and change

The MNE-labelled menu called pop_biosig. The new importer uses mne.io.read_raw, converts voltage channels to microvolts, preserves stimulus codes, and reports annotation times from the actual first sample. The install dialog and manager use the same installer as #812.

Verification

278 reader, extension, console and menu tests passed, with 7 reference cases deselected. A second run of the Qt dialogs and affected readers passed 189 tests, with 4 reference cases deselected. Pre-commit, Ruff and ty passed. A fresh Linux environment installed MNE 1.13.2 from the GUI and opened a 32-channel recording with 30,504 samples and 154 events. The reference pins are EEGLAB d0963be9d81acc5b66e84f8d3d7c89e3ce127cc4 and eeglab_tests fec88f9ffe7c225eb1de8924db8b6a3e0d53a4d9. Full MATLAB reference workflow. The reference workflow uses db5cff9. The only subsequent change at GitHub’s recorded merge commit 5b94122 is a comment explaining MNE event indexing. The installer follow-up also handles environments with MNE present and some format packages missing. Five of the seven reference groups passed. The STUDY group had 340 passed, 27 skipped, 3 deselected and one failure in 17 min 15 s. The assertion on empty structures is already tracked on develop by #685 and #691. The core group is still running. The standalone installation job independently reproduced the MNE Help-marker mismatch. #857 and #850 both include its tested correction.

Decision for Arno

This reader preserves MNE’s annotations and its native Status channel. Choose BioSig for decoded BioSemi event codes. Conversion of electrode coordinates from an MNE montage is tracked in #840. The coordinate work has a separate proposed change.

GitHub marked this PR merged at 18:56 Pacific when the orchestrator’s repo-push job advanced develop. The complete feature diff remains visible here. The optional BioSig reader is tracked in #812 and native format menus in #850.

Fixes #813
Part of #735
Also addresses #838 with the same conversion as #841.
Fixes #839

@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 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @arnodelorme's task in 1m 54s —— View job


Code review

  • Pre-review gate and head check (head db5cff9 matches)

  • Gather context (diff, AGENTS.md)

  • Review passes (compliance, conventions, correctness, EEGLAB parity)

  • Validate and post findings

  • Overall assessment: The pop_mneio importer, menu rewiring and the mne_raw_to_eeg changes look right. Two problems in the reader-installer half need fixing first.

  • Highest-risk area: the extension manager's new Install reader path (plugin_menu.py).

  • Merge recommendation: Needs changes.

Blocking

None.

Important

  1. The BioSig "Install reader" entry installs a package nothing uses (src/eegprep/functions/adminfunc/plugin_menu.py:42).
    • No code on this branch imports biosig. pop_biosig and pop_fileio(dataformat="biosig") both read through MNE (pop_fileio.py:184-190).
    • After a user installs it, the row reads "Installed", but every import behaves exactly as before.
    • Fix: drop the "biosig" entry and its help/doc paragraphs until a reader imports it, or merge this after pop_biosig: read with the biosig Python library, installed from the extension manager #812 if that PR adds the consumer.
  2. The manager still says it never installs anything (plugin_menu.md:37-42, EXTERNAL_PLUGIN_NOTICE at plugin_menu.py:36-39, docstring at L271).
    • These statements now contradict the new Install reader button, and they are about security.
    • The new help paragraph mentions only BioSig, not MNE-IO.
    • Fix: limit the "never installs" wording to third-party extensions, and describe Install reader as running pip in the current interpreter for EEGPrep's built-in optional readers.

Nits

  • src/eegprep/extras.py:113: "mne-io" if feature == "pop_mneio" else … puts a feature-name special case inside the generic message helper. Look the extra up by feature instead (e.g. let import_optional_dependency accept the extra, or read it from PUBLIC_EXTRAS), so the next feature that needs a wider extra doesn't add another branch.

Test gaps

None. The new tests cover mixed channel units, a non-zero first_samp annotation offset, the replayable history command, menu import into the shared session, and cancel.

EEGLAB parity notes

  • mne_raw_to_eeg is shared with pop_biosig, pop_fileio and MFF import. Chanlocs type now comes from MNE (e.g. BDF Status becomes STIM, misc becomes MISC) instead of always EEG. That seems an improvement, but it changes behavior for the existing importers too. Mention it in the PR notes.
  • eegprep[all] now pulls in neo, pymef, antio, curryreader and mffpy through mne-io. pymef ships no linux-aarch64 wheel in uv.lock, so pip install eegprep[all] will build it from source on that platform.

Also checked: the annotation latency change (onset - first_time) keeps EDF/BDF results unchanged (first_time = 0), voltage scaling only applies to bioelectric channel types, and GUI cancel returns ({}, "") without changing the session.

)

OPTIONAL_READERS = {
"biosig": ("BioSig", ("biosig>=4.0.2",)),

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.

Important. Nothing on this branch imports the biosig package that this entry installs. pop_biosig and pop_fileio(dataformat="biosig") both read through MNE (

return _read_neuroscan_epochs(path, **options), channels
if dataformat == "biosig":
reader = _reader_for_suffix(
path.suffix.lower() if path.suffix.lower() in {".edf", ".bdf", ".gdf"} else ".edf", feature
)
raw = reader(str(path), preload=True, verbose=False)
return mne_raw_to_eeg(raw, setname=path.stem, filename=str(path)), channels
). So when a user picks BioSig → Install reader, pip runs, the row changes to "Installed", and imports behave exactly as before. The PR body's advice to "Choose BioSig for decoded BioSemi event codes" also points to the MNE-backed pop_biosig menu item, not to this package.

Fix: remove the "biosig" entry here (and the BioSig paragraph in plugin_menu.md and extensions.rst) until a reader actually imports biosig, or merge this after #812 if that PR adds the consumer.

Comment on lines +39 to +42

Select BioSig and choose Install reader to install the optional file reader in
the current Python environment. A missing native libbiosig library must be
installed using your operating system’s package manager.

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.

Important. The new paragraph contradicts the sentence right above it ("EEGPrep … never downloads, … installs … from this manager"). It also contradicts EXTERNAL_PLUGIN_NOTICE (

EXTERNAL_PLUGIN_NOTICE = (
"EEGPrep discovers installed Python extension packages through entry points and shows curated catalog metadata. "
"This manager never downloads, unzips, installs, updates, or removes extension code."
)
), which format_plugin_menu still prints, and the docstring at L271 ("never execute them"). This is a statement about trust and security, so users need it to be accurate. The paragraph also names only BioSig, but the manager now lists MNE-IO too.

Fix: narrow the existing statements to third-party extensions, e.g. "never installs third-party extension code; Install reader runs pip in the current interpreter only for EEGPrep's built-in optional readers (MNE-IO)". Then update EXTERNAL_PLUGIN_NOTICE to match.

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

Labels

None yet

Projects

None yet

1 participant