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
285b7992
Commit
285b7992
authored
3 weeks ago
by
Lennard Geese
Browse files
Options
Downloads
Patches
Plain Diff
Implement plotting multiple weather change windows
parent
049c1042
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
DataHandler.py
+10
-1
10 additions, 1 deletion
DataHandler.py
DataPlotter.py
+4
-5
4 additions, 5 deletions
DataPlotter.py
Todos.md
+1
-0
1 addition, 0 deletions
Todos.md
main.py
+3
-1
3 additions, 1 deletion
main.py
with
18 additions
and
7 deletions
DataHandler.py
+
10
−
1
View file @
285b7992
...
...
@@ -18,4 +18,13 @@ class SessionIdentifier:
def
__init__
(
self
,
year
:
int
,
event
:
int
|
str
,
sessionType
:
str
=
"
R
"
):
self
.
year
=
year
self
.
event
=
event
self
.
sessionType
=
sessionType
\ No newline at end of file
self
.
sessionType
=
sessionType
class
WeatherChangeWindow
:
firstLap
:
int
lastLap
:
int
def
__init__
(
self
,
firstTireChange
:
int
,
lastTireChange
:
int
):
self
.
firstLap
=
firstTireChange
-
1
self
.
lastLap
=
lastTireChange
+
1
\ No newline at end of file
This diff is collapsed.
Click to expand it.
DataPlotter.py
+
4
−
5
View file @
285b7992
...
...
@@ -7,13 +7,11 @@ import matplotlib as mpl
import
numpy
as
np
from
matplotlib.colors
import
ListedColormap
from
DataHandler
import
DataHandler
from
DataHandler
import
DataHandler
,
WeatherChangeWindow
# TODO: Adjust input parameters for multiple weather change windows
class
DataPlotter
(
DataHandler
):
def
plotOvertakesWithTireChangeWindow
(
self
,
overtakesPerLap
:
list
[
int
],
firstTireChange
:
int
,
lastTireChange
:
int
,
raceName
:
str
):
firstTireChange
-=
1
lastTireChange
+=
1
def
plotOvertakes
(
self
,
overtakesPerLap
:
list
[
int
],
raceName
:
str
,
weatherChangeWindows
:
list
[
WeatherChangeWindow
]
=
None
):
# Define variables
laps
:
int
=
len
(
overtakesPerLap
)
...
...
@@ -27,7 +25,8 @@ class DataPlotter(DataHandler):
plt
.
plot
(
x_values
,
overtakesPerLap
)
# Paint background between first and last tire change
axis
.
axvspan
(
firstTireChange
,
lastTireChange
,
color
=
'
blue
'
,
alpha
=
0.3
)
for
weatherChangeWindow
in
weatherChangeWindows
:
axis
.
axvspan
(
weatherChangeWindow
.
firstLap
,
weatherChangeWindow
.
lastLap
,
color
=
'
blue
'
,
alpha
=
0.3
)
# Label stuff
axis
.
set_xlabel
(
'
Lap
'
)
...
...
This diff is collapsed.
Click to expand it.
Todos.md
+
1
−
0
View file @
285b7992
...
...
@@ -3,6 +3,7 @@
-
[x] Adjust for pitstop discrepancies
-
[x] Fetch rain races via API, not Reddit
-
[x] Paint back of graph for weather change window
-
Also implemented for multiple weather changes
-
[ ] Adjust for position changes caused by crashes (keep out of calculation similarly to PCs due to pitstops ?)
-
[ ] Include safety car periods & driver crashes
-
[ ] Automatically determine if race is DWR or SWR
...
...
This diff is collapsed.
Click to expand it.
main.py
+
3
−
1
View file @
285b7992
from
fastf1.core
import
Session
from
fastf1.events
import
Event
import
DataHandler
from
DataAnalyser
import
DataAnalyser
from
DataChecker
import
DataChecker
from
DataHandler
import
SessionIdentifier
...
...
@@ -63,7 +64,8 @@ class Main:
# Plot
dataHandler
.
plotter
.
plotOvertakesWithTireChangeWindow
(
overtakesInRaces
,
earliestTireChange
,
latestTireChange
,
grandPrixName
)
weatherChangeWindow
=
DataHandler
.
WeatherChangeWindow
(
earliestTireChange
,
latestTireChange
)
dataHandler
.
plotter
.
plotOvertakes
(
overtakesInRaces
,
grandPrixName
,
[
weatherChangeWindow
])
print
(
"
Plot done
"
)
...
...
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