Issue pulling data for some sessions #347
Replies: 3 comments 4 replies
-
I'm having the same issue too, even with simpler code below. Something's up with the syntax for calling the data...
This is the key part of the output for me:
|
Beta Was this translation helpful? Give feedback.
-
I tried even following this: https://theoehrly.github.io/Fast-F1/examples/index.html#example-plot
I am getting the following output |
Beta Was this translation helpful? Give feedback.
-
OK well.... I checked my Jupyter Notebook version and saw it was on v6.5.2, and not the latest v6.5.3. Apparently the v0.0.1 made all the difference:
Formatted Code:
|
Beta Was this translation helpful? Give feedback.
-
Hi,
Having an issue where when I try to pull data for some sessions, I get the below error message. It only happens for some sessions, with the script I'm using working perfectly for some sessions. For instance below I am trying to pull qualifying data for the Russian Grand Prix Qualifying 2021. If I try for the 2019 Spanish Grand Prix qualifying for instance it works. I'm new to fastf1 and have just started learning it I'm very confused . Any ideas on what may the issue please? I have updated fastf1 to the latest version and am using python 3.8.
I saw someone else have an issue in these discussions where no data could be pulled by this issue appears to just apply to the lap and telemetry data on some sessions.
Error:
core INFO Loading data for Russian Grand Prix - Qualifying [v2.3.1]
api INFO Using cached data for driver_info
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
core WARNING Failed to load lap data!
api INFO Using cached data for car_data
api INFO Using cached data for position_data
core WARNING Failed to load telemetry data!
api INFO Using cached data for weather_data
api INFO Using cached data for race_control_messages
core INFO Finished loading data for 20 drivers: ['4', '55', '63', '44', '3', '14', '77', '18', '11', '31', '5', '10', '22', '6', '16', '7', '47', '99', '9', '33']
Traceback (most recent call last):
File "/Users/laurencehearne/Library/Mobile Documents/com
appleCloudDocs/College/FYP/Phyton_Learning/Pycharm/venv/TememtryExample.py", line 27, inlaps_driver_1 = quali.laps.pick_driver(driver_1)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/fastf1/core.py", line 1052, in laps
return self._get_property_warn_not_loaded('_laps')
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/fastf1/core.py", line 1017, in _get_property_warn_not_loaded
raise DataNotLoadedError("The data you are trying to access has not "
fastf1.core.DataNotLoadedError: The data you are trying to access has not been loaded yet. See
Session.load
my Code:
import fastf1 as ff1
from fastf1 import plotting
from fastf1 import utils
from matplotlib import pyplot as plt
from matplotlib.pyplot import figure
import numpy as np
import pandas as pd
ff1.Cache.enable_cache('/Users/laurencehearne/Library/Mobile Documents/com
appleCloudDocs/College/FYP/Phyton_Learning/FastF1/') # replace with your cache directorySetup plotting
plotting.setup_mpl()
year, grand_prix, session = 2021, 'RUSSIA', 'Q'
quali = ff1.get_session(year, grand_prix, session)
quali.load() # This is new with Fastf1 v.2.2
This is how it used to be:
laps = quali.load_laps(with_telemetry=True)
driver_1, driver_2 = 'HAM', 'NOR'
Laps can now be accessed through the .laps object coming from the session
laps_driver_1 = quali.laps.pick_driver(driver_1)
laps_driver_2 = quali.laps.pick_driver(driver_2)
Select the fastest lap
fastest_driver_1 = laps_driver_1.pick_fastest()
fastest_driver_2 = laps_driver_2.pick_fastest()
Retrieve the telemetry and add the distance column
telemetry_driver_1 = fastest_driver_1.get_telemetry().add_distance()
telemetry_driver_2 = fastest_driver_2.get_telemetry().add_distance()
Make sure whe know the team name for coloring
team_driver_1 = fastest_driver_1['Team']
team_driver_2 = fastest_driver_2['Team']
Extract the delta time
delta_time, ref_tel, compare_tel = utils.delta_time(fastest_driver_1, fastest_driver_2)
plot_size = [15, 15]
plot_title = f"{quali.event.year} {quali.event.EventName} - {quali.name} - {driver_1} VS {driver_2}"
plot_ratios = [1, 3, 2, 1, 1, 2, 1]
plot_filename = plot_title.replace(" ", "") + ".png"
Make plot a bit bigger
plt.rcParams['figure.figsize'] = plot_size
Create subplots with different sizes
fig, ax = plt.subplots(7, gridspec_kw={'height_ratios': plot_ratios})
Set the plot title
ax[0].title.set_text(plot_title)
Delta line
ax[0].plot(ref_tel['Distance'], delta_time)
ax[0].axhline(0)
ax[0].set(ylabel=f"Gap to {driver_2} (s)")
Speed trace
ax[1].plot(telemetry_driver_1['Distance'], telemetry_driver_1['Speed'], label=driver_1,
color=ff1.plotting.team_color(team_driver_1))
ax[1].plot(telemetry_driver_2['Distance'], telemetry_driver_2['Speed'], label=driver_2,
color=ff1.plotting.team_color(team_driver_2))
ax[1].set(ylabel='Speed')
ax[1].legend(loc="lower right")
Throttle trace
ax[2].plot(telemetry_driver_1['Distance'], telemetry_driver_1['Throttle'], label=driver_1,
color=ff1.plotting.team_color(team_driver_1))
ax[2].plot(telemetry_driver_2['Distance'], telemetry_driver_2['Throttle'], label=driver_2,
color=ff1.plotting.team_color(team_driver_2))
ax[2].set(ylabel='Throttle')
Brake trace
ax[3].plot(telemetry_driver_1['Distance'], telemetry_driver_1['Brake'], label=driver_1,
color=ff1.plotting.team_color(team_driver_1))
ax[3].plot(telemetry_driver_2['Distance'], telemetry_driver_2['Brake'], label=driver_2,
color=ff1.plotting.team_color(team_driver_2))
ax[3].set(ylabel='Brake')
Gear trace
ax[4].plot(telemetry_driver_1['Distance'], telemetry_driver_1['nGear'], label=driver_1,
color=ff1.plotting.team_color(team_driver_1))
ax[4].plot(telemetry_driver_2['Distance'], telemetry_driver_2['nGear'], label=driver_2,
color=ff1.plotting.team_color(team_driver_2))
ax[4].set(ylabel='Gear')
RPM trace
ax[5].plot(telemetry_driver_1['Distance'], telemetry_driver_1['RPM'], label=driver_1,
color=ff1.plotting.team_color(team_driver_1))
ax[5].plot(telemetry_driver_2['Distance'], telemetry_driver_2['RPM'], label=driver_2,
color=ff1.plotting.team_color(team_driver_2))
ax[5].set(ylabel='RPM')
DRS trace
ax[6].plot(telemetry_driver_1['Distance'], telemetry_driver_1['DRS'], label=driver_1,
color=ff1.plotting.team_color(team_driver_1))
ax[6].plot(telemetry_driver_2['Distance'], telemetry_driver_2['DRS'], label=driver_2,
color=ff1.plotting.team_color(team_driver_2))
ax[6].set(ylabel='DRS')
ax[6].set(xlabel='Lap distance (meters)')
Hide x labels and tick labels for top plots and y ticks for right plots.
for a in ax.flat:
a.label_outer()
Store figure
plt.savefig(plot_filename, dpi=300)
plt.show()
Beta Was this translation helpful? Give feedback.
All reactions