Open bradyzp opened 5 years ago
Interesting. These rounding issues keep popping up in pandas. I'll put up a PR for this shortly.
Excellent thanks Chris.
I noticed there was an error in AppVeyor with your recent push, it seems there's an unrelated installation issue with matplotlib 3.0 vs matplotlib 2.2.3 missing the freetype and png header/libraries. We're not really directly using mpl at the moment so I'm inclined to ignore this and investigate in depth later to resolve (or pin mpl to the last working version 2.2.3).
Sounds good re the Appveyor issue. Sorry this simple fix is taking so long. Turned out the fix was a little trickier than I thought, but I think the latest push, though not ideal, should do it for now. I'm going to submit an issue to the pandas repo as well and I've been looking at it there. The issue is in a function that is used fairly widely, but the fix should be fairly simple.
Bug Report
Issue: convert_gps_time function (dgp/lib/time_utils.py) is returning a pandas TimeDelta with a floating point rounding error when using the 'datetime' format of convert_gps_time.
Relevant Module Versions
Sample Output
It seems that for any sub-second value other than .0 or .5 a rounding error is being introduced by pandas to_timedelta function. The specific line where the issue is introduced appears to be:
Resolution
A naive fix is to simply use .round('ns') on the pd.to_timedelta result, this seems to fix the issue, rounding off the ~50 ns of error on the timedelta result, testing will need to be done to verify this doesn't impact data ingestion. e.g.