v2.1.0: Refactoring, accuracy improvements and a more accessible interface¶
Possibly breaking changes:
The ‘Space’ column has been renamed to ‘Distance’ as this makes more sense
fastf1.utils.delta_time()
now returns two values; see explanation in the documentationLap telemetry is no longer precalculated and no longer saved in a separate column of the
Laps
DataFrame. This telemetry is now a computed property ofLaps
andLap
calculated property .telemetry: This contains position and car data merged into one instance of
Telemetry
(instance of DataFrame). The data is comparable to the previous ‘telemetry’ column. This data is intended for easy plotting. It should not be used for any further calculations as it contains interpolated values.laps = session.load_laps() fastest = laps.pick_fastest() tel = fastest['telemetry'] # will now fail as telemetry is no longer saved in DataFrame/Series tel = fastest.telemetry # will (still) work as this now accesses the computed property
function get_car_data, get_pos_data: These functions are available for
Lap
andLaps
. They return the telemetry data as received from the api with minimal postprocessing and crucially unmerged and without any interpolated values. This data should be used if you intend to do any further calculations with it.Also read the new documentation section about doing accurate calculations: How to perform calculations accurately
Patches and color scheme changes which were automatically applied when importing
fastf1.plotting
now need to be enabled explicitly. This is done by callingfasf1.plotting.setup_mpl()
. This function offers configuration through keyword arguments. The defaults are equal to what was done automatically before. It is highly recommended that you call this function to set up your matplotlib plotting environment.The formatting of timedelta values in matplotlib plots is now handled by an external module called ‘Timple’. As part of this change, the function
fastf1.plotting.laptime_axis()
has been removed. Timedelta data is now detected automatically if matplotlib timedelta support is enabled throughfastf1.plotting.setup_mpl()
. This will hopefully make the plotting of timedelta values considerably more reliable.The computed telemetry channels ‘Distance’ (before: ‘Space’), ‘DriverAhead’ and ‘DistanceToDriverAhead’ are no longer added to the telemetry data by default. This is done for speed and accuracy reasons. These channels can now be added by calling the appropriate
Telemetry.add_*()
methods of the newfastf1.core.Telemetry
class.The cache has been completely rewritten. It is now fully supported again and can detect version updates which require updating the cached data. Enabling the cache is now done using
fastf1.api.Cache.enable_cache()
Changes: - Accuracy improvement: Changes to some parts of the general flow of processing data to reduce calculation errors
Accuracy improvement: slightly better determination of the time at which a lap starts
Speed improvement: Faster parsing of API data
Added track status information to laps data
Added lap accuracy validation as a boolean ‘IsAccurate’ value for each lap. This is set based on track status, availability of some required lap data, pit stops
Added ‘Source’ to telemetry data to indicate whether a value is original (‘car’ or ‘pos’ depending on source) or interpolated
Added the class
fastf1.core.Lap
which subclassespd.Series
.Lap
is now the result of slicingfastf1.core.Laps
.Added additional pick_*() functions to
fastf1.core.Laps
Added
fastf1.core.Telemetry
which subclassespd.DataFrame
. This class offers various methods for working with the telemetry data and should make it easier to work with the data. Previously inaccessible functionality is now accessible in a more DataFrame-like style.Added various slicing capabilities for
fastf1.core.Telemetry
Telemetry data can be sliced at any point and calculated telemetry channels (Distance, Driver Ahead, …) can be added to this slice specifically.
Example usages:
‘Distance’ can be calculated continuously over multiple laps (starts at zero on the first lap and increases all the time).
‘DriverAhead’ can now be calculated for small telemetry slices more efficiently
DistanceToDriverAhead is reimplemented and returns a considerably smoother result now. This is at the cost of increasing integration error when used over longer periods of time (i.e. over multiple laps). To work around this, it should be applied to laps individually. Additionally, the old implementation is still available in
fastf1.legacy
.Add a SignalR client for receiving and saving live timing and telemetry data during a session.
Fixed: - fix: SessionNotAvailableError is now raised as Exception instead of BaseException
fix a crash when there is no valid car telemetry data at all (2019, Australia, FP3)
fix a crash caused by the resampling progressbar when there are very few laps in a session (2019, Azerbaijan, FP1)
fix a crash in _inject_position when some telemetry data is missing (2019, Silverstone, FP1)
fix a crash when data for a session can be requested but the data does not contain any useful values at all (2020, Styria, ‘FP3’)