Welcome to igclib’s documentation¶
Introduction¶
igclib
is a Python module and a command line tool designed for the analysis of paragliding competitions. Its original purpose is to serve as backend to Task Creator.
Installation¶
This package will be hosted on PyPI when it reaches its beta version. For the moment, you can install it by downloading the source from GitHub.
git clone https://github.com/teobouvard/igclib.git
cd igclib
make install
Examples¶
Python Examples¶
Build a race and save it to disk¶
from igclib.core.race import Race
r = Race(tracks='tracks/', task='task.xctsk')
r.save('race.pkl')
Load a race and save it as json¶
from igclib.core.race import Race
r = Race(path='race.pkl')
r.save('race.json')
Get a task optimization info and save it as json¶
from igclib.core.task import Task
t = Task('task.xctsk')
t.save('optimized.json')
Get all available tasks from a provider on standard output¶
from igclib.crawlers.task_crawler import TaskCrawler
crawler = TaskCrawler(provider='PWCA', year=2015)
crawler.save('-')
Architecture¶
Soon
Python API¶
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: -
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: Raises: KeyError
– if pilot_id is not a key of self.flights dictionnaryReturns: The pilot features from start to stop
Return type:
-
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
Task¶
-
class
igclib.core.task.
Task
(task)[source]¶ Creates a Task object. The way this is done is really bad, and any help would be appreciated. As of now, this class checks if the input task (file or b64) “fits” in each parser implemented. When a parser does not raise a KeyError, the task is assumed to be of this format and its attributes are copied back to the Task object. I feel that there is a smarter way to do this, probably with inheritance. However, task format is not known in advance so trying each format seems like the easiest thing to do.
Parameters: task (str) – Path to or base64 representation of a task file. Raises: NotImplementedError
– If the task could not be parsed.
Pilot Features¶
-
class
igclib.core.pilot_features.
GroupRelation
(pilot_id, snapshot)[source]¶ Convention : If a GroupRelation feature is > 0, it means that the original pilot is in a better position than the other pilot in the group. This means that :
- delta_altitude > 0 : original pilot is higher
- delta_distance > 0 : original pilot closer to goal
-
class
igclib.core.pilot_features.
PilotFeatures
(pilot_id, timestamp, snapshot)[source]¶ -
-
group_relation
¶ The current position of the pilot.
Type: GroupRelation
-
Geography¶
This module contains the base classes representing a GeoPoint, a Turnpoint and an Opti. It also provides convenience wrappers around C extension function calls. These wrappers allow for more concise function calls to improve readability.
Crawlers¶
Command line manual¶
Usage¶
igclib COMMAND [OPTIONS] ARGS
Commands¶
optimize
Get the optimized version of a task.
Required arguments :
--task
--output
replay
Creates a race without validating flights.
Required arguments :
--task
--flights
--output
race
Creates a race with validated flights.
Required arguments :
--task and --flights or --path
--output
crawl
Crawls a provider for all events hosted in the specified year.
Optional arguments :
--provider [ PWCA | FFVL ] (defaults to PWCA)
--year (defaults to current year)
watch
Get the features of a pilot on a flight.
Required arguments :
--path
--pilot
--output
Options¶
--progress [ gui | ratio | silent ] (defaults to gui)
Defines the way progress is displayed to the user.
* gui displays a progress bar
* ratio displays a percentage on each line
* silent runs quietly
Files specifications¶
Soon