/SoccerAnalyzer

This repository contain the common structure and tools required to develop statistical analysis related to VSS, SSL and 2D Simulation.

Primary LanguagePythonMIT LicenseMIT

RobôCIn Soccer Analyzer

Description

This is a Python package created by the members of RobôCIn robotics team from the Informatics Centre of the Federal University of Pernambuco, CIn - UFPE. It's purpose is to provide a building block for data science inside the 2D Simulation, Very Small Size Soccer(VSS) and Small Size League (SSL) environments using logfiles generated by each of the categories.

Table of contents

Dependencies

This project was created with:

  • Python 3.10.x or above
    • Used to create common classes, structures and algorithms that provides analysis.
  • Pandas 1.2.4 or above
    • Provides a simple structure to manipulate all the data gathered.
  • Numpy 1.20.3 or above
  • Matplotlib 3.5 or above
  • Seaborn 0.11.2 or above

Setup

You can install this project as Python package through pip or via git. We highly recommend you to install SoccerAnalyzer in a miniconda environment using our requirements.txt file.

$ conda create --name analyzer python>=3.10
$ conda activate analyzer

Via github (with miniconda environment)

$ git clone git@github.com:robocin/SoccerAnalyzer.git
$ cd SoccerAnalyzer
$ pip install requirements.txt
$ pip install .

Via pip (with miniconda environment)

$ pip install socceranalyzer

Getting Started

This package is capable of delivering built-in analysis that were already created or to be a platform that enables you to create your own analysis.

Using as analyzer

How it works?

Each analysis is a class, they are instantiated and interfaced by a Facade which is the common.chore.match_analyzer module. It is responsible for creating each analysis object.

When an analysis is instantiated, it builds itself and gathers everything needed to provide the analysis. All information is stored and can be accessed through the Facade targeting specific analysis with MatchAnalyzer.example_analysis.results().

The MatchAnalyzer receives a Match object as parameter.

The Match receives a pandas.DataFrame and a Category object as parameter.

These inputs are mandatory, otherwise there will be no data to be analyzed.

2D Simulation code example
import pandas as pd

from socceranalyzer import MatchAnalyzer, Match, SIM2D

SIM2D_LOGFILE_PATH = "location/to/log/file2d.csv"
dataframe = pd.read_csv(SIM2D_LOGFILE_PATH)

match_object = Match(dataframe, SIM2D)
match_analyzer = MatchAnalyzer(match_object)
match_analyzer.collect_results()
SSL
import pandas as pd

from socceranalyzer import MatchAnalyzer, Match, SSL

SSL_LOGFILE_PATH = "location/to/log/filessl.csv"
dataframe = pd.read_csv(SSL_LOGFILE_PATH)

match_object = Match(dataframe, SSL)
match_analyzer = MatchAnalyzer(match_object)
match_analyzer.collect_results()

VSS

Not available yet


2021, RobôCIn