Skip to content

pop_biosig: read with the biosig Python library, installed from the extension manager #812

Done

Description

@arnodelorme

This replaces Arno's earlier instruction on pop_biosig (and the pending rename of pop_biosig to pop_mneio, approval 73 of the orchestrator).

Captures

Linux (jamming) captures of EEGLAB and EEGPrep from the November 28 run are added below, directly visible, by the EEGPrep worker. Fix nothing here before Arno says so, unless this issue is the one test fix named in its summary.

Arno's words

Arno's feedback of November 28, 2026 on the File and Edit comparison report (EEGLAB_vs_EEGPrep_File_and_Edit.pdf, run file-edit-native-2026-11-28 in adelorme-assistant/project_eegprep/reports).

Pop_biosig in Python should use functions from the biosig Python library. Biosig need not be installed by default but It should be one of the options installed when one selects BioSig in the extension manager. Then we do pip install biosig and all the menus from BioSig become available. The behavior should be like in MATLAB. When you call the BioSig menu in the import and BioSig is not installed, it should pop up a window asking you to install BioSig.
Note that this, contrary to previous instructions I gave you, overwrites the instruction for pop_biosig.

Activity

  1. added
    gui-parity
    on Nov 28, 2026
  2. claude commented on Nov 28, 2026

    @claude
    Contributor

    🤖 Plan:

    Research

    pop_biosig currently reads EDF/BDF/GDF through pop_fileio → mne.io.read_raw_*, behind the mne extra. Its own code only adds BDF Status decoding (through openbdf/readbdf), rereferencing and history. The extension manager only shows copyable install commands and never runs pip (extension_catalog.py#L1-L5, plugin_menu.py#L831-L857). When an extra is missing, the code raises ImportError and nothing offers to install it (extras.py#L109-L167).

    Relevant code

    Proposed approach (for review)

    1. Reader: add a biosig extra (biosig on PyPI) and map pop_biosig to it in extras.py. pop_biosig reads with biosig.data()/biosig.header() (the Python binding of libbiosig, matching MATLAB sopen/sread) instead of going through pop_fileio/MNE. Keep the existing BDF Status decoding, reref and history code. The MNE path moves to pop_mneio (pop_mneio: new import function through MNE, an optional install like BioSig #813).
    2. Extension manager: add a bundled "BioSig" entry whose Install button runs sys.executable -m pip install biosig in a subprocess, after showing INSTALL_TRUST_WARNING. After a successful install, the BioSig menu items are enabled without a restart (importlib.invalidate_caches()).
    3. Missing-library prompt: in menu_actions.py, before calling pop_biosig, check importlib.util.find_spec("biosig"). If it is missing, show a Yes/No dialog like EEGLAB's plugin_askinstall, which runs the same install helper. The console keeps raising the ImportError with the install command.
    4. Labels/docs/help: drop "(MNE-IO)" from the BioSig menu labels and file filter (EEGLAB's labels), and update resources/help/pop_biosig.md, the extras doc page and the installation docs.
    5. Tests: read sample_data EDF/BDF with biosig, skipping when it is not installed, and compare against the existing MNE results. The prompt itself is tested at the GUI level.

    Open questions

    • Does Arno accept EEGPrep running pip install itself? That changes the current "copyable, never executed" policy in extension_catalog.py. Does it need a confirmation step, and what happens in uv/conda environments where pip is not the right installer?
    • The biosig PyPI package wraps the libbiosig C library. Do wheels exist for macOS/Windows on Python 3.12+? If not, Install fails on those platforms. Is a fallback to pop_mneio acceptable there?
    • Should Status-channel decoding use libbiosig's own event table (EVENT.TYP/POS), which matches MATLAB pop_biosig, or keep EEGPrep's openbdf/readbdf decoding?
    • Should Rename pop_fileio to pop_eegio and pop_biosig to pop_mneio, with no old names kept #765 be closed or edited now that pop_biosig keeps its name?
  3. arnodelorme commented on Nov 29, 2026

    @arnodelorme
    CollaboratorAuthor

    Earlier issue on the same function: #701 (pop_biosig window: same controls as EEGLAB without mexSLOAD and memory mapping; compare imported files), closed today as replaced by this one. Its request to compare the imported BDF and EDF files side by side still applies here.

    — orchestrator

  4. arnodelorme commented on Nov 29, 2026

    @arnodelorme
    CollaboratorAuthor

    🤖 The BioSig menu now reads EDF, BDF and GDF through Python BioSig. Choosing the menu without the library offers installation in the running environment. The same install action is available in the extension manager. BioSig and MNE each have their own menu.

    Pull request #857.

    EEGLAB and EEGPrep BioSig dialogs on Linux

    Twenty same-file BDF and EDF numerical comparisons with MATLAB

    Install BioSig prompt in a clean Linux environment

    Editable Word report · PDF report

    All 20 BDF and EDF cases matched the MATLAB event types, event latencies and sampling rates. Signal arrays matched exactly in 18. In the remaining two, MATLAB returned all 16 channels when asked for three. Python returned the requested three. Results by file and option · Fresh GUI installation and import.

    Verification

    The final Linux reader, BIDS, menu, dialog and console suite passed 535 tests and 139 GUI subtests. One case was skipped and 83 reference cases were deselected. All 61 targeted installer, importer and Help tests passed. The native library on Ubuntu 22.04 was libbiosig 2.3.3 and the Python package was BioSig 4.0.2. On a fresh environment the GUI installed the binding and opened the BDF file into the shared console workspace (16 channels, 15,360 samples and 41 triggers). With an existing partial MNE 1.13.2 installation, one prompt added all six missing format packages and opened 32 channels × 30,504 samples; a second selector opened without prompting. Pre-commit, Ruff and ty passed. Full MATLAB reference run. The reference pins are EEGLAB d0963be9d81acc5b66e84f8d3d7c89e3ce127cc4 and eeglab_tests fec88f9ffe7c225eb1de8924db8b6a3e0d53a4d9. All 30 Help and optional-extra checks passed on the final installation-guidance change. The numerical comparisons use e965781 and the final change only edits installation guidance. GitHub has accepted the full reference run on this exact branch tip. Its counts and runtime are pending.

    — EEGPrep worker (Codex)

  5. arnodelorme commented on Nov 29, 2026

    @arnodelorme
    CollaboratorAuthor

    Arno asked on November 29, 2026 to check the new BioSig Python release on Windows. Alois Schlögl uploaded biosig 4.0.3.post2, whose Windows wheels are now built against NumPy 2.

    • Windows 11 VM (x64 Python under emulation on ARM), fresh environments: biosig 4.0.3.post2 imports and reads a PhysioNet EDF (S001R01.edf, 64 channels, 9,760 samples at 160 Hz) on Python 3.11 with NumPy 2.4.6 and on Python 3.12 with NumPy 2.5.5. The sum and standard deviation of the data match MNE-Python on the Mac to 1e-14.
    • Control: biosig 4.0.1 on Python 3.12 with NumPy 2 fails at import ("A module that was compiled using NumPy 1.x cannot be run in NumPy 2").
    • Suggestion for pull request [GUI] Read BioSig files with the optional Python BioSig library #857: raise the extra from biosig>=4.0.2 to biosig>=4.0.3.post2, because 4.0.2 and 4.0.3 still ship NumPy 1 wheels for Python 3.11 and 3.12 on Windows.
    Details

    Reading the compiled modules of every Windows wheel on PyPI: in 4.0.1 the cp311 and cp312 modules reference only numpy.core._multiarray_umath (NumPy 1 ABI), while the cp39, cp310 and cp313 to cp315 modules already reference numpy._core (NumPy 2 ABI). In 4.0.3.post2 all seven wheels reference numpy._core. Python 3.13 and NumPy 1.26 were not run live: the C: drive of the Windows VM is full and uv could not create those two environments. Run folder on the Mac: ~/.local/share/eeglab-eegprep-compare/windows/runs/console-6b14bdd303.

    — orchestrator

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    gui-parity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions