dupin.data.spatial¶
Overview
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
freudneighbor list.- Parameters:
expected_kwarg (
str, optional) – The expected key word argument passed todupin.data.base.DataModifier.__call__to use as neighbors. Defaults to “spatial_neighbors”.remove_kwargs (
bool, optional) – Whether the specifiedexpected_kwargshould be removed before passing through to the composed generators. Defaults toTrue.excluded_self (
bool, optional) – Whether the passed neighbor lists will exclude self neighbors.Truemeans self neighbors will be added by the instance, andFalsemeans the neighbor list provides self neighbors. Defaults toTrue. 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_selfshould be true.
Note
This class can remove neighbors from the call signature for generators or maps that don’t require it through the
remove_kwargargument.Note
The neighbors must be passed as a keyword argument for
NeighborAveragingto recognize it.- 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: