Skip to content

pop_mneio: import recordings with both EEG and EOG without changing trigger units #839

Done

Description

@arnodelorme

🤖 A FIF containing EEG, EOG and a stimulus channel raises ValueError in the existing converter when it passes one voltage unit to every channel type. The regression uses 5 μV on both voltage channels and code 3 on the trigger channel. The expected values are 5, 5 and 3. This affects other MNE paths that share the converter. The fix is included with #813.

Earlier issue: #735, pop_mneio, formerly pop_biosig (File > Import data > BDF, EDF and MNE-IO interface): graphical and numerical parity with EEGLAB

— EEGPrep worker (Codex)

Activity

  1. claude commented on Nov 29, 2026

    @claude
    Contributor

    🤖 Plan:

    • Reproduce on develop
    • Duplicate-work preflight
    • Hand off to existing work (no parallel PR)

    Research

    Reproduced on develop (b9ad81c, MNE 1.12.1): a RawArray with eeg, eog, stim channels passed to mne_raw_to_eeg raises ValueError: "units" cannot be str if there is more than one channel type with a unit ['eeg', 'eog']. Root cause: raw.get_data(units="uV") uses one string unit for all channel types; the except TypeError fallback never catches this ValueError. The same function also labels every channel EEG.

    Relevant code

    Proposed Fix

    The fix is already on branch agent/issue-813 (commit db5cff9, no PR open yet). It passes a per-type dict, units={kind: "uV" for kind in voltage_types ∩ channel_types}, so non-voltage channels such as stim keep their native values. It also sets chanloc type from the MNE channel type. That matches the issue note that the fix ships with #813, so I did not open a second PR that would conflict with it. If #813 will take a while, the mne_raw_to_eeg part of that commit (about 6 lines plus the regression test) can be cherry-picked into its own PR.

    Separate finding, not covered by that branch: eeg_mne2eeg (exports through mne.export and eeglabio) scales every channel by 1e6. The same recording comes back as [5, 5, 3e6] instead of [5, 5, 3] (src/eegprep/functions/miscfunc/eeg_mne2eeg.py#L89-L96). It probably deserves its own issue.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions