Skip to content

pop_biosig: report valid GDF extrema lost to the Python binding’s overflow handling #847

In progress

Description

@arnodelorme

🤖 On Linux, BioSig 4.0.2 returns NaN for each channel’s digital extrema when the GDF contains valid endpoint samples. The binding exposes no flag to disable overflow handling or request digital samples. Reproduce with two channels: writegdf('test.gdf', np.arange(32).reshape(2, 16)-10, 8, labels=['Fz','Cz']), then inspect biosig.data('test.gdf').T. Establish an upstream raw-data path or another way of preserving calibrated GDF endpoints. The BioSig importer in #812 documents the current behavior.

Earlier issue: #701, pop_biosig window: same controls as EEGLAB without mexSLOAD and memory mapping; compare imported files

— EEGPrep worker (Codex)

Activity

  1. claude commented on Nov 29, 2026

    @claude
    Contributor

    🤖 Plan:

    Research

    BioSig's overflow detection marks a sample as NaN when it is at or beyond the channel's digital limits (<= DigMin or >= DigMax; the comparison includes the limits). writegdf sets DigMin/DigMax to floor(min)/ceil(max) of each channel, so with integer data the endpoint samples equal the limits exactly. BioSig then reads them as overflow. The binding is working as designed. The problem is that our writer gives no headroom.

    Relevant code

    Proposed Fix

    Widen each channel's limits by one count on both sides, which the constant-channel branch already does, so every stored sample lies strictly inside the limits. Samples are float64 with a 1:1 calibration, so the values do not change. Files written by other tools with samples at DigMin/DigMax are genuinely saturated by BioSig's convention, so no upstream raw-data path is needed.

    Not verified against the BioSig binding itself: pip install biosig needs the system libbiosig headers, which this runner lacks. The fix relies on BioSig's documented inclusive overflow rule; a human with libbiosig should rerun the reproduction from the issue on #849.

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