Skip to main content

A high-level framework for sports data analysis

Project description

floodlight

Latest Version Python Version Documentation Status Build Status Linting Status Codecov DOI

A high-level, data-driven sports analytics framework

floodlight is a Python package for streamlined analysis of sports data. It is designed with a clear focus on scientific computing and built upon popular libraries such as numpy or pandas.

Load, integrate, and process tracking and event data, codes and other match-related information from major data providers. This package provides a set of standardized data objects to structure and handle sports data, together with a suite of common processing operations such as transforms or data manipulation methods.

All implementations run completely provider- and sports-independent, while maintaining a maximum of flexibility to incorporate as many data flavours as possible. A high-level interface allows easy access to all standard routines, so that you can stop worrying about data wrangling and start focussing on the analysis instead!



Quick Demo

floodlight simplifies sports data loading, processing and advanced performance analyses. Check out the example below, where querying a public data sample, filtering the data and computing the expended metabolic work of the active home team players is done in a few lines of code:

>>> from floodlight.io.datasets import EIGDDataset
>>> from floodlight.transforms.filter import butterworth_lowpass
>>> from floodlight.models.kinetics import MetabolicPowerModel

>>> dataset = EIGDDataset()
>>> home_team_data, away_team_data, ball_data = dataset.get()

>>> home_team_data = butterworth_lowpass(home_team_data)

>>> model = MetabolicPowerModel()
>>> model.fit(home_team_data)
>>> metabolic_power = model.cumulative_metabolic_power()

>>> print(metabolic_power[-1, 0:7])

[1669.18781115 1536.22481121 1461.03243489 1488.61249785  773.09264071
 1645.01702421  746.94057676]

To find out more, see the full set of features below or get started quickly with one of our many tutorials from the official documentation!

Features

We provide core data structures for team sports data, parsing functionality for major data providers, access points to public data sets, data filtering, plotting routines and many computational models from the literature. The feature set is constantly expanding, and if you want to add more just open an issue!

Data-level Objects

  • Tracking data
  • Event data
  • Pitch information
  • Teamsheets with player information
  • Codes such as ball possession information
  • Properties such as distances or advanced computations

Parser

  • Tracab/ChyronHego: Tracking data, Teamsheets, Codes
  • DFL/STS: Tracking data, Event data, Teamsheets, Codes
  • Kinexon: Tracking data
  • Opta: Event data (F24 feeds)
  • Second Spectrum: Tracking data, Event data
  • Skillcorner: Tracking data from the Skillcorner Open Dataset (new)
  • Sportradar: Event data
  • StatsPerform: Tracking data, Event data (with URL access)
  • StatsBomb: Event data

Datasets

  • EIGD-H (Handball tracking data)
  • IDSSE (Football tracking and event data) (new)
  • StatsBomb OpenData (Football event data)

Manipulation and Plotting

  • Spatial transformations for all data structures
  • Lowpass-filter tracking data
  • Slicing, selection and sequencing methods
  • Plot pitches, player positions and model overlays

Models and Metrics

  • Approximate Entropy
  • Centroids
  • Distances, Velocities & Accelerations
  • Metabolic Power & Equivalent Distances
  • Voronoi Space Control

Installation

The package can be installed easily via pip:

pip install floodlight

Documentation

You can find all documentation here.

Contributing

Contributions Code style: black

Check out Contributing.md for a quick rundown of what you need to know to get started. We also provide an extended, beginner-friendly guide on how to start contributing in our documentation.

Citing

If you've used floodlight in your scientific work, please cite the corresponding paper.

@article{Raabe2022,
    doi = {10.21105/joss.04588},
    url = {https://doi.org/10.21105/joss.04588},
    year = {2022},
    publisher = {The Open Journal},
    volume = {7},
    number = {76},
    pages = {4588},
    author = {Dominik Raabe and Henrik Biermann and Manuel Bassek and Martin Wohlan and Rumena Komitova
              and Robert Rein and Tobias Kuppens Groot and Daniel Memmert},
    title = {floodlight - A high-level, data-driven sports analytics framework},
    journal = {Journal of Open Source Software}
}

Why

Why do we need another package that introduces its own data structures and ways of dealing with certain problems? And what's the purpose of trying to integrate all different data sources and fit them into a single framework? Especially since there already exist packages that aim to solve certain parts of that pipeline?

Our answer is - although we love those packages out there - that we did not find a solution that did fit our needs. Available packages are either tightly connected to a certain data format/provider, adapt to the subtleties of a particular sport, or solve one particular problem. This still left us with the essential problem of adapting to different interfaces.

We felt that as long as there is no underlying, high-level framework, each and every use case again and again needs its own implementation. At last, we found ourselves refactoring the same code - and there are certain data processing or plotting routines that are required in almost every project - over and over again just to fit the particular data structures we're dealing with at that time.

About

This project has been kindly supported by the Institute of Exercise Training and Sport Informatics at the German Sport University Cologne under supervision of Prof. Daniel Memmert.

Related Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

floodlight-0.5.0.tar.gz (92.1 kB view details)

Uploaded Source

Built Distribution

floodlight-0.5.0-py3-none-any.whl (112.6 kB view details)

Uploaded Python 3

File details

Details for the file floodlight-0.5.0.tar.gz.

File metadata

  • Download URL: floodlight-0.5.0.tar.gz
  • Upload date:
  • Size: 92.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Windows/10

File hashes

Hashes for floodlight-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5f5f85cd93baa84cc7b0da0e6ff7360e9dc7ef85c82318b464fbf07779f5e716
MD5 f79e9cb4ac1d60758bbe5312f3166d6e
BLAKE2b-256 d4753ea90bde94ea8b75d24ab6194b4bbf2469b92f980a38b9d8482327cf3178

See more details on using hashes here.

File details

Details for the file floodlight-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: floodlight-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 112.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Windows/10

File hashes

Hashes for floodlight-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad0e30013f5a336d94996cfa2006c8ff376d77db573a8b37a4cea4f5b90464f0
MD5 9f01535c2fb031fa0a2c309914612d2e
BLAKE2b-256 c6a3a288be144ddf65f9a591a16deeea7d0d8c0836e30a3749f0f0a065eb87af

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page