From af61153ce456725df4b7e5b3511f1574bcec2c73 Mon Sep 17 00:00:00 2001 From: Marcel Hild Date: Tue, 5 Sep 2023 08:29:28 +0200 Subject: [PATCH] fix gear if gear is NaN (#425) --- components/paddock/telemetry/fast_lap_analyzer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/paddock/telemetry/fast_lap_analyzer.py b/components/paddock/telemetry/fast_lap_analyzer.py index f78de30a..f1f4f545 100644 --- a/components/paddock/telemetry/fast_lap_analyzer.py +++ b/components/paddock/telemetry/fast_lap_analyzer.py @@ -1,6 +1,8 @@ import logging import statistics +import numpy as np + from .analyzer import Analyzer from .influx import Influx from .models import FastLap @@ -224,7 +226,7 @@ def gear_features(self, df): # create a dict which maps the distance to the gear distance_gear = dict(zip(distances, gears)) return { - "gear": int(gear), + "gear": int(gear) if not np.isnan(gear) else 0, "distance_gear": distance_gear, }