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
xandyand optionallyzin mm. The target index is preserved in mapped results.
See also
pylife.mesh.meshsignal.PlainMeshDefine the coordinate signal required for source and target meshes.
scipy.interpolate.griddataInterpolate unstructured point data.
Notes
The accessed DataFrame is the interpolation target. The source DataFrame passed to
process()must also be accessible as aPlainMesh.- 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_keyand 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_keyand the same index as the target mesh. Values carry the same unit as the source column, for example MPa for stress.- Return type:
Notes
The interpolation is purely geometrical and ignores finite-element connectivity. Points outside the convex hull of the source coordinates receive
NaNfor methods such as'linear'; use'nearest'if extrapolated nearest-neighbor values are acceptable.