Overview
Thefastf1.utils module provides utility functions for common operations in FastF1, including time conversions, delta time calculations, and recursive dictionary access.
Functions
to_timedelta()
x(str | datetime.timedelta): Timestamp string or timedelta object
datetime.timedelta | None: Parsed timedelta object or None if parsing fails
13:24:46.320215 with:
- Optional hours and minutes
- Optional microseconds and milliseconds with arbitrary precision (1 to 6 digits)
24.3564- seconds + milli/microseconds36:54- minutes + seconds8:45:46- hours, minutes, seconds
to_datetime()
x(str | datetime.datetime): Timestamp string or datetime object
datetime.datetime | None: Parsed datetime object or None if parsing fails
2020-12-13T13:27:15.320000Z with:
- Optional milliseconds and microseconds with arbitrary precision (1 to 6 digits)
- Optional trailing letter ‘Z’
2020-12-13T13:27:15.3200002020-12-13T13:27:15.32Z2020-12-13T13:27:15
delta_time()
reference_lap(fastf1.core.Lap): The lap taken as referencecompare_lap(fastf1.core.Lap): The lap to compare
tuple[pd.Series, fastf1.core.Telemetry, fastf1.core.Telemetry]: A tuple containing:pd.Seriesof typefloat64with the delta in seconds- Telemetry for the reference lap
- Telemetry for the comparison lap
Use the returned telemetry for plotting to ensure you have telemetry data that was created with the same interpolation and resampling options.
recursive_dict_get()
d(dict): The dictionary to traverse*keys(str): Variable number of keys to traversedefault_none(bool, optional): If True, return None instead of empty dict when key doesn’t exist. Default is False.
- The value at the nested key path, or
{}(orNoneifdefault_none=True) if any key doesn’t exist
