dupin.data.spatial#

Overview

NeighborAveraging

Average distribution about neighboring data points.

Details

Spatial averaging DataMap classes.

class dupin.data.spatial.NeighborAveraging(expected_kwarg='spatial_neighbors', remove_kwarg=True, excluded_self=True)[source]#

Average distribution about neighboring data points.

Uses neighbors for spatial averaging across a system. Neighbors can be passed in manually in an array of \((i, j)\) pairs, through a tuple of arrays, or through a freud neighbor list.

Parameters:
  • expected_kwarg (str, optional) – The expected key word argument passed to dupin.data.base.DataModifier.__call__ to use as neighbors. Defaults to “spatial_neighbors”.

  • remove_kwargs (bool, optional) – Whether the specified expected_kwarg should be removed before passing through to the composed generators. Defaults to True.

  • excluded_self (bool, optional) – Whether the passed neighbor lists will exclude self neighbors. True means self neighbors will be added by the instance, and False means the neighbor list provides self neighbors. Defaults to True. If set incorrectly this will cause erroneous results (double or no counting).

  • Warning – A particle should be listed as its own neighbor for purposes of the averaging. So if the passed neighbor list does not include self neighbors excluded_self should be true.

Note

This class can remove neighbors from the call signature for generators or maps that don’t require it through the remove_kwarg argument.

Note

The neighbors must be passed as a keyword argument for NeighborAveraging to recognize it.

__init__(expected_kwarg='spatial_neighbors', remove_kwarg=True, excluded_self=True)[source]#
compute(data)[source]#

Perform spatial averaging using provided neighbors.

Parameters:

distribution (\((N,)\) numpy.ndarray of float) – The array representing a distribution to spatially average.

Returns:

signals – A dictionary with the key “spatially_averaged” and spatially averaged distribution as a value.

Return type:

dict[str, numpy.ndarray]

update(args, kwargs)[source]#

Call the underlying generator performing the spatial averaging.

The call signature is the same as the composed generator with the addition of the expected_kwarg.