Description
The current implementation of the importIitYarpDataLog function in importIitYarp.py (as installed via pip install bimvee) attempts to detect whether the binary bitstream segments of a .log file contain timestamps by checking the monotonicity of bitStrings[::2]. However, this approach may cause some problems for two key reasons:
- It evaluates the condition even when
bitStrings is extremely short (length 1–2), which causes np.all(...) to trivially return True.
- It uses
np.uint32 values for timestamps. When calling np.diff(...), negative differences silently overflow and become large unsigned integers — leading to false positive detection of monotonicity.
As a result, with_ts may be incorrectly set to True, and the decoder applies incorrect timestamps to events, leading to corrupted and misaligned event data.
Steps to Reproduce
- Use a
.log file where early lines contain only 1–2 binary events
- Check
with_ts value during parsing — it will often be True from the first line
- If timestamps are missing, the decoder still applies them incorrectly
Example of Silent Overflow
import numpy as np
a = np.array([100, 50], dtype=np.uint32)
print(np.diff(a)) # array([4294967246], dtype=uint32)
print(np.diff(a) >= 0) # True — logically incorrect