Utils#
This module contains an algorithm of Analytical Features calculation and some utility functions.
- tracklib.core.Utils.unlistify(input)[source]#
Remove list if needed
- Parameters
input – TODO
- Returns
TODO
- tracklib.core.Utils.compLike(s1, s2)[source]#
TODO
- Parameters
s1 – TODO
s2 – TODO
- Return type
bool
- Returns
TODO
- tracklib.core.Utils.makeCoords(x, y, z, srid)[source]#
Function to form coords object from (x,y,z) data
- Parameters
x (
float
) – 1st coordinate (X, lon or E)y (
float
) – 2nd coordinate (Y, lat or N)z (
float
) – 3rd coordinate (Z, hgt or U)srid (
str
) – Id of coord system (ECEF, GEO or ENU)
- Return type
Union
[ENUCoords
,ECEFCoords
,GeoCoords
]- Returns
Coords object in the proper srid
- tracklib.core.Utils.makeDistanceMatrix(track, mode='linear')[source]#
Function to form distance matrix
- Parameters
track – a track :mode: computation mode (‘linear’, ‘circular’ or ‘euclidian’)
- Returns
numpy distance matrix with a track
- tracklib.core.Utils.makeCovarianceMatrixFromKernelOld(kernel, T1, T2, factor=1.0, force=False, cycle=False)[source]#
Function to form covariance matrix from kernel :param kernel: A function describing statistical similarity between points :type T1:
list
[tuple
[float
,float
]] :param T1: A list of points :type T2:list
[tuple
[float
,float
]] :param T2: A list of points :type factor:float
:param factor: Unit factor of std dev (default 1.0)
- tracklib.core.Utils.makeCovarianceMatrixFromKernel(kernel, track, factor=1.0, mode='linear', force=False)[source]#
Function to form covariance matrix from kernel
- Parameters
kernel – A function describing statistical similarity between points
track – A track :mode: computation mode (‘linear’, ‘circular’ or ‘euclidian’)
factor – Unit factor of std dev (default 1.0)
- tracklib.core.Utils.rgbToHex(color)[source]#
Function to convert RGBA color to hexadecimal
- Parameters
color (
list
[float
,float
,float
,Optional
[float
]]) – A 3 or 4-element array R, G, B [,alpha]. Each color and transparency channel is in [0,1]- Return type
str
- Returns
A string containing color in hexadecimal
- tracklib.core.Utils.interpColors(v, vmin, vmax, cmin, cmax)[source]#
Function to interpolate RGBA (or RGB) color between two values
- Parameters
v (
float
) – a float valuevmin (
float
) – minimal value of v (color cmin)vmax (
float
) – maximal value of v (color cmin)cmin (
list
[float
,float
,float
,Optional
[float
]]) – a 3 or 4-element array R, G, B [,alpha]cmax (
list
[float
,float
,float
,Optional
[float
]]) – a 3 or 4-element array R, G, B [,alpha]
- Return type
list
[float
,float
,float
,float
]- Returns
A 4-element array
- tracklib.core.Utils.getColorMap(cmin, cmax)[source]#
TODO
- Parameters
cmin – TODO
cmax – TODO
- Returns
TODO
- tracklib.core.Utils.getOffsetColorMap(cmin, cmax, part)[source]#
TODO
- Parameters
cmin – TODO
cmax – TODO
part – TODO
- Returns
TODO
- class tracklib.core.Utils.priority_dict(*args, **kwargs)[source]#
Dictionary that can be used as a priority queue.
Keys of the dictionary are items to be put into the queue, and values are their respective priorities. All dictionary methods work as expected. The advantage over a standard heapq-based priority queue is that priorities of items can be efficiently updated (amortized O(1)) using code as ‘thedict[item] = new_priority.’
The ‘smallest’ method can be used to return the object with lowest priority, and ‘pop_smallest’ also removes it.
The ‘sorted_iter’ method provides a destructive sorted iterator.
- smallest()[source]#
Return the item with the lowest priority.
Raises IndexError if the object is empty.