Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
F1 Overtake Analyser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Geese
F1 Overtake Analyser
Commits
6c39d850
Commit
6c39d850
authored
1 month ago
by
Lennard Geese
Browse files
Options
Downloads
Patches
Plain Diff
Implement counting of position changes in lap 1
parent
80492edc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DataAnalyser.py
+17
-7
17 additions, 7 deletions
DataAnalyser.py
with
17 additions
and
7 deletions
DataAnalyser.py
+
17
−
7
View file @
6c39d850
...
...
@@ -39,7 +39,10 @@ class DataAnalyser(DataHandler):
of laps the race had), all laps in the list will be either None objects or empty Panda Dataframes.
'''
# TODO: Implement returning starting grid for lapNumber = 0
# TODO: Implement returning starting grid for lapNumber = 1
# TODO: Sidestep getting start position from lap, get from session results instead, for lap 1 SOL (start of lap)
previousLaps
:
Laps
=
race
.
laps
.
pick_laps
(
lapNumber
-
1
)
currentLaps
:
Laps
=
race
.
laps
.
pick_laps
(
lapNumber
)
...
...
@@ -48,22 +51,26 @@ class DataAnalyser(DataHandler):
# Put every driver's laps in a sortable array & apply weighting based on position at end of lap
for
driver
in
race
.
drivers
:
driver
Current
Lap
:
Laps
=
previousLaps
.
pick_drivers
(
driver
sPrevious
Lap
:
Laps
=
previousLaps
.
pick_drivers
(
driver
)
# should only get 1 lap, but data type shenanigans
driver
Nex
tLap
:
Laps
=
currentLaps
.
pick_drivers
(
driver
)
driver
sCurren
tLap
:
Laps
=
currentLaps
.
pick_drivers
(
driver
)
startPosition
:
int
=
out
endPosition
:
int
=
out
try
:
startPosition
=
int
(
driverCurrentLap
[
'
Position
'
].
iloc
[
0
])
endPosition
=
int
(
driverNextLap
[
'
Position
'
].
iloc
[
0
])
if
lapNumber
==
1
:
startPosition
=
self
.
getGridPositionFor
(
driver
,
race
)
else
:
startPosition
=
int
(
driversPreviousLap
[
'
Position
'
].
iloc
[
0
])
endPosition
=
int
(
driversCurrentLap
[
'
Position
'
].
iloc
[
0
])
except
ValueError
:
if
self
.
activateDebugOvertakeAnalysis
:
print
(
f
"
Could not fetch positions from lap; driver %d likely didn
'
t finish lap %d or %d
"
,
driver
,
lapNumber
,
(
lapNumber
+
1
))
except
IndexError
:
if
self
.
activateDebugOvertakeAnalysis
:
print
(
"
[
'
Position
'
].iloc[0] was out of bounds; lap was likely empty because driver previously left the race
"
)
weightedOrder
[
startPosition
-
1
]
=
(
driverCurrentLap
,
endPosition
)
weightedOrder
[
startPosition
-
1
]
=
(
driversCurrentLap
,
endPosition
)
return
weightedOrder
def
countOvertakesInLap
(
self
,
lapNumber
:
int
,
race
:
Session
):
...
...
@@ -95,7 +102,10 @@ class DataAnalyser(DataHandler):
return
False
def
getGridPositionFor
(
self
,
driverNumber
:
int
,
race
:
Session
):
sessionResults
=
race
.
results
gridPosition
:
int
=
int
(
sessionResults
[
'
GridPosition
'
].
loc
[
driverNumber
])
return
gridPosition
def
getGridPositions
(
self
,
race
:
Session
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment