The Meshmapper class#

class pylife.mesh.Meshmapper(pandas_obj)[source]#

Interpolate values from one mesh to another mesh.

Parameters:

pandas_obj (pandas.DataFrame) – Target point cloud or mesh with coordinate columns x and y and optionally z in mm. The target index is preserved in mapped results.

See also

pylife.mesh.meshsignal.PlainMesh

Define the coordinate signal required for source and target meshes.

scipy.interpolate.griddata

Interpolate unstructured point data.

Notes

The accessed DataFrame is the interpolation target. The source DataFrame passed to process() must also be accessible as a PlainMesh.

process(from_df, value_key, method='linear')[source]#

Map a scalar value column from a source mesh to the target mesh.

Parameters:
  • from_df (pandas.DataFrame) – Source point cloud or mesh with the same coordinate columns and spatial dimension as the target. It must contain value_key and coordinate columns in mm.

  • value_key (str) – Name of the scalar column to interpolate, for example stress in MPa.

  • method (str, optional) – Interpolation method passed to scipy.interpolate.griddata(). Common choices are 'linear', 'nearest' and 'cubic'; availability depends on the spatial dimension. Default is 'linear'.

Returns:

DataFrame with one column named value_key and the same index as the target mesh. Values carry the same unit as the source column, for example MPa for stress.

Return type:

pandas.DataFrame

Notes

The interpolation is purely geometrical and ignores finite-element connectivity. Points outside the convex hull of the source coordinates receive NaN for methods such as 'linear'; use 'nearest' if extrapolated nearest-neighbor values are acceptable.