trackpy.motion.vanhove¶
- trackpy.motion.vanhove(pos, lagtime, mpp=1, ensemble=False, bins=24)¶
Compute the van Hove correlation (histogram of displacements).
The van Hove correlation function is simply a histogram of particle displacements. It is useful for detecting physical heterogeneity (or tracking errors).
- Parameters:
- posDataFrame
x or (or!) y positions, one column per particle, indexed by frame
- lagtimeinteger interval of frames
Compare the correlation function at this lagtime.
- mppmicrons per pixel, DEFAULT TO 1 because it is usually fine to use
pixels for this analysis
- ensembleboolean, defaults False
- binsinteger or sequence
Specify a number of equally spaced bins, or explicitly specifiy a sequence of bin edges. See np.histogram docs.
- Returns:
- vhDataFrame or Series
If ensemble=True, a DataFrame with each particle’s van Hove correlation function, indexed by displacement. If ensemble=False, a Series with the van Hove correlation function of the whole ensemble.
Examples
>>> pos = traj.set_index(['frame', 'particle'])['x'].unstack() # particles as columns >>> vh = vanhove(pos)