Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚽ Interactive Pitch Control & Team Influence Analysis

A powerful tool for analyzing football match data with dual visualization comparing traditional pitch control vs. distance-based team influence zones.

🚀 Quick Start

  1. Launch the application: python interactive_gui.py
  2. Load match data: Select tracking and event data files
  3. Choose event: Pick any match event from the dropdown
  4. Analyze: Click "Analyze" to see side-by-side comparison
  5. Experiment: Adjust parameters in real-time with auto-update

🎯 Key Features

Dual Analysis Engine

  • Traditional Pitch Control (Left Panel): Metrica Sports framework using player velocities and reaction times
  • Team Influence Zones (Right Panel): Distance-based exponential decay model with competitive territorial mapping

Advanced Parameters

  • Elliptical Influence Zones: Player-direction oriented zones instead of circles
  • Infinite Radius Mode: Field-wide influence coverage
  • Disable Closest Player: Turn off automatic assignment for uncontrolled areas
  • Real-time Updates: Auto-refresh visualizations as you adjust parameters

� Prerequisites

  • Python 3.8+
  • Required packages: numpy, pandas, matplotlib, tkinter
  • Data format: FIFA tracking data (CSV) + event data (JSON)

⚡ Installation

# Install dependencies
pip install -r requirements.txt

# Launch the application
python interactive_gui.py

🎮 How to Use

1. Data Loading

  • Tracking Data: Load CSV files with player positions (Home_[player]_x, Home_[player]_y)
  • Event Data: Load JSON files with match events and timestamps

2. Parameter Controls

  • Radius (1-50m): Distance cutoff for influence zones
  • Decay Factor (0.1-20.0): How quickly influence decreases with distance
  • Elliptical Zones: Orient influence based on player movement direction
  • Ellipse Ratio (1.0-5.0): Forward/backward influence ratio
  • Forward Shift (0.0-1.0): How much to shift influence center forward

3. Special Options

  • ☑️ Infinite Radius: Cover entire field (ignores radius setting)
  • ☑️ Disable Closest Player: Don't assign uncontrolled pixels to nearest player
  • ☑️ Auto-update: Refresh visualization when parameters change

📁 Repository Structure

📁 Pitch control+distance/
├── 🎯 interactive_gui.py           # MAIN APPLICATION - Launch this!
├── ⚙️ team_influence_analysis.py  # Core influence calculation engine
├── 🔧 data_converter.py           # FIFA data format converter
├── 📊 LaurieOnTracking/           # Metrica pitch control framework
├── 📂 match_data/                # Sample tracking data
├── 📂 Event Data.../              # Sample event data
├── 📋 requirements.txt           # Python dependencies
└── 📖 README.md                  # This documentation

🔧 Core Algorithm

Team Influence Model

# Distance-based exponential decay
influence = exp(-decay_factor * (distance / max_radius))

# Elliptical enhancement
if use_elliptical:
    distance = elliptical_distance(player_direction, ellipse_ratio)

# Competitive assignment
controlling_team = argmax([home_influence, away_influence])

Parameter Ranges

  • Radius: 1-50m (or infinite for field-wide coverage)
  • Decay: 0.1-20.0 (higher = sharper boundaries)
  • Ellipse Ratio: 1.0-5.0 (forward influence extension)
  • Forward Shift: 0.0-1.0 (ellipse center displacement)

🏀 Data Format

Tracking Data (CSV)

  • Player positions: Home_[player]_x, Home_[player]_y
  • Time synchronized with event data
  • Metric coordinates (meters)

Event Data (JSON)

  • Event types, timestamps, positions
  • Frame synchronization with tracking data
  • FIFA standard format

🔧 Technical Details

  • Distance Calculation: Euclidean distance from players to grid points
  • Influence Model: Exponential decay within max radius, zero beyond
  • Competition: Home and away influences compete at each grid point
  • Visualization: 50x50 grid resolution, side-by-side comparison

📈 Use Cases

  • Tactical Analysis: Understand territorial control patterns
  • Player Positioning: Analyze optimal defensive and offensive positions
  • Space Creation: Identify areas of contested vs. dominated territory
  • Model Comparison: Compare traditional vs. distance-based approaches

💡 Understanding the Visualizations

Left Panel: Traditional Pitch Control

  • Blue/Red intensity: Probability of ball control by each team
  • Based on: Player positions, velocities, reaction times
  • Physics model: Assumes players move toward ball with realistic constraints

Right Panel: Team Influence Zones

  • Blue/Red regions: Territorial control based purely on distance
  • Sharp boundaries: Clear zones of influence competition
  • Customizable: Adjust shape, decay, and coverage parameters

🔧 For Developers

Key Classes

  • PitchControlAnalysisGUI: Main application interface
  • PlayerInfluenceZones: Core influence calculation engine
  • calculate_elliptical_distance(): Directional influence geometry

Adding New Features

  1. GUI controls: Add to interactive_gui.py parameter frame
  2. Calculations: Extend team_influence_analysis.py
  3. Visualization: Modify plot generation in analysis thread

Code Style

  • Follow PEP 8 standards
  • Document all public methods
  • Use type hints where possible
  • Test with multiple data sets

🚀 Performance Notes

  • Grid resolution: 50x50 for real-time performance
  • Threading: Analysis runs in background to keep GUI responsive
  • Memory usage: ~50MB for typical match analysis
  • Processing time: 1-3 seconds per event analysis

📊 Use Cases

  • Tactical Analysis: Compare territorial control methods
  • Player Evaluation: Assess positioning and influence
  • Match Insights: Identify key moments and spaces
  • Research: Validate new influence models against established pitch control

⚽ Ready to analyze? Launch python interactive_gui.py and explore!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages