Skip to content
Snippets Groups Projects

Define times and durations consistently throughout client

Merged Patrick Godwin requested to merge patrick.godwin/arrakis-python:time_consistency into main
1 unresolved thread

Define the initial parameters of the Series and SeriesBlock to take in time_ns to avoid precision issues, but expose the time and duration properties to return each in seconds as a float.

Also store duration_ns internally and derive duration from this similarly to keep precision.

In terms of the API, both stream and fetch can take in GPS times as floats, but internally convert them to integer nanoseconds before sending the request to the server. Docstrings are fixed so that it is more clear whether arguments/properties are in nanoseconds or in seconds. In either case, the client will use seconds throughout, but can access the nanoseconds in the {time,duration}_ns properties in the Series/SeriesBlock. Internally, the nanoseconds are used to make server requests and to derive all the second-based properties the client sees.

Fixes #15 (closed) and #16 (closed).

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 125 165 ), "data and channels dicts have different keys"
    126 166 # check that the duration of all Series are consistent
    127 167 for channel, data in self.data.items():
    128 duration = len(data) / self.channels[channel].sample_rate
    129 if self.duration == 0:
    168 duration_ns = int((len(data) * Time.s) / self.channels[channel].sample_rate)
    • do we need to worry about precision in the sample_rate?

    • We could potentially run into issues in the case of non-integer sample rates, i.e. trends. We will need a better solution for the sample rate more generally, but this should not introduce new precision issues. Specifically, the order of operations was chosen to circumvent issues.

      I have an idea on how to tackle the sample rate issue but is out of scope for this MR.

    • Please register or sign in to reply
  • Patrick Godwin added 3 commits

    added 3 commits

    • ccedd93b - redefine Series and SeriesBlock times and durations in seconds
    • d0933177 - change fetch/stream to take in time as floats, convert to int nanoseconds in server request
    • 6ba07357 - fix docstring for describe to not have start/end times

    Compare with previous version

  • Jameson Rollins approved this merge request

    approved this merge request

  • Patrick Godwin mentioned in commit 3df6fdf2

    mentioned in commit 3df6fdf2

  • Please register or sign in to reply
    Loading