Race

class igclib.core.race.Race(tracks=None, task=None, validate=True, path=None, progress='gui')[source]

You can create a Race instance in two different ways :

  • Passing a tracks and a task, which creates a new Race object and validates all pilot flights.

    >>> r =  Race(tracks='tracks/', task='task.xctsk')
    
  • Passing a path to a previously saved Race, loading the saved instance (much faster than re-validating flights).

    >>> r =  Race(path='race.pkl')
    
Keyword Arguments:
 
  • tracks (str) – A path to a directory or a zip file containing IGC tracks.
  • task (str) – A path to the task file or a base64 representation of the task.
  • path (str) – The path of a previously saved Race instance.
n_pilots

The number of pilots in the Race.

Type:int
flights

A collection of Flights indexed by pilot ID.

Type:dict [str, Flight]
task

The Task instance of the Race.

Type:Task
get_pilot_features(pilot_id, start=None, stop=None)[source]

Extracts pilot features

Parameters:

pilot_id (str) – The pilot identifier used as key in self.flights

Keyword Arguments:
 
  • start (time, optional) – Lower bound of the retrieved features (default)
  • stop (time, optional) – Upper bound of the retrieved features
Raises:

KeyError – if pilot_id is not a key of self.flights dictionnary

Returns:

The pilot features from start to stop

Return type:

PilotFeatures

parse_flights(tracks)[source]

Populates flights attribute by parsing each igc file in tracks.

Parameters:tracks (str) – Path to a directory or a zip file containing the igc files
pilot_schema(pilot_id, output)[source]

In dev !

Parameters:pilot_id (str) – ID of the pilot being watched
serialize()[source]

Serializes the race object to be written to a JSON file

validate_flights()[source]

Computes the validation of each flight on the race