Repository navigation
Conversation
Use the difference between the digital extrema for calibration. Counting both endpoints as an additional interval introduces a systematic gain and offset error. Test real generated EDF endpoint samples and compare physical IO reads against pyedflib instead of repeating the incorrect denominator.
|
@JuliaSprenger, it appears you wrote the initial implementation here and I don't know this reader at all, so could you look over this? |
h-mayorquin
left a comment
There was a problem hiding this comment.
The fix looks good to me. The EDF specification maps digital_min to physical_min and digital_max to physical_max. That is, the gain is the ratio between the physical range and the digital range. The + 1 was counting the digital values instead of measuring the distance between the endpoints.
I have one request, can you drop TestEDFCalibration? The change to test_compare_data already tests the fix on real data: it fails on master and passes here. TestEDFCalibration builds synthetic files with the pyedflib writer and I would like to move our EDF tests away from depending on pyedflib anyway at some point.
|
Removed |
|
The hosted EDF failure also exposed an old test assumption: after correcting the calibration, the fixture has a nonzero physical offset, so |
EDFRawIO divides the physical range by
digital_max - digital_min + 1, introducing a gain and offset error. The EDF specification defines corresponding physical and digital endpoints, so the denominator needs the difference between those endpoints. For an identity range of -8092 to 8092, a stored value of -5 currently reads as approximately -5.49966 rather than -5.Remove the extra interval. Update the existing EDFIO comparison to use PyEDFlib physical reads rather than repeating the old denominator. As requested in review, retain the recorded-data comparison and drop the synthetic
TestEDFCalibrationclass. Read raw integers through RawIO so the existing assertion also supports the fixture's corrected nonzero physical offset.Validation after the review change: 631 native core/IO tests pass; Black passes. Thirteen external-fixture tests are skipped because the GIN fixture downloads return HTTP403. The existing EDFIO comparison method also passes on an explicitly generated five-channel fixture. Recorded EEGMMIDB S001/R04 samples now agree exactly with independent EDF decoding across 16 raw/eager/lazy conversions; raw integers, timestamps and channel ordering stay unchanged.
The contributor-list commit is shared with #1919. The two runtime fixes are independent.