Open StokesMIDE opened 3 years ago
Note: Removing the EventArray
implementations caused some sporadic problems in the enDAQ Lab development branch (https://github.com/MideTechnology/SlamStickLab/issues/329). The method _getBlockIndexWithTime()
was sometimes being called with a list of times rather than just one. My guess is the EventArray
version simply isn't bombing in this case, which prevented the error that generated the list of times from being discovered.
End of a traceback in which the issue occurred:
File "C:\Users\dstokes\workspace\SlamStickLab\venv\python39_endaq\lib\site-packages\idelib\dataset.py", line 2819, in iterSlice
for times, values in self._blockSlice(start, end, step, display):
File "C:\Users\dstokes\workspace\SlamStickLab\venv\python39_endaq\lib\site-packages\idelib\dataset.py", line 2798, in _blockSlice
yield makeBlockEvents(
File "C:\Users\dstokes\workspace\SlamStickLab\venv\python39_endaq\lib\site-packages\idelib\dataset.py", line 2528, in _makeBlockEvents
times, values = retryUntilReturn(
File "C:\Users\dstokes\workspace\SlamStickLab\venv\python39_endaq\lib\site-packages\idelib\dataset.py", line 2475, in retryUntilReturn
value = func()
File "C:\Users\dstokes\workspace\SlamStickLab\venv\python39_endaq\lib\site-packages\idelib\transforms.py", line 743, in __call__
y = self._eventlist.getMeanNear(timestamp, outOfRange=True)
File "C:\Users\dstokes\workspace\SlamStickLab\venv\python39_endaq\lib\site-packages\idelib\dataset.py", line 3216, in getMeanNear
b = self._getBlockIndexWithTime(t)
File "C:\Users\dstokes\workspace\SlamStickLab\venv\python39_endaq\lib\site-packages\idelib\dataset.py", line 1424, in _getBlockIndexWithTime
blockIdx = bisect_right(self._blockTimes, t, start, stop)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The problem described in the previous comment may have been a result of the race condition described in issue #32 and fixed in PR #33.
Correction: the previous comment has not been resolved, it is just sporadic. For some reason, _getBlockIndexWithTime()
is sometimes being called with a list of times rather than just one. The EventArray
version doesn't fail, but it must be producing bad results.
The new implementations of
EventArray._getBlockIndexWithIndex()
andEventArray_GetBlockIndexWithTime()
are somewhat slower than the original. There's a comment in the code reading "profile & determine if this change is beneficial." Here are times using the oldEventList
methods (EventArray
versions commented out):The
EventArray
version:(I did notice that the latter was called 8% more often, but the time differences are greater than that.)
This is probably because theEventArray
version does a search of all blocks every time. TheEventList
version caches groups of times and indices, making the search smaller set to search.