From 8f2b20ca9341f7979b4c51d429602462d2960f1e Mon Sep 17 00:00:00 2001 From: driesdeprest Date: Fri, 12 Jan 2024 09:08:00 +0100 Subject: [PATCH 1/2] Fix Wyscout orientation --- kloppy/infra/serializers/event/wyscout/deserializer_v2.py | 2 +- kloppy/infra/serializers/event/wyscout/deserializer_v3.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kloppy/infra/serializers/event/wyscout/deserializer_v2.py b/kloppy/infra/serializers/event/wyscout/deserializer_v2.py index 26cfb1fe..2ef37b64 100644 --- a/kloppy/infra/serializers/event/wyscout/deserializer_v2.py +++ b/kloppy/infra/serializers/event/wyscout/deserializer_v2.py @@ -712,7 +712,7 @@ def deserialize(self, inputs: WyscoutInputs) -> EventDataset: pitch_dimensions=transformer.get_to_coordinate_system().pitch_dimensions, score=None, frame_rate=None, - orientation=Orientation.BALL_OWNING_TEAM, + orientation=Orientation.ACTION_EXECUTING_TEAM, flags=None, provider=Provider.WYSCOUT, coordinate_system=transformer.get_to_coordinate_system(), diff --git a/kloppy/infra/serializers/event/wyscout/deserializer_v3.py b/kloppy/infra/serializers/event/wyscout/deserializer_v3.py index 54bfb1fb..a19ce11a 100644 --- a/kloppy/infra/serializers/event/wyscout/deserializer_v3.py +++ b/kloppy/infra/serializers/event/wyscout/deserializer_v3.py @@ -684,7 +684,7 @@ def deserialize(self, inputs: WyscoutInputs) -> EventDataset: pitch_dimensions=transformer.get_to_coordinate_system().pitch_dimensions, score=None, frame_rate=None, - orientation=Orientation.BALL_OWNING_TEAM, + orientation=Orientation.ACTION_EXECUTING_TEAM, flags=None, provider=Provider.WYSCOUT, coordinate_system=transformer.get_to_coordinate_system(), From 93d508a85dfd2d3509b900ad5ac312392d91b3a2 Mon Sep 17 00:00:00 2001 From: driesdeprest Date: Fri, 12 Jan 2024 09:20:41 +0100 Subject: [PATCH 2/2] Adding test which checks orientation of Wyscout generated EventDataset --- kloppy/tests/test_wyscout.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kloppy/tests/test_wyscout.py b/kloppy/tests/test_wyscout.py index c1d0f42b..3cd6b516 100644 --- a/kloppy/tests/test_wyscout.py +++ b/kloppy/tests/test_wyscout.py @@ -16,6 +16,7 @@ GoalkeeperActionType, CardQualifier, CardType, + Orientation, ) from kloppy import wyscout @@ -52,6 +53,9 @@ def dataset(self, event_v2_data) -> EventDataset: data_version="V2", ) assert dataset.dataset_type == DatasetType.EVENT + assert ( + dataset.metadata.orientation == Orientation.ACTION_EXECUTING_TEAM + ) return dataset def test_shot_event(self, dataset: EventDataset): @@ -130,6 +134,9 @@ def dataset(self, event_v3_data: Path) -> EventDataset: data_version="V3", ) assert dataset.dataset_type == DatasetType.EVENT + assert ( + dataset.metadata.orientation == Orientation.ACTION_EXECUTING_TEAM + ) return dataset def test_coordinates(self, dataset: EventDataset):