~cypheon/trakka

5804d636c683114ca2765a60a555dd8d98db3679 — Johann Rudloff 3 years ago 5f6aeb0
Allow 1% rounding error when comparing moving time with elapsed time
1 files changed, 4 insertions(+), 1 deletions(-)

M activities/activity.py
M activities/activity.py => activities/activity.py +4 -1
@@ 269,7 269,10 @@ def analyse(track: Track, athlete_data: Mapping[str, float], raw: bool = False):
    dist_deltas = np.diff(dist[:, 1])
    speed = dist_deltas / time_deltas
    moving_seconds = np.dot(np.greater(speed, MOVING_THRESHOLD), time_deltas)
    assert moving_seconds <= elapsed_seconds

    # In general moving time has to be less than or equal to elapsed time, but
    # allow for 1% rounding error.
    assert moving_seconds <= (elapsed_seconds * 1.01)

    hr = np.zeros((raw_hr.shape[0], 2))
    if raw_hr.shape[0] > 0: