Comparison#

to manage comparisons of GPS tracks

tracklib.algo.Comparison.plotDifferenceProfile(profile, track2, af_name='pair', sym='g--', NO_DATA_VALUE=-1)[source]#

Difference profile plot

Parameters
  • profile – TODO

  • track2 – TODO

  • af_name – TODO

  • sym – TODO

  • NO_DATA_VALUE (int) – TODO

tracklib.algo.Comparison.differenceProfile(track1, track2, mode='NN', ends=False, p=1, verbose=True)[source]#

Profile of difference between two traces

Three possible modes:

  • NN (Nearest Neighbour): \(O(n^2)\) time and \(O(n)\) space

  • DTW (Dynamic Time Warping): \(O(n^3)\) time and \(O(n^2)\) space

  • FDTW (Fast Dynamic Time Warping): same as DTW with reduced search space. In this particular case, ‘ends’ parameter is an integer giving the number of points to search for a match ahead and behind the current point. E.g. for ends=0, there is a strict matching track1[i] <-> track2[i] for each epoch i. For ends=10 for example, each point track[i] can be matched with any point chronologically between the bounds track2[i-10] and track2[i+10]. Default is equal to 3, meaning that track1 may be at most 3 times faster or slower than track2 on ant given sub-interval. Note that this method is designed for pairs of tracks having about same number of points. Otherwise, it is strongly advised to perform a spatial resampling before applying FDTW

Parameters
  • track1 – TODO

  • track2 – TODO

  • mode (Literal[‘NN’, ‘DTW’, ‘FDTW’]) – Mode for the interpolation. Three modes are possible : NN, DTW and FDTW

  • ends – TODO

  • p – TODO

  • verbose (bool) – Verbose mode

Returns

A track objet, with an analytical feature diff containing shortest distance of each point of track t1, to the points of track t2. We may get profile as a list with output.getAbsCurv() and output.getAnalyticalFeature("diff")() The selected candidate in registerd in AF “pair” Set “ends” parameter to True to force end points to meet p is Minkowski’s exponent for distance computation. Default value is - 1 for summation of distances, - 2 for least squares solution - and 10 for an approximation of Frechet solution.

tracklib.algo.Comparison.__fillAFProfile(track1, track2, output, S)[source]#

TODO

Parameters
  • track1 – TODO

  • track2 – TODO

  • output – TODO

  • S – TODO

tracklib.algo.Comparison.synchronize(track1, track2)[source]#

Resampling of 2 tracks with linear interpolation on a common base of timestamps

Parameters

track – track to synchronize with

tracklib.algo.Comparison.compare(track1, track2)[source]#

Comparison of 2 tracks.

Tracks are interpolated linearly on a common base of timestamps

Parameters
  • track1 – track to compare with

  • track2 – track to compare with

Return type

float

Returns

TODO

tracklib.algo.Comparison.centralTrack(tracks, mode='NN', verbose=True)[source]#

Computes central track of a track collection

Parameters
  • tracks (Union[TrackCollection, Iterable[Track]]) – TrackCollection or list of tracks

  • mode (Literal[‘NN’, ‘DTW’, ‘FDTW’]) – “NN”, “DTW” or “FDTW” for track pair matching (see the documentation of differenceProfile() function for more infos on modes)

Return type

Track

Returns

The central track

tracklib.algo.Comparison.premiereComposanteHausdorff(track1, track2)[source]#

Première composante de Hausdorff.

Parameters#

track1Track

the first track

track2Track

the second track

Returns#

double

directed Hausdorff distance

tracklib.algo.Comparison.hausdorff(track1, track2)[source]#

General Hausdorff distance between two tracks.

Parameters#

track1Track

the first track

track2Track

the second track

Returns#

double

Hausdorff distance

tracklib.algo.Comparison.discreteFrechet(track1, track2)[source]#
tracklib.algo.Comparison.discreteFrechetCouplingMeasure(track1, track2, i, j, ca)[source]#
tracklib.algo.Comparison.medoid(tracks, mode='Hausdorff', verbose=True)[source]#
Return type

Track