-
Notifications
You must be signed in to change notification settings - Fork 538
Closed
Labels
Description
I tried to log a batch of data with timestamps that are stored as plain seconds since Unix epoch in a numpy array.
According to the TimeColumn
documentation, I expected that this should be supported:
timestamp:
Used for absolute time indices, like `capture_time`.
Must either be in seconds since Unix epoch, [`datetime.datetime`][], or [`numpy.datetime64`][].
Logging succeeded but the timeline in the viewer was completely wrong.
Looking at the code, it turns out that TimeColumn.__init__()
implicitly assumes any np.ndarray passed as timestamp
to have a datetime dtype. This effectively means your seconds array will be interpreted as nanoseconds.
Note: the
duration
kwarg works with numeric arrays as advertised, there is a conversion.
Workaround: convert numpy array to list
rr.TimeColumn("time", timestamp=list(timestamps)))
Proposed fix: convert the array, similar to what is done for duration
.
Wumpf