trackpy.compute_drift

trackpy.compute_drift(traj, smoothing=0, pos_columns=['x', 'y'])

Return the ensemble drift, x(t).

Parameters:

traj : DataFrame of trajectories, including columns x, y, frame, and particle

smoothing : integer

Smooth the drift using a forward-looking rolling mean over this many frames.

Returns:

drift : DataFrame([x, y], index=frame)

Examples

>>> compute_drift(traj).plot() # Default smoothing usually smooths too much.
>>> compute_drift(traj, 0).plot() # not smoothed
>>> compute_drift(traj, 15).plot() # Try various smoothing values.
>>> drift = compute_drift(traj, 15) # Save good drift curves.
>>> corrected_traj = subtract_drift(traj, drift) # Apply them.