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] Japan position data for RIC and ALB #569

Open
theOehrly opened this issue Apr 8, 2024 Discussed in #568 · 9 comments · May be fixed by #595
Open

[BUG] Japan position data for RIC and ALB #569

theOehrly opened this issue Apr 8, 2024 Discussed in #568 · 9 comments · May be fixed by #595
Labels
bug Something isn't working

Comments

@theOehrly
Copy link
Owner

Problem Description

Discussed in #568

Originally posted by AreaXimus1 April 8, 2024
For the first lap, the positional data for Ricciardo and Albon puts them in P2 and P3, respectively. Is this just an issue with how the data is collected?

image

Reason after Analysis

When a driver crashes on the first lap, a lap entry is generated by FastF1 so that the telemetry data for the crash lap is easily accessible (among other things).
The driver's positions at the end of each lap are calculated from the timing data ('Time' where a lap was set). But the generated laps have a fictional/assumed end time which is set to be equal to the time of the leader.

Ideas

  • would it be better to set these generated times equal to the time where the car in last position crossed the timing line instead?
  • should the crashed drivers get any position asigned or nan? In this case, positions could be calculated before adding the generated laps
  • should the crashed drivers get the last positions assigned? In this case, the 'FastF1Generated' flag can be used to filter the laps additionally during calculation
@theOehrly theOehrly added the bug Something isn't working label Apr 8, 2024
@theOehrly theOehrly changed the title Japan position data for RIC and ALB [BUG] Japan position data for RIC and ALB Apr 17, 2024
@AND2797
Copy link

AND2797 commented Apr 27, 2024

I think the crashed drivers LapTime is currently set to NaT. given that, does it make sense to give the drivers NaN position?

@theOehrly
Copy link
Owner Author

I think the crashed drivers LapTime is currently set to NaT. given that, does it make sense to give the drivers NaN position?

That would be an option, given that the position is float dtype already, so NaN is an option. Preferably, we should check what F1 and the FIA are doing and mirror that behaviour. I think the FIA has some official timing document for position per lap and driver? If they are still listed in any position there, then we shouldn't use NaN, if possible. But thinking about it, I would assume that they aren't listed any more on the lap where they crash, as they never make it to the timing line. So NaN would seem good then.

@AND2797
Copy link

AND2797 commented Apr 27, 2024

I found this: https://www.fia.com/sites/default/files/2024_04_jpn_f1_r0_timing_racelapchart_v02.pdf

Based on it, it seems ALB (23) and RIC (3) are not featured on the Lap 1 positioning.

@theOehrly
Copy link
Owner Author

NaN seems like the right choice then.

@AND2797
Copy link

AND2797 commented Apr 29, 2024

I can look into creating a PR for it.

@theOehrly
Copy link
Owner Author

I can look into creating a PR for it.

That would be great 👍

@AND2797
Copy link

AND2797 commented May 11, 2024

snippet to reproduce bug

import fastf1
race = fastf1.get_session(2024, "Japan", "R")
race.load()
laps = race.laps
ric_pos = laps[laps["Driver"] == "RIC"]["Position"]
alb_pos = laps[laps["Driver"] == "ALB"]["Position"]

@AND2797
Copy link

AND2797 commented May 25, 2024

Can we do this -
After all positions for all laps have been calculated

  • filter which drivers have only 1 lap
  • if the lap has FastF1Generated = True, we assign NaN position.

What we can also do is -

  • while assigning positions to Drivers, we check which laps are FastF1Generated and assign NaN in those positions.

the problem with this might be that in the future we may use FastF1Generated for some other use cases (other than generating a lap for lap 1 DNF drivers.) this logic may break in that case.

should the crashed drivers get the last positions assigned? In this case, the 'FastF1Generated' flag can be used to filter the laps additionally during calculation

@theOehrly
Copy link
Owner Author

Can we do this - After all positions for all laps have been calculated

* filter which drivers have only 1 lap

* if the lap has FastF1Generated = True, we assign NaN position.

I think that is the best solution right now.

the problem with this might be that in the future we may use FastF1Generated for some other use cases (other than generating a lap for lap 1 DNF drivers.) this logic may break in that case.

Yes, but I don't see any other use for this flag right now, because there are no other missing laps that we'd need to generate. And we don't have any other way to do this at the moment without making this much more complicated.

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

Successfully merging a pull request may close this issue.

2 participants