Segmentation#

Class to manage segmentation of GPS tracks

tracklib.algo.Segmentation.segmentation(track, afs_input, af_output, thresholds_max, mode_comparaison=1)[source]#

Method to divide a track into multiple according to analytical feaures value. Creates an AF with 0 if change of division, 1 otherwise

tracklib.algo.Segmentation.split(track, source)[source]#

Splits track according to :

  • af name (considered as a marker) if source is a string

  • list of index if source is a list

Return type

TrackCollection

Returns

No track if no segmentation, otherwise a TrackCollection object

tracklib.algo.Segmentation.findStops(track, spatial, temporal, mode, verbose=True)[source]#

Function to find stop positions from a track

Parameters#

track : Track

spatial : float

temporal : float

mode : MODE_STOPS_LOCAL, MODE_STOPS_GLOBAL, MODE_STOPS_RTK, MODE_STOPS_ACC

verbosebool, optional

The default is True.

Returns#

TYPE

DESCRIPTION.

rtype

Track

tracklib.algo.Segmentation.findStopsLocal(track, speed=1, duration=10)[source]#
tracklib.algo.Segmentation.backtracking(B, i, j)[source]#
tracklib.algo.Segmentation.backward(B)[source]#
tracklib.algo.Segmentation.plotStops(stops, x='x', y='y', r='radius', rf=1, sym='r-')[source]#
tracklib.algo.Segmentation.findStopsGlobal(track, diameter=20, duration=60, downsampling=1, verbose=True)[source]#

Find stop points in a track based on two parameters: Maximal size of a stop (as the diameter of enclosing circle, in ground units) and minimal time duration (in seconds). Use downsampling parameter > 1 to speed up the process

Parameters#

trackTrack

track to detect stop points

diameterfloat, optional

Maximal size of a stop (as the diameter of enclosing circle, in ground units). The default is 20.

durationfloat, optional

minimal time duration (in seconds). The default is 60.

downsamplingfloat, optional

to speed up the process, value need to be > 1. The default is 1.

verboseboolean, optional

verbose or not. The default is True.

Returns#

stopsTrack

stops points constitute a new Track.

tracklib.algo.Segmentation.findStopsGlobalForRTK(track, std_max=0.02, duration=5, downsampling=1, verbose=True)[source]#

Find stop points in a track based on maximal size of a stop and minimal time duration

Two parameters:

  • Maximal size of a stop (as the standard deviation per axis, in ground units)

  • Minimal time duration (in seconds)

Use downsampling parameter > 1 to speed up the process.

Default is set for precise RTK GNSS survey (2 cm for 5 sec)

tracklib.algo.Segmentation.splitReturnTrip(track, mode)[source]#
tracklib.algo.Segmentation.splitReturnTripExhaustive(track)[source]#

Split track when there is a return trip to keep only the first part

tracklib.algo.Segmentation.splitReturnTripFast(track, side_effect=0.1, sampling=1)[source]#

Split track when there is a return trip to keep only the first part. Second version with Fast Fourier Transform

tracklib.algo.Segmentation.optimalPartition(cost_matrix, mode=0, verbose=True)[source]#
tracklib.algo.Segmentation.optimalSegmentation(track, cost, glob_param=None, mode=0, verbose=True)[source]#
tracklib.algo.Segmentation.splitAR(track, pt1, pt2=None, radius=10, nb_min_pts=10, verbose=True)[source]#
tracklib.algo.Segmentation.stdbscan(track, eps1, eps2, minPts, deltaT)[source]#

Birant, D., & Kut, A. (2007). ST-DBSCAN: An algorithm for clustering spatial–temporal data. Data & Knowledge Engineering, 60(1), 208-221.

Parameters#

trackTYPE

DESCRIPTION.

eps1TYPE

DESCRIPTION.

eps2TYPE

DESCRIPTION.

minPtsTYPE

DESCRIPTION.

deltaTfloat

threshold value to be included in a cluster.

Returns#

Cluster in AF

tracklib.algo.Segmentation.retrieveNeighbors(track, j, eps1, eps2)[source]#
tracklib.algo.Segmentation.stop_point_with_acceleration_criteria(track, i)[source]#

This algorithm detect stop point. A point is a stop when speed is null and acceleration is negative.

tracklib.algo.Segmentation.stop_point_with_time_window_criteria(trace, i)[source]#

This algorithm of stop detection is based on geographical moving distance in time windows.

The AF has value:

  • stop (1)

  • not stop (0)

  • not yet examined (-1)