kbberendsen commited on
Commit
f762786
·
1 Parent(s): 22210e9

start driver module

Browse files
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
app.py CHANGED
@@ -8,6 +8,7 @@ import numpy as np
8
  import shinyswatch
9
  from modules import plot
10
  from modules import test_module
 
11
 
12
  # Define cache folder path
13
  cache_path = os.getcwd() + "/cache"
@@ -67,26 +68,18 @@ app_ui = ui.page_fluid(
67
  ui.row(
68
  ui.column(
69
  6,
70
- ui.input_select(
71
- "driver1_select", label="Select driver 1:",
72
- choices = ["Fastest driver"],
73
- selected = "Fastest driver"
74
- )
75
  ),
76
  ui.column(
77
  6,
78
- ui.input_select(
79
- "driver2_select", label="Select driver 2:",
80
- choices = ["Fastest driver"],
81
- selected = "Fastest driver"
82
- )
83
  )
84
  ),
85
  ui.row(
86
  ui.column(
87
  6,
88
- test_module.test_ui("calc_1")
89
- #plot.plot1_ui("gear_1")
90
  #ui.output_text("fastest_driver_1"),
91
  #ui.output_text("laptime_1")
92
  ),
@@ -103,7 +96,7 @@ app_ui = ui.page_fluid(
103
 
104
  def server(input, output, session):
105
 
106
- test_module.test_server("calc_1")
107
 
108
  # Updating driver selection list
109
  @reactive.Effect()
@@ -198,8 +191,6 @@ def server(input, output, session):
198
 
199
  return f"The lap time is: {formatted_time}"
200
 
201
- plot.plot1_server("plot1")
202
-
203
  @output
204
  @render.plot
205
  def gear_2():
 
8
  import shinyswatch
9
  from modules import plot
10
  from modules import test_module
11
+ from modules import drivers
12
 
13
  # Define cache folder path
14
  cache_path = os.getcwd() + "/cache"
 
68
  ui.row(
69
  ui.column(
70
  6,
71
+ drivers.driver_ui('driver1_select')
 
 
 
 
72
  ),
73
  ui.column(
74
  6,
75
+ drivers.driver_ui('driver2_select')
 
 
 
 
76
  )
77
  ),
78
  ui.row(
79
  ui.column(
80
  6,
81
+ #test_module.test_ui("calc_1")
82
+ plot.plot1_ui("gear_1")
83
  #ui.output_text("fastest_driver_1"),
84
  #ui.output_text("laptime_1")
85
  ),
 
96
 
97
  def server(input, output, session):
98
 
99
+ plot.plot1_server("gear_1")
100
 
101
  # Updating driver selection list
102
  @reactive.Effect()
 
191
 
192
  return f"The lap time is: {formatted_time}"
193
 
 
 
194
  @output
195
  @render.plot
196
  def gear_2():
modules/__pycache__/drivers.cpython-311.pyc ADDED
Binary file (2.43 kB). View file
 
modules/drivers.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from shiny import module, App, ui, render, reactive
3
+ import fastf1 as ff1
4
+ import matplotlib.pyplot as plt
5
+ from matplotlib.collections import LineCollection
6
+ from matplotlib import cm
7
+ import numpy as np
8
+ import shinyswatch
9
+
10
+ # Define drivers
11
+ drivers_2023 = {'Fastest driver': 'Fastest driver', 'VER': 'Max Verstappen',
12
+ 'NOR': 'Lando Norris', 'GAS': 'Pierre Gasly', 'PER': 'Sergio Perez',
13
+ 'ALO': 'Fernando Alonso', 'LEC': 'Charles Leclerc', 'STR': 'Lance Stroll',
14
+ 'MAG': 'Kevin Magnussen', 'TSU': 'Yuki Tsunoda', 'ALB': 'Alexander Albon',
15
+ 'ZHO': 'Guanyu Zhou', 'HUL': 'Nico Hülkenberg', 'OCO': 'Esteban Ocon',
16
+ 'HAM': 'Lewis Hamilton', 'SAI': 'Carlos Sainz', 'RUS': 'George Russel',
17
+ 'BOT': 'Valteri Bottas', 'PIA': 'Oscar Piastri', 'VRI': 'Nyck de Vries',
18
+ 'SAR': 'Logan Sargeant', 'RIC': 'Daniel Ricciardo'}
19
+
20
+ drivers_2022 = {'Fastest driver': 'Fastest driver', 'VER': 'Max Verstappen',
21
+ 'NOR': 'Lando Norris', 'GAS': 'Pierre Gasly', 'PER': 'Sergio Perez',
22
+ 'ALO': 'Fernando Alonso', 'LEC': 'Charles Leclerc', 'STR': 'Lance Stroll',
23
+ 'MAG': 'Kevin Magnussen', 'TSU': 'Yuki Tsunoda', 'ALB': 'Alexander Albon',
24
+ 'ZHO': 'Guanyu Zhou', 'HUL': 'Nico Hülkenberg', 'OCO': 'Esteban Ocon',
25
+ 'HAM': 'Lewis Hamilton', 'SAI': 'Carlos Sainz', 'RUS': 'George Russel',
26
+ 'BOT': 'Valteri Bottas', 'VRI': 'Nyck de Vries', 'VET': 'Sebastian Vettel',
27
+ 'RIC': 'Daniel Ricciardo', 'MSC': 'Mick Schumacher',
28
+ 'LAT': 'Nicolas Latifi'}
29
+
30
+ @module.ui
31
+ def driver_ui(custom_label):
32
+ return ui.input_select(
33
+ custom_label, label="Select driver 1:",
34
+ choices = ["Fastest driver"],
35
+ selected = "Fastest driver"
36
+ )
37
+
38
+ @module.server
39
+ def driver_sever(custom_label):
40
+ return None