Skip to content

A Set Of Tools To Analyse F1 Sessions, Powered By The Fast F1 Library

Notifications You must be signed in to change notification settings

4A-50/F1-Analysis-Suite

Repository files navigation

F1 Analysis Suite

A Set Of Tools To Analyse F1 Sessions, Powered By The Fast F1 Library

Modes

Lap Telemetry

This Tool Works By Going Through All The Laps Of A Specifed Race To Get A Drivers Lap Time, Which Is Then Compared To The Fastest Time Of That Lap To Produce A Delta Value That Roughly Shows Their Tyre Performance. When Used With The Vervose Parameter It Also Outputs A Graph Showing The Delta.

This Tool Is Run By Using The Mode LT

Requires:

  • driver - Drivers Three Letter Identifier (E.G. VER)
  • -y --year - Year The Session Took Place (E.G. 2021)
  • -r --race - The Race Weekends Number (E.G. 22 (Abu Dhabi))
  • -s --session - The Session Name (E.G. R, SQ, Q, FP3, FP2, FP1)
  • -l --lap - The Lap Number (E.G. 58)

Optional:

  • -sd --secondDriver - Another Drivers Three Letter Identifier (E.G. HAM)

Example Run Code: python main.py LT VER -y 2021 -r 22 -s R -l 58 -sd HAM

Which Outputs: Output

Drivers Tyre Performance

This Tool Works By Going Through All The Laps Of A Specifed Race To Get A Drivers Lap Time, Which Is Then Compared To The Fastest Time Of That Lap To Produce A Delta Value That Roughly Shows Their Tyre Performance. When Used With The Vervose Parameter It Also Outputs A Graph Showing The Delta.

This Tool Is Run By Using The Mode DTP

Requires:

  • driver - Drivers Three Letter Identifier (E.G. PER)
  • -y --year - Year The Session Took Place (E.G. 2021)
  • -r --race - The Race Weekends Number (E.G. 18 (Mexico))
  • -s --session - The Session Name (E.G. R, SQ, Q, FP3, FP2, FP1)

Optional:

  • -v --verbose - Adds More Output Data

Example Run Code: python main.py DTP PER -y 2021 -r 18 -s R -v

Which Outputs:

core           INFO     Loading laps for Mexico City Grand Prix - Race [v2.1.10]
api            INFO     Using cached data for timing_data
api            INFO     Using cached data for timing_app_data
core           INFO     Processing timing data...
api            INFO     Using cached data for driver_info
api            INFO     Using cached data for session_status_data
api            INFO     Using cached data for track_status_data
api            INFO     Using cached data for car_data
api            INFO     Using cached data for position_data
api            INFO     Using cached data for weather_data
core           INFO     Loaded data for 20 drivers: ['63', '77', '33', '7', '47', '31', '4', '3', '9', '16', '22', '5', '14', '44', '18', '11', '10', '99', '6', '55']
                                           Tyre Lap Info
  Lap   Stint   Compound   Life   Fresh     Lap Time        Delta        Fast Lap      Fast Lap                                                                                                                          
                                                                           Time         Driver                                                                                                                           
 ─────────────────────────────────────────────────────────────────────────────────────────────────                                                                                                                       
   2      1      MEDIUM    5.0    False   0:02:11.5750:00:00.170:02:11.403HAM
   3      1      MEDIUM    6.0    False   0:02:06.3550:00:01.820:02:04.534GIO
   4      1      MEDIUM    7.0    False   0:02:06.3080:00:20.450:01:45.850RIC
   5      1      MEDIUM    8.0    False   0:01:23.1850:00:01.570:01:21.615VER
   6      1      MEDIUM    9.0    False   0:01:22.3560:00:00.720:01:21.635VER
   7      1      MEDIUM    10.0   False   0:01:22.3300:00:00.700:01:21.622VER
   8      1      MEDIUM    11.0   False   0:01:21.9540:00:00.430:01:21.520VER
   9      1      MEDIUM    12.0   False   0:01:21.7660:00:00.710:01:21.051VER
  10      1      MEDIUM    13.0   False   0:01:21.6870:00:00.580:01:21.105HAM
  11      1      MEDIUM    14.0   False   0:01:21.3890:00:00.430:01:20.958VER
  12      1      MEDIUM    15.0   False   0:01:21.4640:00:00.450:01:21.014VER
  13      1      MEDIUM    16.0   False   0:01:21.5200:00:00.310:01:21.209VER
  14      1      MEDIUM    17.0   False   0:01:21.4570:00:00.290:01:21.158VER
  15      1      MEDIUM    18.0   False   0:01:21.1730:00:00.070:01:21.100VER
  16      1      MEDIUM    19.0   False   0:01:21.3930:00:00.360:01:21.026VER
  17      1      MEDIUM    20.0   False   0:01:21.6520:00:00.370:01:21.274HAM
  18      1      MEDIUM    21.0   False   0:01:21.2600:00:00.050:01:21.203HAM
  19      1      MEDIUM    22.0   False   0:01:21.3800:00:00.690:01:20.685VER
  20      1      MEDIUM    23.0   False   0:01:21.7650:00:00.630:01:21.126VER
  21      1      MEDIUM    24.0   False   0:01:21.7580:00:00.520:01:21.231VER
  22      1      MEDIUM    25.0   False   0:01:22.0170:00:00.700:01:21.316VER
  23      1      MEDIUM    26.0   False   0:01:21.4820:00:00.060:01:21.417VER
  24      1      MEDIUM    27.0   False   0:01:21.7830:00:00.380:01:21.398HAM
  25      1      MEDIUM    28.0   False   0:01:21.3590:00:00.070:01:21.430HAM
  26      1      MEDIUM    29.0   False   0:01:21.4090:00:00.080:01:21.491VER
  27      1      MEDIUM    30.0   False   0:01:21.1700:00:00.090:01:21.267VER
  28      1      MEDIUM    31.0   False   0:01:21.4200:00:00.210:01:21.203VER
  29      1      MEDIUM    32.0   False   0:01:22.1180:00:01.080:01:21.029VER
  30      1      MEDIUM    33.0   False   0:01:21.8410:00:00.510:01:21.328VER
  31      1      MEDIUM    34.0   False   0:01:22.0920:00:02.130:01:19.953HAM
  32      1      MEDIUM    35.0   False   0:01:21.8580:00:01.640:01:20.218HAM
  33      1      MEDIUM    36.0   False   0:01:21.1960:00:00.740:01:20.456HAM
  34      1      MEDIUM    37.0   False   0:01:21.1520:00:00.620:01:20.526HAM
  35      1      MEDIUM    38.0   False   0:01:20.8900:00:00.360:01:20.527HAM
  36      1      MEDIUM    39.0   False   0:01:21.0680:00:00.800:01:20.266VER
  37      1      MEDIUM    40.0   False   0:01:20.7610:00:00.500:01:20.261VER
  38      1      MEDIUM    41.0   False   0:01:21.5410:00:01.450:01:20.083VER
  39      1      MEDIUM    42.0   False   0:01:21.7860:00:01.440:01:20.340VER
  42      2       HARD     2.0    True    0:01:19.6590:00:00.360:01:20.025VER
  43      2       HARD     3.0    True    0:01:20.1520:00:00.160:01:19.989VER
  44      2       HARD     4.0    True    0:01:19.7120:00:00.330:01:20.049BOT
  45      2       HARD     5.0    True    0:01:19.8400:00:00.000:01:19.834HAM
  46      2       HARD     6.0    True    0:01:19.9490:00:00.180:01:19.761BOT
  47      2       HARD     7.0    True    0:01:21.3240:00:01.110:01:20.211VER
  48      2       HARD     8.0    True    0:01:20.5520:00:00.130:01:20.419HAM
  49      2       HARD     9.0    True    0:01:19.4680:00:00.450:01:19.921VER
  50      2       HARD     10.0   True    0:01:20.1880:00:00.270:01:20.461HAM
  51      2       HARD     11.0   True    0:01:19.6750:00:00.430:01:20.111HAM
  52      2       HARD     12.0   True    0:01:19.8900:00:00.890:01:18.999VER
  53      2       HARD     13.0   True    0:01:19.6860:00:00.440:01:20.130HAM
  54      2       HARD     14.0   True    0:01:19.8820:00:00.160:01:20.045VER
  55      2       HARD     15.0   True    0:01:19.6430:00:00.430:01:20.078VER
  56      2       HARD     16.0   True    0:01:19.9600:00:00.020:01:19.988VER
  57      2       HARD     17.0   True    0:01:20.3090:00:00.270:01:20.039VER
  58      2       HARD     18.0   True    0:01:20.1510:00:00.310:01:19.839VER
  59      2       HARD     19.0   True    0:01:20.3980:00:00.140:01:20.249VER
  60      2       HARD     20.0   True    0:01:20.4060:00:00.000:01:20.413VER
  61      2       HARD     21.0   True    0:01:20.8780:00:00.590:01:20.287VER
  62      2       HARD     22.0   True    0:01:20.5360:00:00.310:01:20.220HAM
  63      2       HARD     23.0   True    0:01:20.0910:00:00.260:01:19.825VER
  64      2       HARD     24.0   True    0:01:20.3950:00:00.690:01:19.704VER
  65      2       HARD     25.0   True    0:01:21.1190:00:01.900:01:19.210VER
  66      2       HARD     26.0   True    0:01:19.9360:00:00.110:01:19.820HAM
  67      2       HARD     27.0   True    0:01:19.8900:00:00.230:01:20.127HAM
  68      2       HARD     28.0   True    0:01:19.8890:00:00.540:01:20.430HAM
  69      2       HARD     29.0   True    0:01:19.8460:00:02.070:01:17.774BOT
  70      2       HARD     30.0   True    0:01:20.1830:00:00.130:01:20.319HAM
  71      2       HARD     31.0   True    0:01:21.1500:00:00.640:01:20.502VER
Predicted Race Position

This Tool Works By Getting Every Race Start & End Positions From An Inputted Driver Works Out The Most Common Result, And It's % Of Happening. Drivers With Larger Data Sets E.G. Räikkönen or Alonso Have The Highest Chance Of Being Close To The Actual Result Compared To A Rookie Like Mick Schumacher.

This Tool Is Run By Using The Mode PRP

Requires:

  • driver - Drivers Three Letter Identifier (E.G. HAM)
  • -sp --startingpos - The Drivers Starting Pos (E.G. 1)

Optional:

  • -v --verbose - Adds More Output Data

Example Run Code: python main.py PRP HAM -sp 1 -v

Which Outputs:

Race Start To Race End                          
       Positions                                
                                                
  Start Pos   End Pos                           
 ─────────────────────                          
      1          1                              
      1          1                              
      1          3                              
      1          1                              
      1          1                              
      1          1                              
      1          1                              
      1          5                              
      1          3                              
      1         12                              
      1          1                              
      1          2                              
      1          1                              
      1          1                              
      1          2                              
      1          3                              
      1          3                              
      1          1                              
      1          1                              
      1          3                              
      1          4                              
      1          5                              
      1          1                              
      1          3                              
      1          1                              
      1          1                              
      1          1                              
      1          1                              
      1          1                              
      1          1                              
      1          1                              
      1          2                              
      1          1                              
      1          1                              
      1          3                              
      1          1                              
      1          2                              
      1          1                              
      1          6                              
      1          1                              
      1          1                              
      1          2                              
      1          3                              
      1          1                              
      1          1                              
      1          1                              
      1          2                              
      1          1                              
      1          1                              
      1          1                              
      1          1                              
      1          2                              
      1          1                              
      1          1                              
      1          1                              
      1          5                              
      1          1                              
      1          1                              
      1          1                              
      1          2                              
      1          1                              
      1          1                              
      1          2                              
      1          1                              
      1          1                              
      1          2                              
      1          1                              
      1          2                              
      1          1                              
      1          1                              
      1          3                              
      1          1                              
      1          1                              
      1          2                              
      1          1                              
      1          1                              
      1          9                              
      1          1                              
      1          1                              
      1          1                              
      1          1                              
      1          1                              
      1          1                              
      1          7                              
      1          1                              
      1          3                              
      1          1                              
      1          1                              
      1          2                              
      1          1                              
      1          2                              
                                                
Most Likely Finishing Place Is 1.               
With A 65% Chance.                              
Fastest Technically Possible Lap Time

This Tool Works By Going Through A Drivers Mini Sectors Of Every Lap And Finds The Fastest Ones. These Are Then Added Together To Produce The Fastest Technically Possible Lap Time. This Obviously Completely Ignores Tyre Wear, Tyre Temp, Fuel Load, Slipstream And Dirty Air. This Time Is Near Impossible To Actually Achieve But Is A Fun Metric To Know.

This Tool Is Run By Using The Mode FTPLT

Requires:

  • driver - Drivers Three Letter Identifier (E.G. NOR)
  • -y --year - Year The Session Took Place (E.G. 2021)
  • -r --race - The Race Weekends Number (E.G. 10 (Austria))
  • -s --session - The Session Name (E.G. R, SQ, Q, FP3, FP2, FP1)

Optional:

  • -m --minisectors - The Amount Of Mini Sectors To Analyse, Defaults To 25
  • -v --verbose - Adds More Output Data

Example Run Code: python main.py FTPLT NOR -y 2021 -r 9 -s R -v

Which Outputs:

core           INFO     Loading laps for Austrian Grand Prix - Race [v2.1.8]
api            INFO     Using cached data for timing_data
api            INFO     Using cached data for timing_app_data
core           INFO     Processing timing data...
api            INFO     Using cached data for session_status_data
api            INFO     Using cached data for track_status_data
api            INFO     Using cached data for car_data
api            INFO     Using cached data for position_data
api            INFO     Using cached data for weather_data
core           INFO     Loaded data for 19 drivers: ['14', '3', '16', '5', '77', '44', '4', '47', '9', '22', '63', '18', '33', '6', '99', '11', '7', '55', '10']
                     Fastest Technically Possible MiniSectors

  MiniSector         Speed                 Gear                ~Time          Lap
 ─────────────────────────────────────────────────────────────────────────────────
      1        298.09090909090907   7.818181818181818    2.0780290210430015   53
      2        315.5882352941176           8.0           1.9628157539608582   53
      3        247.52173913043478   6.6521739130434785   2.502574368522748    42
      4        221.2173913043478    5.043478260869565    2.8001485613207557    1
      5              270.0          6.7368421052631575   2.2942280000000004    1
      6        295.8421052631579    7.631578947368421    2.0938248781355635   53
      7        316.47058823529414          8.0           1.9573432193308553   53
      8        300.8333333333333           8.0           2.0590855180055407   21
      9        138.57894736842104          3.0           4.469954287884544     1
      10             249.95                6.0           2.4782618923784763    1
      11       285.6111111111111    7.277777777777778    2.168828648122934    53
      12       317.1764705882353           8.0           1.952987114243324    53
      13       254.52380952380952   6.714285714285714    2.433727363891488     4
      14       194.69230769230768   4.230769230769231    3.1816437297510873    1
      15       249.8695652173913           6.0           2.479059662432574     1
      16       247.95454545454547          6.0           2.498206108157654    67
      17       215.95833333333334   5.208333333333333    2.8683383060003864    1
      18             233.0          5.695652173913044    2.6585474678111596   62
      19       244.13636363636363   5.7727272727272725   2.537276916775275     1
      20             265.35                6.65          2.3344321085358963   55
      21       288.6842105263158           7.0           2.145741046490429    55
      22       293.57894736842104          7.0           2.1099658730727864   64
      23       245.63636363636363   6.136363636363637    2.521782812731311    57
      24       199.15384615384616   4.423076923076923    3.1103670451911944   30
      25       255.09677419354838   6.225806451612903    2.4282610470409716   56

Fastest Technically Possible Lap Time ~0:01:02.125431
Actual Fastest Lap 0:01:08.471000 On Lap 62.0
Fastest Technically Possible Time Made Up From MiniSectors On Laps: [53.0, 42.0, 1.0, 21.0, 4.0,
67.0, 62.0, 55.0, 64.0, 57.0, 30.0, 56.0]
Differance In Lap Times: 0:00:06.345569
core           INFO     Loading laps for Austrian Grand Prix - Race [v2.1.8]
api            INFO     Using cached data for timing_data
api            INFO     Using cached data for timing_app_data
core           INFO     Processing timing data...
api            INFO     Using cached data for session_status_data
api            INFO     Using cached data for track_status_data
api            INFO     Using cached data for car_data
api            INFO     Using cached data for position_data
api            INFO     Using cached data for weather_data
core           INFO     Loaded data for 19 drivers: ['14', '3', '16', '5', '77', '44', '4', '47', '9', '22', '63', '18', '33', '6', '99', '11', '7', '55', '10']
 Actual Fastest Lap Vs Fastest Technically
                Possible Lap

  MiniSector   Gain/Loss   Time Differance
 ──────────────────────────────────────────
      1          Lost      0:00:00.093926
      2          Lost      0:00:00.120999
      3          Lost      0:00:00.154982
      4          Lost      0:00:00.979029
      5          Lost      0:00:00.152316
      6          Lost      0:00:00.074049
      7          Lost      0:00:00.132227
      8          Lost      0:00:00.101624
      9          Lost      0:00:01.311655
      10         Lost      0:00:00.527613
      11         Lost      0:00:00.120045
      12         Lost      0:00:00.153580
      13        Gained     0:00:00.011781
      14         Lost      0:00:01.571408
      15         Lost      0:00:00.193952
      16         Lost      0:00:00.010538
      17         Lost      0:00:00.368759
      18        Gained     0:00:00.010377
      19         Lost      0:00:00.300802
      20         Lost      0:00:00.034154
      21         Lost      0:00:00.023732
      22         Lost      0:00:00.005689
      23         Lost      0:00:00.028359
      24        Gained     0:00:00.017741
      25         Lost      0:00:00.072156
Fastest Lap Mini Sectors

This Tool Works By Getting A Drivers Mini Sectors From Their Fastest Lap. This Then Outputs The Average Speed And Gear Of The Mini Sector, And The Rough Time It Took To Pass Through It.

This Tool Is Run By Using The Mode FLMS

Requires:

  • driver - Drivers Three Letter Identifier (E.G. NOR)
  • -y --year - Year The Session Took Place (E.G. 2021)
  • -r --race - The Race Weekends Number (E.G. 10 (Austria))
  • -s --session - The Session Name (E.G. R, SQ, Q, FP3, FP2, FP1)

Optional:

  • -m --minisectors - The Amount Of Mini Sectors To Analyse, Defaults To 25
  • returnMode - Only Used Internally By Other Scripts But Allows Them To Take The Data As Pandas DataFrame

Example Run Code: python main.py FLMS NOR -y 2021 -r 9 -s R -v

Which Outputs:

core           INFO     Loading laps for Austrian Grand Prix - Race [v2.1.8]
api            INFO     Using cached data for timing_data
api            INFO     Using cached data for timing_app_data
core           INFO     Processing timing data...
api            INFO     Using cached data for session_status_data
api            INFO     Using cached data for track_status_data
api            INFO     Using cached data for car_data
api            INFO     Using cached data for position_data
api            INFO     Using cached data for weather_data
core           INFO     Loaded data for 19 drivers: ['3', '11', '7', '77', '22', '33', '5', '18', '16', '63', '6', '4', '55', '10', '44', '99', '14', '9', '47']
                           Fastest Lap MiniSectors

  MiniSector         Speed                 Gear                ~Time
 ───────────────────────────────────────────────────────────────────────────
      1              285.2                 7.0           2.166059887798037
      2        297.2631578947368           7.0           2.078159582152975
      3        233.08695652173913   6.565217391304348    2.6503425554933786
      4        163.9090909090909    4.181818181818182    3.7689201774819754
      5        253.1904761904762    6.142857142857143    2.439903306375776
      6        285.7368421052632           7.0           2.161990296555535
      7        296.44444444444446          7.0           2.083898995502249
      8        286.6842105263158           7.0           2.154845845419498
      9              107.14                3.06          5.765916371103231
      10       206.07692307692307   4.653846153846154    2.997716924225458
      11       270.63157894736844   6.7368421052631575   2.2826614780241155
      12       294.05263157894734          7.0           2.1008493502774304
      13       255.76190476190476   6.904761904761905    2.4153725339787755
      14            130.325               3.375           4.74015177441013
      15       231.7391304347826    5.521739130434782    2.665757305816136
      16       246.91304347826087   5.739130434782608    2.501934572988203
      17       191.35714285714286          5.0           3.2283105337812623
      18       233.91304347826087   5.739130434782608    2.6409826096654276
      19       218.2608695652174    5.3478260869565215   2.830375784860558
      20       261.5238095238095    6.571428571428571    2.362156933721778
      21       285.5263157894737           7.0           2.1635843907834102
      22       292.7894736842105           7.0           2.1099128743483737
      23       242.9047619047619    6.095238095238095    2.543220129386395
      24       200.2962962962963    4.777777777777778    3.084232167159764
      25       247.73529411764707   6.029411764705882    2.493630478451858

About

A Set Of Tools To Analyse F1 Sessions, Powered By The Fast F1 Library

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages