Trying to add one event store to another in python - IndexError: Tried adding event store to store out of order.

24 views
Skip to first unread message

Nick Bruns

unread,
Jan 6, 2025, 5:58:30 PMJan 6
to dv-users
The title more or less describes what I am doing. I am trying to perform visualization operations informed by a consecutive, real-time stream of individual events (think a moving average). It is important that the number of events that are considered in the sliding window is fixed. Because of how the events that are looked at will be in potentially 2 or more packets, I decided that the best way to go about this is have two event stores. One will be the incoming packet that I will instantaneously display events on every time fixed interval, and the other will be a buffer that is added to and helps me get around the variable number of events in each packet.

However, if I attempt to pass the buffer eventStore to a slicing callback:

events=reader.getNextBatch()
if events is not None:
bufferEventStore.add(events)
bufferSlicer.accept(bufferEventStore)

I get the error shown in the title. This callback does not do anything, and if I run my code without passing the buffer eventstore to a slicer but I still add the events to the bufferEventStore, the code works fine and the timestamps look in order.

Please let me know how I can resolve this.

Thanks in advance.

Luca Longinotti

unread,
Jan 7, 2025, 9:17:28 AMJan 7
to dv-u...@googlegroups.com
Hello, the issue is that internally the slicer does the same thing as your buffer: it appends the packets you pass it and then cuts out (slices) the relevant part, either by time interval or number of events.
So if you pass the full buffer every time, it will complain that you're adding old data that it already has (past timestamps).
For your application I would consider not doing any manual buffering and simply having two slicers, one by time and one by number of events:
and add to both the incoming data from the camera. In pseudo-code:

events=reader.getNextBatch()
if events is not None:
  timeIntervalSlicer.accept(events)
  numberOfEventsSlicer.accept(events)
-- 
Luca Longinotti (llongi)

Senior Software Engineer
iniVation AG - https://inivation.com/
A SynSense Group company
Reply all
Reply to author
Forward
0 new messages