yt.utilities.math_utils.periodic_dist

yt.utilities.math_utils.periodic_dist(a, b, period, periodicity=(True, True, True))[source]

Find the Euclidean periodic distance between two sets of points.

Parameters:

a : array or list

Either an ndim long list of coordinates corresponding to a single point or an (ndim, npoints) list of coordinates for many points in space.

b : array of list

Either an ndim long list of coordinates corresponding to a single point or an (ndim, npoints) list of coordinates for many points in space.

period : float or array or list

If the volume is symmetrically periodic, this can be a single float, otherwise an array or list of floats giving the periodic size of the volume for each dimension.

periodicity : An ndim-element tuple of booleans

If an entry is true, the domain is assumed to be periodic along that direction.

Examples

>>> a = [0.1, 0.1, 0.1]
>>> b = [0.9, 0,9, 0.9]
>>> period = 1.
>>> dist = periodic_dist(a, b, 1.)
>>> dist
0.346410161514