Quick Start Example

# pylint: disable=pointless-statement
from pathlib import Path
import numpy as np
from mesh2vec.mesh2vec_cae import Mesh2VecCae

Load Shell from ANSA

m2v = Mesh2VecCae.from_ansa_shell(
    4,
    Path("../../data/hat/Hatprofile.k"),
    json_mesh_file=Path("../../data/hat/cached_hat_key.json"),
)

Add element features

m2v.add_features_from_ansa(
    ["aspect", "warpage"],
    Path("../../data/hat/Hatprofile.k"),
    json_mesh_file=Path("../../data/hat/cached_hat_key.json"),
)
['aspect', 'warpage']

Aggregate

m2v.aggregate("aspect", [0, 2, 3], np.nanmean)
['aspect-nanmean-0', 'aspect-nanmean-2', 'aspect-nanmean-3']

Extract Feature Vector

m2v.to_dataframe()
vtx_id aspect-nanmean-0 aspect-nanmean-2 aspect-nanmean-3
0 4700000 1.059380 1.031437 1.022930
1 4700001 1.059379 1.031446 1.022950
2 4700002 1.059005 1.031635 1.023236
3 4700003 1.013129 1.113148 1.223267
4 4700004 1.010529 1.151260 1.062500
... ... ... ... ...
6395 2002173 1.000000 1.000000 1.000000
6396 2002174 1.000000 1.000000 1.000000
6397 2002175 1.000000 1.000000 1.000000
6398 2002176 1.000000 1.000000 1.000000
6399 2002177 1.000000 1.000000 1.000000

6400 rows × 4 columns



Visualize a single feature

m2v.get_visualization_plotly("aspect-nanmean-2")


Total running time of the script: ( 0 minutes 0.858 seconds)

Gallery generated by Sphinx-Gallery