Skip to content

Commit

Permalink
Merge pull request #279 from my-game-plan/feature/fix-wyscout-orienta…
Browse files Browse the repository at this point in the history
…tion

Fix Wyscout orientation
  • Loading branch information
koenvo authored Jan 22, 2024
2 parents 3360c6e + 93d508a commit 6013893
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kloppy/infra/serializers/event/wyscout/deserializer_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion kloppy/infra/serializers/event/wyscout/deserializer_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
7 changes: 7 additions & 0 deletions kloppy/tests/test_wyscout.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
GoalkeeperActionType,
CardQualifier,
CardType,
Orientation,
)

from kloppy import wyscout
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 6013893

Please sign in to comment.