Skip to content

Allow overwriting incorrect units in EDF header with mne.io.read_raw_edf #14427

Open

Description

@raj-magesh

Describe the new feature or enhancement

An EDF file I have has some channels that are in arbitrary units (i.e. misc channels) but the header incorrectly specifies uV. There appears to be no easy way to fix this in MNE directly: I'll need to correct the header externally.

This causes downstream issues when exporting to EDF because the range now has too many characters to fit in an EDF header field (edfio gives up).

Describe your proposed implementation

Would it be possible to update the units parameter of mne.io.read_raw_edf to allow over-writing an existing unit? Currently, this raises an error: only units that are unspecified in the EDF header are allowed to be modified on opening them.

Describe possible alternatives

Using an external tool to fix the header. This is annoying because I expected this to be possible with just MNE.

Additional context

No response

Activity

  1. scott-huberty commented on Oct 16, 2026

    @scott-huberty
    Contributor

    Would it be possible to update the units parameter of mne.io.read_raw_edf to allow over-writing an existing unit? Currently, this raises an error: only units that are unspecified in the EDF header are allowed to be modified on opening them.

    I'm +1 for this. @raj-magesh are you open to submit a PR?

  2. raj-magesh commented on Oct 16, 2026

    @raj-magesh
    Author

    Sure, I'll try to get to this when I have the time. Currently, I've just edited the header directly with edfio as a workaround.

  3. Famous077 commented on Nov 6, 2026

    @Famous077
    Contributor

    Hi @scott-huberty @raj-magesh , Is there anyone working on this issue? if no, then Can I start working on it.

  4. raj-magesh commented on Nov 6, 2026

    @raj-magesh
    Author

    I'm not working on it currently. Feel free to take over!

  5. divya-git03 commented on Nov 19, 2026

    @divya-git03

    Hi! I'd like to work on this issue and submit a PR.

    I'll investigate the existing EDF unit conversion and scaling logic, implement support for explicitly overriding existing channel units, and add regression tests to ensure existing behavior remains intact.

    Please let me know if you have any particular implementation preferences.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions