def count_positional_pass_map_connections(self, loc_x_min, team): for passer in team.lineup: passer.passes_cnt = {} for pass_event in passer.passes: if Pass.get_x_end_location(pass_event) >= loc_x_min: receiver = team.get_player( Pass.get_recipient_id(pass_event)) self.__increment_player_std_pass_cnt(passer, receiver)
def is_possession_string_starting_at(self, event): decision = self.is_set_piece(event) or Pass.is_kick_off(event) \ or Pass.is_pass_from_goal_kick(event) or (not self.is_team_still_in_possession_at(event)) \ or Interception.isClearance(event) if not self.is_team_still_in_possession_at(event): self.change_team_in_possession_to( self.get_team_in_possession_at(event)) return decision
def __get_passes_till_team_changed(self, team_id, events): passes = [] for i in range(0, len(events)): event = events[i] if Pass.is_pass(event) and Pass.is_pass_completed( event) and Event.is_team_event(event, team_id): passes.append(event) elif Event.is_substitiution(event) or Event.player_sent_off(event): return passes
def count_under_pressure_pass_map_connections(self, team): for passer in team.lineup: passer.passes_cnt = {} for pass_event in passer.passes: if pass_event.under_pressure: receiver = team.get_player( Pass.get_recipient_id(pass_event)) self.__increment_player_std_pass_cnt(passer, receiver)
def draw_sequence(sequence, sub_plot): last_ball_receipt_event = None for event in sequence: if Pass.is_pass(event): if last_ball_receipt_event is not None: if last_ball_receipt_event[pefn.TYPE][pefn.ID] == pe.DRIBBLE: draw_running_with_ball_wo_start(last_ball_receipt_event, event) else: draw_running_with_ball_with_start(last_ball_receipt_event, event) draw_pass(event, sub_plot) elif Shot.is_shot(event): draw_shot(event, sub_plot) elif event[pefn.TYPE][pefn.ID] == pe.DRIBBLE: if last_ball_receipt_event is not None: draw_running_with_ball_with_start(last_ball_receipt_event, event) draw_dribble(event) last_ball_receipt_event = event elif event[pefn.TYPE][pefn.ID] in (pe.BALL_RECEIPT, pe.BALL_RECOVERY): last_ball_receipt_event = event
def isBallInterception(event): return Interception.get_event_type_id(event) in [pe.INTERCEPTION, pe.BALL_RECOVERY] \ or Pass.is_pass_recovered_well(event)
def is_set_piece(self, event): return Pass.is_pass_from_set_piece( event) or Shot.is_shot_from_set_piece(event)