Aggregate Number of Borders Categorical

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

Load Shell and features from ANSA

hg = Mesh2VecCae.from_ansa_shell(
    2,
    Path("../../data/hat/Hatprofile.k"),
    json_mesh_file=Path("../../data/hat/cached_hat_key.json"),
)
hg.add_features_from_ansa(
    ["num_border", "is_tria", "midpoint"],
    ansafile=None,
)
['num_border', 'is_tria', 'midpoint']

Plot Feature locally

name = hg.aggregate("num_border", 0, np.mean)
fig = hg.get_visualization_plotly(str(name))
fig.update_layout(title=name)
fig


Aggregate Feature and plot

names = hg.aggregate_categorical("num_border", 1)
NAME = "num_border-cat-1-1"
fig = hg.get_visualization_plotly(str(name))
fig.update_layout(title=NAME)
fig


Access the results

hg.to_dataframe()
vtx_id num_border-mean-0 num_border-cat-0-1 num_border-cat-1-1 num_border-cat-2-1
0 4700000 0 8 0 0
1 4700001 0 8 0 0
2 4700002 0 8 0 0
3 4700003 0 8 0 0
4 4700004 0 8 0 0
... ... ... ... ... ...
6395 2002173 0 8 0 0
6396 2002174 0 8 0 0
6397 2002175 0 8 0 0
6398 2002176 0 8 0 0
6399 2002177 0 8 0 0

6400 rows × 5 columns



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

Gallery generated by Sphinx-Gallery