Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2ae5dd9
made the it_work test
stephTchembeu Sep 2, 2025
8529633
feat(cdf): add Common Data Format tracking data serializer skeleton
koenvo Sep 8, 2025
32768c0
minor
koenvo Sep 8, 2025
f9d7678
Add a successful test to show what metadata and tracking data there s…
koenvo Sep 9, 2025
bb2e976
minor
koenvo Sep 9, 2025
9142016
fix: use patched CDF validator from koenvo fork
koenvo Sep 9, 2025
2654c7e
stephTchembeu Sep 17, 2025
d7914b2
Merge pull request #1 from koenvo/feat/cdf-serializer
stephTchembeu Sep 17, 2025
159bec3
definig the CDF serilizer body
stephTchembeu Sep 17, 2025
55c23cd
try the test
stephTchembeu Sep 17, 2025
50c612a
minor
stephTchembeu Sep 22, 2025
bf71e4e
fix the bug related to Time and datime.datime type.
stephTchembeu Sep 22, 2025
1ef1216
minor
stephTchembeu Sep 23, 2025
1c8a6eb
pass test successfully.
stephTchembeu Sep 26, 2025
13bd23f
handle whistles
stephTchembeu Sep 26, 2025
a2ee57f
start working on the serializer for the event data.
stephTchembeu Sep 29, 2025
c941ea1
minor
stephTchembeu Sep 30, 2025
8635293
fixed the CDFcoordinateSystem, loop over the entire dataset and avoid…
stephTchembeu Oct 3, 2025
447a34a
minor
stephTchembeu Oct 7, 2025
4c64b0e
Merge pull request #4 from PySport/master
stephTchembeu Oct 7, 2025
04e7555
update the start and end frame_id for each period , update the format…
stephTchembeu Oct 9, 2025
84a7510
fix changes
stephTchembeu Oct 17, 2025
dcfb26f
minor
stephTchembeu Oct 17, 2025
5a2f293
stephTchembeu Oct 23, 2025
91d92ad
fixed all the comments.
stephTchembeu Oct 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added kloppy/_providers/cdf.py
Empty file.
42 changes: 42 additions & 0 deletions kloppy/domain/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class Provider(Enum):
DATAFACTORY (Provider):
STATSPERFORM (Provider):
SPORTVU (Provider):
CDF (Provider):
OTHER (Provider):
"""

Expand All @@ -134,6 +135,7 @@ class Provider(Enum):
HAWKEYE = "hawkeye"
SPORTVU = "sportvu"
SIGNALITY = "signality"
CDF = "common_data_format"
OTHER = "other"

def __str__(self):
Expand Down Expand Up @@ -1183,6 +1185,45 @@ def pitch_dimensions(self) -> PitchDimensions:
pitch_width=None,
standardized=False,
)


class CDFCoordinateSystem(ProviderCoordinateSystem):
"""
CDFCoordinateSystem coordinate system.

Uses a pitch with the origin at the center and the y-axis oriented
from bottom to top. The coordinates are in meters.
"""

@property
def provider(self) -> Provider:
return Provider.CDF

@property
def origin(self) -> Origin:
return Origin.CENTER

@property
def vertical_orientation(self) -> VerticalOrientation:
return VerticalOrientation.BOTTOM_TO_TOP

@property
def pitch_dimensions(self) -> PitchDimensions:
return NormalizedPitchDimensions(
x_dim=Dimension(
-1 * self._pitch_length / 2, self._pitch_length / 2
),
y_dim=Dimension(
-1 * self._pitch_width / 2, self._pitch_width / 2
),
pitch_length = self._pitch_length,
pitch_width=self._pitch_width,
standardized=False,
)

def __init__(self, base_coordinate_system: ProviderCoordinateSystem):
self._pitch_length = base_coordinate_system.pitch_dimensions.pitch_length
self._pitch_width = base_coordinate_system.pitch_dimensions.pitch_width


class SignalityCoordinateSystem(ProviderCoordinateSystem):
Expand Down Expand Up @@ -1390,6 +1431,7 @@ def build_coordinate_system(
Provider.HAWKEYE: HawkEyeCoordinateSystem,
Provider.SPORTVU: SportVUCoordinateSystem,
Provider.SIGNALITY: SignalityCoordinateSystem,
Provider.CDF: CDFCoordinateSystem,
}

if provider in coordinate_systems:
Expand Down
7 changes: 6 additions & 1 deletion kloppy/domain/models/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def frame_rate(self):
@deprecated(
"to_pandas will be removed in the future. Please use to_df instead."
)

def to_pandas(
self,
record_converter: Optional[Callable[[Frame], Dict]] = None,
Expand Down Expand Up @@ -118,6 +119,10 @@ def generic_record_converter(frame: Frame):
return pd.DataFrame.from_records(
map(generic_record_converter, self.records)
)


@property
def to_common_data_format(self)->[object]:

return []

__all__ = ["Frame", "TrackingDataset", "PlayerData"]
3 changes: 3 additions & 0 deletions kloppy/infra/serializers/tracking/cdf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from kloppy.domain.models.common import CDFCoordinateSystem

__all__ = ["CDFCoordinateSystem"]
Loading