trackpy.static.pair_correlation_2d

trackpy.static.pair_correlation_2d(feat, cutoff, fraction=1.0, dr=0.5, p_indices=None, ndensity=None, boundary=None, handle_edge=True, max_rel_ndensity=10)

Calculate the pair correlation function in 2 dimensions.

Parameters:
featPandas DataFrame

DataFrame containing the x and y coordinates of particles

cutofffloat

Maximum distance to calculate g(r)

fractionfloat, optional

The fraction of particles to calculate g(r) with. May be used to increase speed of function. Particles selected at random.

drfloat, optional

The bin width

p_indiceslist or ndarray, optional

Only consider a pair of particles if one of them is in ‘p_indices’. Uses zero-based indexing, regardless of how ‘feat’ is indexed.

ndensityfloat, optional

Density of particle packing. If not specified, density will be calculated assuming rectangular homogeneous arrangement.

boundarytuple, optional

Tuple specifying rectangular prism boundary of particles (xmin, xmax, ymin, ymax). Must be floats. Default is to assume a rectangular packing. Boundaries are determined by edge particles.

handle_edgeboolean, optional

If true, compensate for reduced area around particles near the edges.

max_rel_ndensitynumber, optional

The relative maximum density deviation, used to estimate the maximum number of neighbours. Lower numbers increase performance, until the method fails because there are more neighbours than expected.

Returns:
r_edgesarray

The bin edges, with 1 more element than g_r.

g_rarray

The values of g_r.