pysdic.Mesh.compute_vertices_neighborhood_statistics#

Mesh.compute_vertices_neighborhood_statistics(property, statistics)[source]#

Compute the specified statistics for the given property array defined at the vertices of a mesh based on the neighborhood information for each vertex.

Note

The function is a convenience wrapper around the pysdic.compute_neighborhood_statistics() function, which computes the neighborhood statistics for each vertex of a graph.

Important

  • vertices_neighborhood must be precomputed before calling this function.

Implemented statistics include:

Statistic

Description

mean

Compute the mean of the property values from the neighbors.

median

Compute the median of the property values from the neighbors.

min

Compute the minimum of the property values from the neighbors.

max

Compute the maximum of the property values from the neighbors.

std

Compute the standard deviation of the property values from the neighbors.

var

Compute the variance of the property values from the neighbors.

Q1

Compute the first quartile (25th percentile) of the property values from the neighbors.

Q3

Compute the third quartile (75th percentile) of the property values from the neighbors.

IQR

Compute the interquartile range (IQR) of the property values from the neighbors, defined as Q3 - Q1.

Parameters:
  • property (Union[str, ArrayLike]) – An array of shape \((N_v, P)\) containing the property values defined at the vertices of the mesh. If 1D-array is provided, it will be treated as a single-component property of shape \((N, 1)\). If a string, the property will be retrieved from the properties of the vertices using the string as a key.

  • statistics (Union[str, Sequence[str]]) – A string or a sequence of strings specifying the statistic(s) to compute for each vertex/element based on its neighbors.

Returns:

A dictionary where the keys are the names of the computed statistics and the values are arrays of shape \((N_v, P)\) containing the computed statistic values for each vertex and each property.

Return type:

Dict[str, numpy.ndarray]

Raises:
  • TypeError – If the input property array is not 1D or 2D. If the statistic parameter is not a string or a sequence of strings.

  • ValueError – If the statistic parameter contains an unsupported statistic name.

See also

pysdic.compute_neighborhood_statistics()

For more information on the algorithm used to compute the neighborhood statistics and an example of how to use it.