diff --git a/fetch_data.ipynb b/fetch_data.ipynb index 9e77b79..5eaaf14 100644 --- a/fetch_data.ipynb +++ b/fetch_data.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 40, + "execution_count": 44, "id": "9a9714f8", "metadata": {}, "outputs": [ @@ -10,9 +10,13 @@ "name": "stderr", "output_type": "stream", "text": [ + "logger WARNING \tFailed to load schedule from FastF1 backend!\n", + "req INFO \tUsing cached data for season_schedule\n", + "req INFO \tUsing cached data for season_schedule\n", "core INFO \tLoading data for Italian Grand Prix - Race [v3.6.1]\n", "req INFO \tUsing cached data for session_info\n", "req INFO \tUsing cached data for driver_info\n", + "core INFO \tLoading data for Italian Grand Prix - Race [v3.6.1]\n", "req INFO \tUsing cached data for session_info\n", "req INFO \tUsing cached data for driver_info\n", "req INFO \tUsing cached data for session_status_data\n", @@ -33,28 +37,28 @@ "req INFO \tUsing cached data for position_data\n", "req INFO \tUsing cached data for weather_data\n", "req INFO \tUsing cached data for race_control_messages\n", - "core WARNING \tDriver 1 completed the race distance 06:25.888000 before the recorded end of the session.\n", - "core WARNING \tDriver 11 completed the race distance 06:19.824000 before the recorded end of the session.\n", "core WARNING \tDriver 55 completed the race distance 06:14.695000 before the recorded end of the session.\n", - "core WARNING \tDriver 16 completed the race distance 06:14.511000 before the recorded end of the session.\n", - "core WARNING \tDriver 63 completed the race distance 06:07.860000 before the recorded end of the session.\n", + "core WARNING \tDriver 4 completed the race distance 05:40.439000 before the recorded end of the session.\n", "core WARNING \tDriver 44 completed the race distance 05:48.209000 before the recorded end of the session.\n", + "core WARNING \tDriver 16 completed the race distance 06:14.511000 before the recorded end of the session.\n", + "core WARNING \tDriver 1 completed the race distance 06:25.888000 before the recorded end of the session.\n", "req INFO \tUsing cached data for weather_data\n", "req INFO \tUsing cached data for race_control_messages\n", + "core WARNING \tDriver 55 completed the race distance 06:14.695000 before the recorded end of the session.\n", + "core WARNING \tDriver 4 completed the race distance 05:40.439000 before the recorded end of the session.\n", + "core WARNING \tDriver 44 completed the race distance 05:48.209000 before the recorded end of the session.\n", + "core WARNING \tDriver 16 completed the race distance 06:14.511000 before the recorded end of the session.\n", "core WARNING \tDriver 1 completed the race distance 06:25.888000 before the recorded end of the session.\n", "core WARNING \tDriver 11 completed the race distance 06:19.824000 before the recorded end of the session.\n", - "core WARNING \tDriver 55 completed the race distance 06:14.695000 before the recorded end of the session.\n", - "core WARNING \tDriver 16 completed the race distance 06:14.511000 before the recorded end of the session.\n", + "core WARNING \tDriver 11 completed the race distance 06:19.824000 before the recorded end of the session.\n", + "core WARNING \tDriver 23 completed the race distance 05:40.782000 before the recorded end of the session.\n", + "core WARNING \tDriver 23 completed the race distance 05:40.782000 before the recorded end of the session.\n", + "core WARNING \tDriver 14 completed the race distance 05:39.594000 before the recorded end of the session.\n", "core WARNING \tDriver 63 completed the race distance 06:07.860000 before the recorded end of the session.\n", - "core WARNING \tDriver 44 completed the race distance 05:48.209000 before the recorded end of the session.\n", - "core WARNING \tDriver 23 completed the race distance 05:40.782000 before the recorded end of the session.\n", - "core WARNING \tDriver 4 completed the race distance 05:40.439000 before the recorded end of the session.\n", "core WARNING \tDriver 14 completed the race distance 05:39.594000 before the recorded end of the session.\n", - "core WARNING \tDriver 23 completed the race distance 05:40.782000 before the recorded end of the session.\n", - "core WARNING \tDriver 4 completed the race distance 05:40.439000 before the recorded end of the session.\n", - "core WARNING \tDriver 14 completed the race distance 05:39.594000 before the recorded end of the session.\n", - "core INFO \tFinished loading data for 20 drivers: ['1', '11', '55', '16', '63', '44', '23', '4', '14', '77', '40', '81', '2', '24', '10', '18', '27', '20', '31', '22']\n", - "core INFO \tFinished loading data for 20 drivers: ['1', '11', '55', '16', '63', '44', '23', '4', '14', '77', '40', '81', '2', '24', '10', '18', '27', '20', '31', '22']\n" + "core WARNING \tDriver 63 completed the race distance 06:07.860000 before the recorded end of the session.\n", + "core INFO \tFinished loading data for 20 drivers: ['55', '4', '44', '16', '1', '10', '81', '11', '40', '20', '23', '24', '27', '2', '14', '63', '77', '31', '22', '18']\n", + "core INFO \tFinished loading data for 20 drivers: ['55', '4', '44', '16', '1', '10', '81', '11', '40', '20', '23', '24', '27', '2', '14', '63', '77', '31', '22', '18']\n" ] }, { @@ -261,7 +265,7 @@ "9 MEDIUM 1.0 42.5 False " ] }, - "execution_count": 40, + "execution_count": 44, "metadata": {}, "output_type": "execute_result" } @@ -353,7 +357,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 45, "id": "45d27f05", "metadata": {}, "outputs": [ @@ -517,7 +521,7 @@ "max 100.000000 33.000000 44.400000 " ] }, - "execution_count": 41, + "execution_count": 45, "metadata": {}, "output_type": "execute_result" } @@ -534,17 +538,17 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 46, "id": "2fbcd2f9", "metadata": {}, "outputs": [], "source": [ - "final_df.to_csv(\"ALONSO_2023_MONZA_RACE\")" + "final_df.to_csv(\"ALONSO_2023_MONZA_RACE.csv\")" ] }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 47, "id": "729fb12e", "metadata": {}, "outputs": [ diff --git a/ALONSO_2023_MONZA_RACE b/scripts/ALONSO_2023_MONZA_RACE.csv similarity index 100% rename from ALONSO_2023_MONZA_RACE rename to scripts/ALONSO_2023_MONZA_RACE.csv diff --git a/scripts/simulate_pi_stream.py b/scripts/simulate_pi_stream.py index 601e3a5..5ffa52b 100644 --- a/scripts/simulate_pi_stream.py +++ b/scripts/simulate_pi_stream.py @@ -164,8 +164,6 @@ def main(): parser = argparse.ArgumentParser( description="Simulate Raspberry Pi telemetry streaming from CSV data" ) - parser.add_argument("--data", type=str, default="ALONSO_2023_MONZA_RACE", - help="Path to telemetry CSV file") parser.add_argument("--endpoint", type=str, default="http://localhost:8000/telemetry", help="HPC API endpoint") parser.add_argument("--speed", type=float, default=1.0, @@ -176,12 +174,9 @@ def main(): args = parser.parse_args() try: - # Handle relative paths from the project root - data_path = Path(args.data) - if not data_path.is_absolute(): - # Try relative to script location first - script_dir = Path(__file__).parent.parent - data_path = script_dir / args.data + # Hardcoded CSV file location in the same folder as this script + script_dir = Path(__file__).parent + data_path = script_dir / "ALONSO_2023_MONZA_RACE.csv" df = load_telemetry_csv(data_path) simulate_stream( @@ -192,8 +187,8 @@ def main(): args.end_lap ) except FileNotFoundError: - print(f"❌ File not found: {args.data}") - print(f" Tried: {data_path}") + print(f"❌ File not found: {data_path}") + print(f" Make sure ALONSO_2023_MONZA_RACE.csv is in the scripts/ folder") sys.exit(1) except Exception as e: print(f"❌ Error: {e}")