Practice long runs

Guides

Practice long runs

Split a practice session into runs, tell long runs from qualifying simulations, and read long-run pace.

A practice session is not one thing. In an hour a team runs a low-fuel qualifying simulation, one or two high-fuel long runs, aero tests and a lot of laps that are neither. Averaging all of it gives a number that describes nothing.

The paddock reads practice by splitting it into runs — stretches of consecutive laps between visits to the pits — and treating two kinds very differently: a qualifying simulation predicts Saturday, a long run predicts Sunday. lapbox.practice does that split. The examples use FP2 at Monza 2025.

Runs

Python
import fastf1
from lapbox.practice import detect_runs

session = fastf1.get_session(2025, "Monza", "FP2")
session.load(telemetry=False, weather=False, messages=False)

runs = detect_runs(session.laps)
run = runs[0]
print(len(runs), run.driver, run.compound, run.start_lap, run.end_lap, run.length)
Output
102 ALB MEDIUM 2 3 2

A run breaks at an untimed lap (an in-lap, out-lap or aborted attempt), at a gap in the lap numbers (the car pitted), and at a change of compound or stint. Each Run holds the driver, compound, first and last lap and the lap times.

Long runs and qualifying simulations

Python
from collections import Counter

from lapbox.practice import session_runs

by_driver = session_runs(session.laps)
print(Counter(kind for runs in by_driver.values() for _, kind in runs))
Output
Counter({'quali_sim': 46, 'other': 37, 'long_run': 19})

session_runs classifies every run with classify_run:

  • long_run: at least five laps at race pace — within 107 % of the run’s best. Five timed laps are not enough: a qualifying run with its out-lap and cool-down laps is five consecutive timed laps, only one or two of them at pace.
  • quali_sim: at most three laps, the best within 2 % of the driver’s best of the session. Short alone isn’t enough; an aborted long run is short too.
  • other: everything else.

Long-run pace

long_run_pace reads one long run: its median, its degradation slope and its spread. The five quickest long runs of the session:

Python
from lapbox.practice import long_run_pace

paces = [
    long_run_pace(run)
    for runs in by_driver.values()
    for run, kind in runs
    if kind == "long_run"
]
for p in sorted(paces, key=lambda p: p.median_s)[:5]:
    print(f"{p.driver} {p.compound:<6} {p.laps:>2} laps  {p.median_s:.3f} s  deg {p.deg_slope_s_per_lap:+.3f} s/lap")
Output
NOR MEDIUM 11 laps  83.616 s  deg -0.004 s/lap
VER MEDIUM 10 laps  83.688 s  deg +0.008 s/lap
PIA MEDIUM  9 laps  83.956 s  deg -0.032 s/lap
LEC SOFT    7 laps  84.025 s  deg -0.175 s/lap
RUS HARD    9 laps  84.034 s  deg -0.154 s/lap

What the slope means

Python
nor = min((p for p in paces if p.driver == "NOR"), key=lambda p: p.median_s)
print(f"raw {nor.raw_slope_s_per_lap:+.3f}, with fuel added back {nor.deg_slope_s_per_lap:+.3f} s/lap")
print(f"spread {nor.consistency_s:.3f} s, {nor.laps_dropped} laps dropped")
Output
raw -0.052, with fuel added back -0.004 s/lap
spread 0.283 s, 1 laps dropped

Over a run the car gets lighter while the tyres wear, and the two pull lap times in opposite directions. The raw slope is wear minus fuel; adding the fuel effect back (0.048 s/lap, FUEL_EFFECT_S_PER_LAP) gives the tyre’s own trend. Laps over 107 % of the run’s best — a cruised lap, traffic — are dropped first, and the rest keep their positions so the slope stays per lap.

A slope can still be negative, as here: track evolution and the driver building up make the car quicker through the run. That is the car getting quicker, not the tyres getting younger, and the assumed fuel effect is the same for every car.

Does the session have a long run?

A wet or disrupted session may contain no long run at all. longest_run_length counts laps the way classify_run does, so the check is exact:

Python
from lapbox.practice import MIN_LONG_RUN, longest_run_length

print(longest_run_length(session.laps), longest_run_length(session.laps) >= MIN_LONG_RUN)
Output
13 True

Counting timed laps instead would have passed 6 of 145 practice sessions (2022–2026) that had no long run in them.

These docs describe lapbox 0.1.0. Something wrong or missing? Open an issue.