trackpy.link_iter¶
- trackpy.link_iter(coords_iter, search_range, memory=0, predictor=None, adaptive_stop=None, adaptive_step=0.95, neighbor_strategy=None, link_strategy=None, dist_func=None, to_eucl=None)¶
Link an iterable of per-frame coordinates into trajectories.
- Parameters:
- coords_iteriterable
the iterable produces 2d numpy arrays of coordinates (shape: N, ndim). to tell link_iter what frame number each array is, the iterable may be enumerated so that it produces (number, 2d array) tuples
- search_rangefloat or tuple
the maximum distance features can move between frames, optionally per dimension
- memoryinteger, optional
the maximum number of frames during which a feature can vanish, then reappear nearby, and be considered the same particle. Default: 0
- predictorfunction, optional
Improve performance by guessing where a particle will be in the next frame. For examples of how this works, see the “predict” module.
- adaptive_stopfloat, optional
If not None, when encountering an oversize subnet, retry by progressively reducing search_range until the subnet is solvable. If search_range becomes <= adaptive_stop, give up and raise a SubnetOversizeException.
- adaptive_stepfloat, optional
Reduce search_range by multiplying it by this factor.
- neighbor_strategy{‘KDTree’, ‘BTree’}
algorithm used to identify nearby features. Default ‘KDTree’.
- link_strategy{‘recursive’, ‘nonrecursive’, ‘hybrid’, ‘numba’, ‘drop’, ‘auto’}
algorithm used to resolve subnetworks of nearby particles ‘auto’ uses hybrid (numba+recursive) if available ‘drop’ causes particles in subnetworks to go unlinked
- dist_funcfunction or
`sklearn.metrics.DistanceMetric`
instance, optional A custom python distance function or instance of the Scikit Learn DistanceMetric class. If a python distance function is passed, it must take two 1D arrays of coordinates and return a float. Must be used with the ‘BTree’ neighbor_strategy.
- to_euclfunction, optional
function that transforms a N x ndim array of positions into coordinates in Euclidean space. Useful for instance to link by Euclidean distance starting from radial coordinates. If search_range is anisotropic, this parameter cannot be used.
- Yields:
- tuples (t, list of particle ids)
See also
Notes
This is an implementation of the Crocker-Grier linking algorithm. [1]
References
[1]Crocker, J.C., Grier, D.G. http://dx.doi.org/10.1006/jcis.1996.0217