Git Product home page Git Product logo

f1stats's Introduction

f1stats

Formula 1 driver comparison and race analyzing tool. f1stats uses Fast-F1 core for race and driver analysis. The Fast-F1 core is a collection of functions and data objects for accessing and analyzing F1 timing and telemetry data.

ezgif com-gif-maker (3)

Setup

Use the package manager pip to install libraries.

pip install fastf1 
pip install matplotlib
pip install numpy
pip install pandas

Usage

Example plots. For example, if you want to compare Bottas and Hamilton.

driver1 = 'BOT' 
driver2 = 'HAM'

You can also choose all other drivers.

# 2020 season
D_LOOKUP = [[44, 'HAM', 'Mercedes'], [77, 'BOT', 'Mercedes'],
            [55, 'SAI', 'Ferrari'], [16, 'LEC', 'Ferrari'],
            [33, 'VER', 'Red Bull'], [11, 'PER', 'Red Bull'],
            [3, 'RIC', 'McLaren'], [4, 'NOR', 'McLaren'],
            [5, 'VET', 'Aston Martin'], [18, 'STR', 'Aston Martin'],
            [14, 'ALO', 'Alpine'], [31, 'OCO', 'Alpine'],
            [22, 'TSU', 'AlphaTauri'], [10, 'GAS', 'AlphaTauri'],
            [47, 'MSC', 'Haas F1 Team'], [9, 'MAZ', 'Haas F1 Team'],
            [7, 'RAI', 'Alfa Romeo'], [99, 'GIO', 'Alfa Romeo'],
            [6, 'LAT', 'Williams'], [63, 'RUS', 'Williams']]

The Fast-F1 developer recommends using cache. From this document:

It is not necessary to enable the usage of the cache, but it is highly recommended. Simply provide the path to some empty folder on your system. Using the cache will greatly speed up loading of the data.

ff1.Cache.enable_cache(r'path/to/folder/for/cache') # Replace with your cache directory

A fuzzy match is performed to find the most likely event for the provided name (e.g. 'Bahrain').

race = ff1.get_session(2021, 'Zandvoort', 'R')  # 'FP1', 'FP2', 'FP3', 'Q', 'SQ' or 'R'
# FP1 : Free Practice 1
# FP2 : Free Practice 2
# FP3 : Free Practice 3
# Q   : Qualifying
# SQ  : Sprint Qualifying
# R   : Race

Functions

def track():  # Track layout - Fastest Lap Gear Shift Visualization
def gas(): # Car telemetry data ['RPM', 'Speed', 'Throttle', 'Brake', 'nGear', 'DRS']
def compare():  # Two drivers comparison
def qualifying():  # Fastest lap

Compatibility

Data is available for the 2018 to 2023 seasons. Fast-F1 uses data from F1's live timing service.

Screenshots

fastest

qualy

racelaps

telemetrycomp

Contributing

Pull requests are welcome. Before PR please open an issue what you would like to change. Follow PEP 8 Coding Style guidelines.

f1stats's People

Contributors

arabacibahadir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.