Skip to content

Incorrect stint information for Drivers in the following years:- 2018, 2019, 2020 #841

@NihaalNO

Description

@NihaalNO

Incorrect stint information for Drivers in the following years:- 2018, 2019, 2020

Note that this error doesnt occur directly on this repository but occurs while fetching some of the telemetry data from the FastF1 python package

The Fastf1 python package only covers Grand prix between the 2018-present, assuming that due to some mismatch in the telemetry data during the starting years of coverage while plotting the graph for drivers several conclusions can be drawn :-

  1. Driver uses only Single Tyre Compound during the whole race
  2. Soft Tyres which generally last for 5-15 laps are shown to last 20-30 laps
  3. Medium Tyres which generally last for 15-30 laps are shown to last the whole race of 50-60 laps

Case Studies :-

1. 2018 Abu Dhabi Grand Prix

Image

2. Belgian Grand Prix 2020

Image

3. Belgian Grand Prix 2018

Image

For more information on how the graph is plotted you can refer the below code or you can visit my repository:[Github]

Reproduce the code example:

# Get finishing order
finishing_order = session.results.sort_values('Position')['Abbreviation'].tolist()
drivers = finishing_order[::-1]  # P1 at bottom

results = session.results
dnf_drivers = session.results[
    (session.results['Position'].isna()) |
    (session.results['Status'].str.contains('Oil leak|Water pressure|Power Unit|Suspension|Brakes|Collision|Accident|Engine|Retired|Gearbox', na=False))
]['Abbreviation'].tolist()


y_positions = {driver: i for i, driver in enumerate(drivers)}

fig, ax = plt.subplots(figsize=(14,10))

for driver in drivers:
    driver_laps = laps[laps['Driver'] == driver]
    stints = driver_laps.groupby('Stint')

    alpha = 0.35 if driver in dnf_drivers else 1.0
    y = y_positions[driver]

    for stint, data in stints:
        compound = data['Compound'].mode()[0]
        width = data['LapNumber'].max() - data['LapNumber'].min() + 1

        ax.barh(
            y,
            width,
            left=data['LapNumber'].min(),
            color=COMPOUND_COLORS.get(compound, '#AAAAAA'),
            alpha=alpha
        )

    # Pit stop markers
    pit_laps = driver_laps.loc[
        driver_laps['Stint'].diff() == 1, 'LapNumber'
    ]

    for lap in pit_laps:
        ax.plot(lap, y, marker='o', color='black', markersize=3, zorder=6)
        ax.vlines(
            lap,
            y - 0.4,
            y + 0.4,
            colors='black',
            linestyles='dashed',
            linewidth=1.5,
            alpha=0.8,
            zorder=5
        )

# Fix y-axis labels
ax.set_yticks(range(len(drivers)))
ax.set_yticklabels(drivers)

ax.set_xlabel("Lap Number")
ax.set_ylabel("Driver")
ax.set_title("Race Strategy Visualization")
plt.grid(axis='x', linestyle='--', alpha=0.4)
plt.show()

Error message:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions