def load( event_data: FileLike, lineup_data: FileLike, event_types: Optional[List[str]] = None, coordinates: Optional[str] = None, ) -> EventDataset: """ Load Statsbomb event data into a [`EventDataset`][kloppy.domain.models.event.EventDataset] Parameters: event_data: filename of json containing the events lineup_data: filename of json containing the lineup information event_types: coordinates: """ deserializer = StatsBombDeserializer( event_types=event_types, coordinate_system=coordinates ) with open_as_file(event_data) as event_data_fp, open_as_file( lineup_data ) as lineup_data_fp: return deserializer.deserialize( inputs=StatsbombInputs( event_data=event_data_fp, lineup_data=lineup_data_fp ), )
def load( meta_data: FileLike, raw_data: FileLike, additional_meta_data: Optional[FileLike] = None, sample_rate: Optional[float] = None, limit: Optional[int] = None, coordinates: Optional[str] = None, only_alive: Optional[bool] = False, ) -> TrackingDataset: deserializer = SecondSpectrumDeserializer( sample_rate=sample_rate, limit=limit, coordinate_system=coordinates, only_alive=only_alive, ) with open_as_file(meta_data) as meta_data_fp, open_as_file( raw_data) as raw_data_fp, open_as_file( additional_meta_data ) if additional_meta_data else dummy_context_mgr( ) as additional_meta_data_fp: return deserializer.deserialize(inputs=SecondSpectrumInputs( meta_data=meta_data_fp, raw_data=raw_data_fp, additional_meta_data=additional_meta_data_fp, ))
def load_event( event_data: FileLike, meta_data: FileLike, event_types: Optional[List[str]] = None, coordinates: Optional[str] = None, ) -> EventDataset: deserializer = MetricaJsonEventDataDeserializer( event_types=event_types, coordinate_system=coordinates) with open_as_file(event_data) as event_data_fp, open_as_file( meta_data) as meta_data_fp: return deserializer.deserialize(inputs=MetricaJsonEventDataInputs( event_data=event_data_fp, meta_data=meta_data_fp))
def load_tracking_epts( meta_data: FileLike, raw_data: FileLike, sample_rate: Optional[float] = None, limit: Optional[int] = None, coordinates: Optional[str] = None, ) -> TrackingDataset: deserializer = MetricaEPTSTrackingDataDeserializer( sample_rate=sample_rate, limit=limit, coordinate_system=coordinates) with open_as_file(raw_data) as raw_data_fp, open_as_file( meta_data) as meta_data_fp: return deserializer.deserialize(inputs=MetricaEPTSTrackingDataInputs( raw_data=raw_data_fp, meta_data=meta_data_fp))
def load_tracking_csv( home_data: FileLike, away_data: FileLike, sample_rate: Optional[float] = None, limit: Optional[int] = None, coordinates: Optional[str] = None, ) -> TrackingDataset: deserializer = MetricaCSVTrackingDataDeserializer( sample_rate=sample_rate, limit=limit, coordinate_system=coordinates) with open_as_file(home_data) as home_data_fp, open_as_file( away_data) as away_data_fp: return deserializer.deserialize(inputs=MetricaCSVTrackingDataInputs( home_data=home_data_fp, away_data=away_data_fp))
def load( meta_data: FileLike, raw_data: FileLike, sample_rate: Optional[float] = None, limit: Optional[int] = None, coordinates: Optional[str] = None, only_alive: Optional[bool] = True, ) -> TrackingDataset: deserializer = TRACABDeserializer( sample_rate=sample_rate, limit=limit, coordinate_system=coordinates, only_alive=only_alive, ) with open_as_file(meta_data) as meta_data_fp, open_as_file( raw_data) as raw_data_fp: return deserializer.deserialize( inputs=TRACABInputs(meta_data=meta_data_fp, raw_data=raw_data_fp))
def load( meta_data: FileLike, raw_data: FileLike, sample_rate: Optional[float] = None, limit: Optional[int] = None, coordinates: Optional[str] = None, include_empty_frames: Optional[bool] = False, ) -> TrackingDataset: deserializer = SkillCornerDeserializer( sample_rate=sample_rate, limit=limit, coordinate_system=coordinates, include_empty_frames=include_empty_frames, ) with open_as_file(meta_data) as meta_data_fp, open_as_file( raw_data) as raw_data_fp: return deserializer.deserialize(inputs=SkillCornerInputs( meta_data=meta_data_fp, raw_data=raw_data_fp))
def load( event_data: str, meta_data: str, event_types: Optional[List[str]] = None, coordinates: Optional[str] = None, ) -> EventDataset: """ Load Sportec event data into a [`EventDataset`][kloppy.domain.models.event.EventDataset] Parameters: event_data: filename of the XML file containing the events meta_data: filename of the XML file containing the match information event_types: coordinates: """ serializer = SportecEventDeserializer(event_types=event_types, coordinate_system=coordinates) with open_as_file(event_data) as event_data_fp, open_as_file( meta_data) as meta_data_fp: return serializer.deserialize( SportecInputs(event_data=event_data_fp, meta_data=meta_data_fp))
def load( f7_data: FileLike, f24_data: FileLike, event_types: Optional[List[str]] = None, coordinates: Optional[str] = None, ) -> EventDataset: """ Load Opta event data into a [`EventDataset`][kloppy.domain.models.event.EventDataset] Parameters: f7_data: filename of json containing the events f24_data: filename of json containing the lineup information event_types: coordinates: """ deserializer = OptaDeserializer(event_types=event_types, coordinate_system=coordinates) with open_as_file(f7_data) as f7_data_fp, open_as_file( f24_data) as f24_data_fp: return deserializer.deserialize(inputs=OptaInputs( f7_data=f7_data_fp, f24_data=f24_data_fp), )
def load( event_data: FileLike, event_types: Optional[List[str]] = None, coordinates: Optional[str] = None, ) -> EventDataset: """ Load DataFactory event data into a [`EventDataset`][kloppy.domain.models.event.EventDataset] Parameters: event_data: filename of json containing the events event_types: coordinates: """ deserializer = DatafactoryDeserializer(event_types=event_types, coordinate_system=coordinates) with open_as_file(event_data) as event_data_fp: return deserializer.deserialize( inputs=DatafactoryInputs(event_data=event_data_fp), )
def load( event_data: FileLike, event_types: Optional[List[str]] = None, coordinates: Optional[str] = None, ) -> EventDataset: """ Load Wyscout event data into a [`EventDataset`][kloppy.domain.models.event.EventDataset] Parameters: event_data: filename of the XML file containing the events and metadata event_types: coordinates: """ deserializer = WyscoutDeserializer( event_types=event_types, coordinate_system=coordinates ) with open_as_file(event_data) as event_data_fp: return deserializer.deserialize( inputs=WyscoutInputs(event_data=event_data_fp), )
def load(data: str) -> CodeDataset: deserializer = SportsCodeDeserializer() with open_as_file(data) as data_fp: return deserializer.deserialize(inputs=SportsCodeInputs(data=data_fp))