Interpolation#

Class to manage interpolation and smoothing functions

tracklib.algo.Interpolation.resample(track, delta, algo=1, mode=1)[source]#

Resampling of a track with linear interpolation delta

Interpolation interval (time in sec if temporal mode is selected, space in meters if spatial).

Available modes are:

  • MODE_SPATIAL (mode=1)

  • MODE_TEMPORAL (mode=2)

algorithm:

  • ALGO_LINEAR (algo=1)

  • ALGO_THIN_SPLINES (algo=2)

  • ALGO_B_SPLINES (algo=3)

  • ALGO_GAUSSIAN_PROCESS (algo=4)

In temporal mode, argument may be:

  • an integer or float: interval in seconds

  • a list of timestamps where interpolation should be computed

  • a reference track

Parameters
  • algo (Literal[1, 2, 3, 4]) – TODO

  • mode (Literal[1, 2]) – TODO

tracklib.algo.Interpolation.__resampleSpatial(track, ds)[source]#

TODO

Resampling of a track with linear interpolation ds: curv abs interval (in m) between two samples

tracklib.algo.Interpolation.__resampleTemporal(track, reference)[source]#

TODO

Resampling of a track with linear interpolation reference: list of timestamps, track or sec interval

tracklib.algo.Interpolation.gaussian_process(track, timestamps, kernel, factor=1.0, sigma=0.0, cp_var=False, mode=2)[source]#

Track interpolation and smoothing with Gaussian Process (GP)

Parameters
  • timestamps – points where interpolation must be computed. May be a list of timestamps, a track or a number of seconds

  • kernel

    a symetric function k(xi-xj) describing the statistical similarity between the coordinates X,Y,Z taken in two points :

    \(k(t2-t1) = Cov(X(t1), X(t2))\)

    \(k(t2-t1) = Cov(Y(t1), Y(t2))\)

    \(k(t2-t1) = Cov(Z(t1), Z(t2))\)

  • factor – unit factor of variance if the kernel must be scaled

  • sigma – observation noise standard deviation (in coords units)

  • cp_var – compute covariance matrix and store pointwise sigmas

  • mode – MODE_TEMPORAL or MODE_SPATIAL

Returns

interpolated/smoothed track (without AF)

tracklib.algo.Interpolation.gaussian_process_spatial(track, delta, kernel, factor=1.0, sigma=0.0, cp_var=False)[source]#
tracklib.algo.Interpolation.gaussian_process_temporal(track, timestamps, kernel, factor=1.0, sigma=0.0, cp_var=False)[source]#
tracklib.algo.Interpolation.__gaussian_process(track, TO, TU, kernel, factor, sigma, cp_var)[source]#
tracklib.algo.Interpolation.prepareTimeSampling(input, tini=None, tfin=None)[source]#

TODO

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

Function to synchronize two tracks. Note: method is symetric on track1 and track2

Input : - track1 :: track to synchronize - track2 :: track to synchronize

tracklib.algo.Interpolation.__smooth_resample_spatial(track, ds)[source]#

TODO

Resampling of a track with spline interpolation ds: curv abs interval (in m) between two samples

tracklib.algo.Interpolation.__smooth_resample_temporal(track, reference)[source]#

TODO

Resampling of a track with spline interpolation reference: list of timestamps, track or sec interval

tracklib.algo.Interpolation.__phi(x, tab)[source]#

TODO

tracklib.algo.Interpolation.__bsplines_temporal(track, reference, degree=3, knots_nb=None)[source]#

TODO

Resampling of a track with B-spline interpolation reference: list of timestamps, track or sec interval

tracklib.algo.Interpolation.__bsplines_spatial(track, ds, degree=3, knots_nb=None)[source]#

TODO

Resampling of a track with spline interpolation ds: curv abs interval (in m) between two samples

tracklib.algo.Interpolation.smooth_cv(track, smooth_function, params=[], verbose=True)[source]#
Cross validation for determining optimal parameters of

smoothing/interpolating/simplifying functions

Note that if params contains a single element, smooth_cv function is a simple statistical control. If no parameters are provided in input, a default set of 1000 positive parameters sampled according to a logarithmic scale between 1e-9 and 1e9 is considered.

Parameters
  • track – a (timestamped) track on which cross validation is performed

  • smooth_function – any function with track as input and output

  • params – a list of parameters to test in smooth_function

Returns

TODO