UFATrack
- class Space_data(data_provider='UFATrack', tracking_data_path=tracking_data_path, out_path=None, testing_mode=False).preprocessing() pd.DataFrame
Load the UFATrack from csv files(s) and convert it into a DataFrame.
- Parameters:
tracking_data_path (str) – Path to the csv file/folder containing tracking data.
out_path (str, optional) – Path to the output folder where processed data will be saved.
testing_mode (bool, optional) – If True, run in testing mode with limited data.
- Returns:
(event_data_dict, home_tracking_dict, away_tracking_dict) — dictionaries mapping match IDs to respective DataFrames.
- Return type:
tuple of dict
Example
from preprocessing import Space_data tracking_path = './UFATrack/Tracking Data' out_path = './' Space_data(data_provider='UFATrack', tracking_data_path=tracking_path, out_path=out_path ).preprocessing()
Details
This function performs the following steps:
Retrieves all tracking files from the input directories using get_files().
Converts raw tracking data into an intermediate DataFrames using create_intermediate_file.
Converts intermediate DataFrames into fixed-format home and away tracking DataFrames and event DataFrames using convert_to_metrica_format.
Convert the multi-index tracking columns into a single-row header using format_tracking_headers.
Organizes results into dictionaries keyed by match ID:
event_data_dict for event DataFrames
home_tracking_dict for home team tracking DataFrames
away_tracking_dict for away team tracking DataFrames
The returned DataFrames include the following columns:
- Event DataFrame (`event_data_dict[match_id]`):
Team: Team associated with the event (‘Home’ or ‘Away’)Type: Type of the eventSubtype: Subtype of the event (e.g., ‘success’ or ‘fail’)Period: Period of the match (1 or 2)Start Frame: Frame index at event startStart Time [s]: Time in seconds at event startEnd Frame: Frame index at event endEnd Time [s]: Time in seconds at event endFrom: Player performing the actionTo: Player receiving the action (if applicable)Start X: Starting x-coordinate of the eventStart Y: Starting y-coordinate of the eventEnd X: Ending x-coordinate of the eventEnd Y: Ending y-coordinate of the event
- Home Tracking DataFrame (`home_tracking_dict[match_id]`):
Period: Period of the match (1 or 2)Time [s]: Time in secondsHome_1_x…Home_7_x: X-coordinates of home players 1–7Home_1_y…Home_7_y: Y-coordinates of home players 1–7disc_x: Disc X-coordinatedisc_y: Disc Y-coordinate
- Away Tracking DataFrame (`away_tracking_dict[match_id]`):
Period: Period of the match (1 or 2)Time [s]: Time in secondsAway_1_x…Away_7_x: X-coordinates of away players 1–7Away_1_y…Away_7_y: Y-coordinates of away players 1–7disc_x: Disc X-coordinatedisc_y: Disc Y-coordinate