holgern / pyedflib

pyedflib is a python library to read/write EDF+/BDF+ files based on EDFlib.
http://pyedflib.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
209 stars 121 forks source link

Annotation start time overflow #255

Closed MitchFrankel closed 3 weeks ago

MitchFrankel commented 3 weeks ago

Using pyedflib 0.1.17. In EdfWriter.writeAnnotation, it uses np.round(onset_in_seconds*10000).astype(int). This only allows for onset_in_seconds up to 4.97 days before it overflows int, which is really int32, and bonks. If the data is longer than 4.97 days, and there are annotations that need to go there, how can one write annotations that won't overflow?

skjerns commented 3 weeks ago

Is there a reason you need to use v0.1.17? newest version is v0.1.37, where this is already fixed

This has been changed to int64 in https://github.com/holgern/pyedflib/pull/176 , so pyedflib>=v0.1.31 supports it