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
6d430ee2
Commit
6d430ee2
authored
1 month ago
by
Lennard Geese
Browse files
Options
Downloads
Patches
Plain Diff
Adjust for DataImporter.py to use SessionIdentifier
parent
6d4aa011
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
DataImporter.py
+5
-8
5 additions, 8 deletions
DataImporter.py
main.py
+11
-11
11 additions, 11 deletions
main.py
with
16 additions
and
19 deletions
DataImporter.py
+
5
−
8
View file @
6d430ee2
...
...
@@ -4,10 +4,7 @@ from abc import ABC
from
fastf1.core
import
Session
from
fastf1.events
import
EventSchedule
,
Event
from
DataHandler
import
DataHandler
from
DataHandler
import
DataHandler
,
SessionIdentifier
class
DataImporter
(
DataHandler
,
ABC
):
...
...
@@ -26,14 +23,14 @@ class DataImporter(DataHandler, ABC):
x
=
0
def
import
Race
Sessions
(
self
,
sessionIdentifiers
:
list
[
(
int
,
int
)
],
laps
=
True
,
telemetry
=
False
,
weather
=
True
,
messages
=
False
):
def
importSessions
(
self
,
sessionIdentifiers
:
list
[
SessionIdentifier
],
laps
=
True
,
telemetry
=
False
,
weather
=
True
,
messages
=
False
):
sessions
:
list
[
Session
]
=
[]
for
sessionIdentifier
in
sessionIdentifiers
:
sessions
.
append
(
self
.
importSession
(
sessionIdentifier
,
"
R
"
,
laps
,
weather
,
messages
,
telemetry
))
sessions
.
append
(
self
.
importSession
(
sessionIdentifier
,
laps
,
weather
,
messages
,
telemetry
))
return
sessions
def
importSession
(
self
,
sessionIdentifier
:
(
int
,
int
),
sessionType
:
st
r
,
laps
=
True
,
telemetry
=
False
,
weather
=
True
,
messages
=
False
):
session
=
fastf1
.
get_session
(
sessionIdentifier
[
0
]
,
sessionIdentifier
[
1
],
sessionType
)
def
importSession
(
self
,
sessionIdentifier
:
SessionIdentifie
r
,
laps
=
True
,
telemetry
=
False
,
weather
=
True
,
messages
=
False
):
session
=
fastf1
.
get_session
(
sessionIdentifier
.
year
,
sessionIdentifier
.
event
,
sessionIdentifier
.
sessionType
)
session
.
load
(
laps
=
laps
,
telemetry
=
telemetry
,
weather
=
weather
,
messages
=
messages
)
return
session
\ No newline at end of file
This diff is collapsed.
Click to expand it.
main.py
+
11
−
11
View file @
6d430ee2
...
...
@@ -2,6 +2,7 @@ from asyncio import Event
from
DataAnalyser
import
DataAnalyser
from
DataChecker
import
DataChecker
from
DataHandler
import
SessionIdentifier
from
DataImporter
import
DataImporter
from
DataPlotter
import
DataPlotter
...
...
@@ -18,14 +19,13 @@ class Main:
self
.
listWetWeatherRacesSince
(
2015
)
race_indexes
=
[
[
2022
,
4
],
# Imola 2022 (DWR)
[
2024
,
7
],
# Imola 2024 (SWR)
[
2024
,
9
],
# Canada 2024 (DWR)
[
2023
,
8
]
# Canada 2023 (SWR)
# TODO: add more races
racesToAnalyse
=
[
SessionIdentifier
(
2022
,
4
,
"
R
"
),
# Imola 2022 (DWR)
SessionIdentifier
(
2024
,
7
,
"
R
"
),
# Imola 2024 (SWR)
SessionIdentifier
(
2024
,
9
,
"
R
"
),
# Canada 2024 (DWR)
SessionIdentifier
(
2023
,
8
,
"
R
"
)
# Canada 2023 (SWR)
]
self
.
overtakeAnalysis
(
race
_indexes
)
self
.
overtakeAnalysis
(
race
sToAnalyse
)
def
listWetWeatherRacesSince
(
self
,
firstYear
:
int
):
dataHandler
:
Main
.
DataHandlingPackage
=
self
.
DataHandlingPackage
()
...
...
@@ -36,14 +36,14 @@ class Main:
x
=
0
# TODO: filter out dry races
def
overtakeAnalysis
(
self
,
race
_indexes
:
list
[(
int
,
int
)
]):
def
overtakeAnalysis
(
self
,
race
SessionIdentifiers
:
list
[
SessionIdentifier
]):
dataHandler
:
Main
.
DataHandlingPackage
=
self
.
DataHandlingPackage
()
for
race
_index
in
race_indexe
s
:
for
race
SessionIdentifier
in
raceSessionIdentifier
s
:
# Import
raceSession
=
dataHandler
.
importer
.
importSession
(
race
_index
,
"
R
"
)
raceSession
=
dataHandler
.
importer
.
importSession
(
race
SessionIdentifier
)
raceName
:
str
=
f
"
{
raceSession
.
event
[
'
EventName
'
]
}
{
raceSession
.
event
.
year
}
"
print
(
"
Import done
"
)
...
...
@@ -64,7 +64,7 @@ class Main:
# Print data
print
(
f
"
\n\n
===== Data for race
{
race
_index
[
0
]
}
/
{
race_index
[
1
]
}
=====
"
)
print
(
f
"
\n\n
===== Data for race
{
race
SessionIdentifier
.
event
}
/
{
raceSessionIdentifier
.
year
}
=====
"
)
print
(
"
Lap
\t
Overtakes
"
)
currentLap
=
0
for
overtakesInLap
in
overtakesInRaces
:
...
...
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