Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Laps "split_qualifying_sessions" doesn't split laps correctly. #605

Closed
Tom-Archer opened this issue Jun 28, 2024 · 2 comments
Closed
Labels
bug Something isn't working
Milestone

Comments

@Tom-Archer
Copy link

Describe the issue:

Attempting to use "split_qualifying_sessions" and "pick_drivers" doesn't seem to correctly split the laps.

See the output from the code example. Lap 15 is actually a Q2 lap. Lap 18 is actually a Q3 lap.

Reproduce the code example:

import fastf1

event = fastf1.get_event(2024, "Spain")
session = event.get_session("Q")
session.load(telemetry=False, laps=True, weather=False)
q1_laps, q2_laps, q3_laps = session.laps.pick_drivers("VER").split_qualifying_sessions()

print(q1_laps)
print("===")
print(q2_laps)
print("===")
print(q3_laps)

Error message:

Time Driver DriverNumber  ... DeletedReason  FastF1Generated  IsAccurate
12 0 days 00:19:52.736000    VER            1  ...                          False       False
13 0 days 00:21:05.042000    VER            1  ...                          False        True
14 0 days 00:22:47.851000    VER            1  ...                          False       False
15 0 days 00:45:51.261000    VER            1  ...                          False       False

[4 rows x 31 columns]
===
                     Time Driver DriverNumber  ... DeletedReason  FastF1Generated  IsAccurate
16 0 days 00:47:02.914000    VER            1  ...                          False        True
17 0 days 00:48:38.541000    VER            1  ...                          False       False
18 0 days 01:04:10.070000    VER            1  ...                          False       False

[3 rows x 31 columns]
===
                     Time Driver DriverNumber  ... DeletedReason  FastF1Generated  IsAccurate
19 0 days 01:05:21.743000    VER            1  ...                          False        True
20 0 days 01:06:59.915000    VER            1  ...                          False       False
21 0 days 01:12:40.726000    VER            1  ...                          False       False
22 0 days 01:13:52.129000    VER            1  ...                          False        True
23 0 days 01:15:29.255000    VER            1  ...                          False       False

[5 rows x 31 columns]
@Tom-Archer
Copy link
Author

Is this due to the position of a driver's garage in relation to the timing beam. I.e. VER crosses the timing beam after his 3rd lap in Q1, technically starting his 4th lap. The 4th lap isn't completed until the end of his out lap in Q2?

@theOehrly theOehrly added the bug Something isn't working label Jun 30, 2024
@theOehrly theOehrly added this to the v3.5.0 milestone Jun 30, 2024
@theOehrly
Copy link
Owner

This will be either due to the position of the garage or because drivers start lining up at the red light at pit exit. Either way, the most probable cause is that they cross the timing beam before the start of the next qualifying session, as you suggested.
The fix should be fairly straightforward. There likely just needs to be some more logic added to differentiate between in-laps and out-laps to differentiate between crossing the timing beam on the way in or on track versus on the way out. PRs are welcome for this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants