Skip to content

Commit

Permalink
remove negative time frames
Browse files Browse the repository at this point in the history
  • Loading branch information
DriesDeprest committed Oct 25, 2024
1 parent 2ee2f9c commit dcfccea
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions kloppy/infra/serializers/tracking/signality.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ def __get_periods(cls, p1_tracking, p2_tracking) -> List[Period]:
periods = []
for period_id, p_tracking in enumerate([p1_tracking, p2_tracking], 1):
first_frame = p_tracking[0]
assert (
first_frame["match_time"] > 0
), "First frame must have match_time bigger than 0"
start_time = datetime.utcfromtimestamp(
(first_frame["utc_time"] - first_frame["match_time"]) / 1000
)
Expand Down Expand Up @@ -241,7 +238,9 @@ def deserialize(self, inputs: SignalityInputs) -> TrackingDataset:
frame = self._get_frame_data(
teams, period, raw_frame, frame_id_offset
)
if frame.players_data:
if frame.players_data and frame.timestamp > timedelta(
seconds=0
):
frame = transformer.transform_frame(frame)
frames.append(frame)
n += 1
Expand Down

0 comments on commit dcfccea

Please sign in to comment.