The Gradient class

class pylife.mesh.Gradient(pandas_obj)[source]

Computes the gradient of a value in a triangular 3D mesh

Accesses a mesh registered in meshsignal

Raises:
  • AttributeError – if at least one of the columns x, y is missing

  • AttributeError – if the index of the DataFrame is not a two level MultiIndex with the names node_id and element_id

Notes

The gradient is calculated by fitting a plane into the nodes of each coordinate and the neighbor nodes using least square fitting.

The method is described in a thread on stackoverflow.

gradient_of(value_key)[source]

returns the gradient

Parameters:

value_key (str) – The key of the value that forms the gradient. Needs to be found in df

Returns:

gradient – A table describing the gradient indexed by node_id. The keys for the components of the gradients are ['d{value_key}_dx', 'd{value_key}_dy', 'd{value_key}_dz'].

Return type:

pd.DataFrame