trackpy.link_df_iter¶
- trackpy.link_df_iter(f_iter, search_range, pos_columns=None, t_column='frame', 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 DataFrames into trajectories.
- Parameters:
- f_iteriterable of DataFrames
Each DataFrame must include any number of column(s) for position and a column of frame numbers. By default, ‘x’ and ‘y’ are expected for position, and ‘frame’ is expected for frame number. For optimal performance, explicitly specify the column names using pos_columns and t_column kwargs.
- search_rangefloat or tuple
the maximum distance features can move between frames, optionally per dimension
- pos_columnslist of str, optional
Default is [‘y’, ‘x’], or [‘z’, ‘y’, ‘x’] when ‘z’ is present in f If this is not supplied, f_iter will be investigated, which might cost performance. For optimal performance, always supply this parameter.
- t_columnstr, optional
Default is ‘frame’
- memoryinteger, optional
the maximum number of frames during which a feature can vanish, then reappear nearby, and be considered the same particle. 0 by default.
- 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’, ‘numba’, ‘hybrid’, ‘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:
- DataFrames with added column ‘particle’ containing trajectory labels
See also