Skip to content

lspellman-opsguru/f1-data

Repository files navigation

F1 Driver Telemetry Analysis

A comprehensive Jupyter notebook for analyzing Formula 1 driver telemetry data using the FastF1 library. This project provides real-time F1 data access, visualization, and analysis capabilities.

🏎️ Features

  • Real F1 Data Access: Connect to official Formula 1 telemetry data using FastF1
  • Driver Analysis: Analyze individual driver performance and telemetry
  • Multiple Visualizations: Static (matplotlib) and interactive (plotly) charts
  • Driver Comparison: Compare performance between different drivers
  • Data Export: Export telemetry data to CSV for further analysis
  • Robust Error Handling: Gracefully handles missing telemetry data
  • Performance Optimized: Includes caching for faster data loading

📊 Available Data

Telemetry Data

  • Speed (km/h)
  • Throttle (%)
  • Brake (%)
  • Gear (when available)
  • RPM (when available)
  • Steering Angle
  • Distance (track position)

Timing Data

  • Lap Times
  • Sector Times
  • Pit Stop Times
  • Position Data

Additional Data

  • Weather Conditions
  • Tire Information
  • Track Layout

🚀 Quick Start

Prerequisites

  • Python 3.8+
  • Jupyter Notebook

Installation

  1. Clone the repository:

    git clone https://github.com/lspellman-opsguru/f1-data.git
    cd f1-data
  2. Install dependencies:

    pip install -r requirements.txt
  3. Launch Jupyter Notebook:

    jupyter notebook f1_telemetry_analysis.ipynb
  4. Run the cells to start analyzing F1 data!

📈 Usage

Basic Analysis

  1. Select a Race: Choose from available F1 races (2023-2024)
  2. Pick a Driver: Select a specific driver to analyze
  3. Get Telemetry: Extract detailed telemetry data for analysis
  4. Visualize: Create charts and graphs of driver performance

Example Code

import fastf1
import os

# Enable caching
os.makedirs('cache', exist_ok=True)
fastf1.Cache.enable_cache('cache')

# Load a race
race = fastf1.get_session(2024, 'Bahrain', 'R')
race.load()

# Get driver data
driver_laps = race.laps.pick_driver('VER')
fastest_lap = driver_laps.pick_fastest()
telemetry = fastest_lap.get_telemetry()

# Analyze speed profile
import matplotlib.pyplot as plt
plt.plot(telemetry['Distance'], telemetry['Speed'])
plt.title('Speed Profile')
plt.show()

📋 Notebook Sections

  1. Setup & Connection - Import libraries and connect to F1 data
  2. Race Selection - Choose race and driver
  3. Telemetry Extraction - Get detailed telemetry data
  4. Visualizations - Multiple chart types and analysis
  5. Advanced Analysis - Statistical summaries and correlations
  6. Driver Comparison - Compare multiple drivers
  7. Data Export - Save data for further analysis

🛠️ Dependencies

  • fastf1>=3.1.0 - F1 data access
  • pandas>=1.5.0 - Data manipulation
  • numpy>=1.21.0 - Numerical computing
  • matplotlib>=3.5.0 - Static plotting
  • seaborn>=0.11.0 - Statistical visualization
  • plotly>=5.0.0 - Interactive plotting
  • jupyter>=1.0.0 - Notebook environment

📊 Visualization Types

Static Charts (Matplotlib)

  • Speed profiles over distance
  • Throttle and brake input analysis
  • Lap time comparisons
  • Gear usage patterns

Interactive Charts (Plotly)

  • Multi-panel telemetry displays
  • Zoomable and hover-enabled charts
  • Dynamic data exploration

Analysis Types

  • Speed Analysis: Track speed variations and top speeds
  • Driving Style: Throttle/brake patterns and gear usage
  • Performance Comparison: Driver vs driver analysis
  • Statistical Summary: Key performance metrics

🔧 Configuration

Cache Settings

The notebook automatically creates a cache/ directory for storing downloaded F1 data. This improves performance by avoiding re-downloading the same data.

Data Availability

Different F1 sessions may have varying levels of telemetry data. The notebook handles missing data gracefully and will show available information.

📁 Project Structure

f1-data/
├── f1_telemetry_analysis.ipynb  # Main analysis notebook
├── requirements.txt             # Python dependencies
├── cache/                       # FastF1 data cache (auto-created)
└── README.md                    # This file

🎯 Use Cases

  • Performance Analysis: Understand driver performance patterns
  • Race Strategy: Analyze tire usage and pit stop strategies
  • Technical Analysis: Study car setup and driving techniques
  • Educational: Learn about F1 data analysis and visualization
  • Research: Use data for machine learning or statistical analysis

🤝 Contributing

Contributions are welcome! Feel free to:

  • Add new visualization types
  • Improve data analysis methods
  • Add support for additional F1 data sources
  • Enhance error handling
  • Add documentation

📝 License

This project is open source and available under the MIT License.

🔗 Links

📞 Contact


Happy Racing! 🏁

About

F1 Driver Telemetry Analysis using FastF1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published