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
0ea1ff49
Commit
0ea1ff49
authored
1 month ago
by
Lennard Geese
Browse files
Options
Downloads
Patches
Plain Diff
Implement fetching and recognition of rain races
parent
97a97d94
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
DataAnalyser.py
+21
-5
21 additions, 5 deletions
DataAnalyser.py
DataImporter.py
+1
-1
1 addition, 1 deletion
DataImporter.py
Todos.md
+1
-1
1 addition, 1 deletion
Todos.md
main.py
+5
-2
5 additions, 2 deletions
main.py
with
28 additions
and
9 deletions
DataAnalyser.py
+
21
−
5
View file @
0ea1ff49
import
pandas
as
pandas
import
pandas
as
pandas
from
fastf1.core
import
Session
,
Lap
,
Laps
from
fastf1.core
import
Session
,
Lap
,
Laps
,
DataNotLoadedError
from
DataHandler
import
DataHandler
,
SessionIdentifier
from
DataHandler
import
DataHandler
,
SessionIdentifier
...
@@ -117,12 +117,28 @@ class DataAnalyser(DataHandler):
...
@@ -117,12 +117,28 @@ class DataAnalyser(DataHandler):
# ===== Weather =====
# ===== Weather =====
def
filterFor
Wet
Sessions
(
self
,
sessions
:
list
[
Session
]):
def
filterFor
Rain
Sessions
(
self
,
sessions
:
list
[
Session
]):
x
=
0
'''
Filter out & return only those sessions from input list that had rain falling at any point during the session.
Note: The sessions returned are not necessarily sessions that had wet conditions for any meaningful amount of
time. Also, sessions that had wet conditions only from leftover rainwater on track are not included in the
returned sessions, as no rain occured during the session. This is due to technical limitations.
:param sessions: List of sessions from which to pick out sessions with rain.
:return: List of sessions which had rain falling during the session for any amount of time.
'''
return
sessions
rainSessions
:
list
[
Session
]
=
[]
for
session
in
sessions
:
try
:
for
rainfallEntry
in
session
.
weather_data
[
"
Rainfall
"
]:
if
rainfallEntry
is
True
:
rainSessions
.
append
(
session
)
break
except
DataNotLoadedError
:
raise
DataNotLoadedError
(
f
"
Weather data not loaded for session
{
session
}
"
)
return
rainSessions
...
...
This diff is collapsed.
Click to expand it.
DataImporter.py
+
1
−
1
View file @
0ea1ff49
...
@@ -67,6 +67,6 @@ class DataImporter(DataHandler, ABC):
...
@@ -67,6 +67,6 @@ class DataImporter(DataHandler, ABC):
print
(
f
"
Weather for
{
event
[
"
EventName
"
]
}
{
event
.
year
}
could not be determined
"
)
print
(
f
"
Weather for
{
event
[
"
EventName
"
]
}
{
event
.
year
}
could not be determined
"
)
analyser
:
DataAnalyser
=
DataAnalyser
()
analyser
:
DataAnalyser
=
DataAnalyser
()
rainRaces
:
list
[
Session
]
=
analyser
.
filterFor
Wet
Sessions
(
races
)
rainRaces
:
list
[
Session
]
=
analyser
.
filterFor
Rain
Sessions
(
races
)
return
rainRaces
return
rainRaces
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Todos.md
+
1
−
1
View file @
0ea1ff49
# Todos (sorted by priority)
# Todos (sorted by priority)
-
[x] Automatically title graph by race name (no more hardcoding the graph name)
-
[x] Automatically title graph by race name (no more hardcoding the graph name)
-
[x] Adjust for pitstop discrepancies
-
[x] Adjust for pitstop discrepancies
-
[
] Fetch rain races via API, not Reddit
-
[
x
] Fetch rain races via API, not Reddit
-
[ ] Adjust for position changes caused by crashes (keep out of calculation similarly to PCs due to pitstops ?)
-
[ ] Adjust for position changes caused by crashes (keep out of calculation similarly to PCs due to pitstops ?)
-
[ ] Include safety car periods & driver crashes
-
[ ] Include safety car periods & driver crashes
-
[ ] Automatically determine if race is DWR or SWR
-
[ ] Automatically determine if race is DWR or SWR
...
...
This diff is collapsed.
Click to expand it.
main.py
+
5
−
2
View file @
0ea1ff49
...
@@ -19,8 +19,11 @@ class Main:
...
@@ -19,8 +19,11 @@ class Main:
def
main
(
self
):
def
main
(
self
):
dataHandler
:
Main
.
DataHandlingPackage
=
Main
.
DataHandlingPackage
()
dataHandler
:
Main
.
DataHandlingPackage
=
Main
.
DataHandlingPackage
()
rainRaces
:
list
[
Session
]
=
dataHandler
.
importer
.
getRainRacesSince
(
2015
)
year
:
int
=
2015
rainRaces
:
list
[
Session
]
=
dataHandler
.
importer
.
getRainRacesSince
(
year
)
print
(
f
"
Rain races since
{
max
(
year
,
2018
)
}
"
)
for
rainRace
in
rainRaces
:
print
(
rainRace
)
racesToAnalyse
=
[
racesToAnalyse
=
[
SessionIdentifier
(
2022
,
"
Imola
"
,
"
R
"
),
# Imola 2022 (DWR)
SessionIdentifier
(
2022
,
"
Imola
"
,
"
R
"
),
# Imola 2022 (DWR)
...
...
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