trackpy.vanhove

trackpy.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:

pos : DataFrame

x or (or!) y positions, one column per particle, indexed by frame

lagtime : integer interval of frames

Compare the correlation function at this lagtime.

mpp : microns per pixel, DEFAULT TO 1 because it is usually fine to use

pixels for this analysis

ensemble : boolean, defaults False

bins : integer or sequence

Specify a number of equally spaced bins, or explicitly specifiy a sequence of bin edges. See np.histogram docs.

Returns:

vh : DataFrame 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)