Giter Club home page Giter Club logo

databallpy's Introduction

Logo

Latest Version Python Version Documentation Status CI/CD Status Codecov

DataBallPy

A package for loading, synchronizing, and analyzing your soccer event- and tracking data.

This package is developed to create a standardized way to analyse soccer matches using both event- and tracking data. Other packages, like kloppy and floodlight, already standardize the import of data sources. The current package goes a step further in combining different data streams from the same match. In this case, the Match object combines information from the event and tracking data. The main feature is the smart synchronization of the tracking and event data. We utilize the Needleman-Wunch algorithm, inspired by this article, to align the tracking and even data, while ensuring the order of the events, something that is not done when only using (different) cost functions.

V0.4.3 (15/1/2024)

  • Added simple expected goals (xG) model
  • Added anonimisation function
  • Added pitch control model
  • Fixed minor bugs
  • Added logging possibilities
  • Refactor of file structure and folder naming

Planned changes

  • Adding different filters to filter the tracking data
  • Adding more features (if you have any ideas/requests, please open an issue!)
  • Creating more databallpy events
  • Adding expected passing and goals models

Installation

$ pip install databallpy

Usage

The package is centered around the Match object. A Match has tracking data, event data metadata about the match. For a more elaborate example, see the example file.

$ from databallpy import get_match, get_open_match
$
$ match = get_match(
$   tracking_data_loc="../data/tracking_data.dat",
$   tracking_metadata_loc="../data/tracking_metadata.xml",
$   tracking_data_provider="tracab"
$   event_data_loc="../data/event_data_f24.xml",
$   event_metadata_loc="../data/event_metadata_f7.xml",
$   event_data_provider="opta",
$ )
$
$ # or to load an open metrica dataset of tracking and event data
$ match = get_open_match()
$
$ match.home_team_name # the team name of the home playing team
$ match.away_players # pandas dataframe with the names, ids, shirt numbers and positions of the away team
$ match.tracking_data # pandas dataframe with tracking data of the match
$ match.event_data # pandas dataframe with event data of the match

See the documentation of the Match object and the example usage for more options. Note that this package is developed to combine event and tracking data, for now both datastreams are necessary to create a Match object.

Synchronization of tracking and event data

Tracking and event data is often poorly synchronized. For instance, when taking the event data of Opta and tracking data of Tracab, you can sync the fist frame with the kick-off pass. Now you can sync the other events with the tracking data based on the time difference between the event and the kick off pass. If you do this, how get something like this:

not_synced.mp4

As you can see, the timing (and placing) of the events do not correspond good with the tracking data locations, especially when events follow up quickly or around shots. Using the methodology of [this][soccer-synch-url] article, this package is able to synchronize tracking and event data using the Needleman-Wunsch algorithm.

After running the following command, the events are better synchronized to the tracking data:

$ match.synchronise_tracking_and_event_data()
synced.mp4

Documentation

The official documentation can be found here.

Providers

For now we limited providers. We are planning on adding more providers later on.

Event data providers:

  • Opta
  • Metrica
  • Instat

Tracking data providers:

  • Tracab
  • Metrica
  • Inmotio

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

Maintainers & owners

Contributors

License

databallpy was created by Alexander Oonk & Daan Grob. It is licensed under the terms of the MIT license.

Similar projects

Although we think this package helps when starting to analyse soccer data, other packages may be better suited for your specific needs. Make sure to check out the following packages as well:

And for a more specific toturials on how to get started with soccer data"

databallpy's People

Contributors

alek050 avatar daangro avatar rdghe avatar swopper050 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.