You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pop_biosig: report valid GDF extrema lost to the Python binding’s overflow handling #847
🤖 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
CI: docs and review pass; unit, lint and type jobs still queued
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.
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.
Activity
claude commentedon Nov 29, 2026
🤖 Plan:
writegdfandpop_biosigwritegdfor BioSig; pop_biosig: read with the biosig Python library, installed from the extension manager #812 (biosig-backedpop_biosig) is still an open issue with no PRResearch
BioSig's overflow detection marks a sample as NaN when it is at or beyond the channel's digital limits (
<= DigMinor>= DigMax; the comparison includes the limits).writegdfsets DigMin/DigMax tofloor(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
src/eegprep/functions/sigprocfunc/writegdf.py#L109-L118: limits equal the data extremessrc/eegprep/functions/sigprocfunc/writegdf.py#L159-L162: physical/digital min/max written to the headerProposed 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 biosigneeds the systemlibbiosigheaders, 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.