.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated_examples/quickstart.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_examples_quickstart.py: Quick Start Example ==================== .. GENERATED FROM PYTHON SOURCE LINES 5-12 .. code-block:: default # pylint: disable=pointless-statement from pathlib import Path import numpy as np from mesh2vec.mesh2vec_cae import Mesh2VecCae .. GENERATED FROM PYTHON SOURCE LINES 13-15 Load Shell from ANSA ----------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 15-21 .. code-block:: default m2v = Mesh2VecCae.from_ansa_shell( 4, Path("../../data/hat/Hatprofile.k"), json_mesh_file=Path("../../data/hat/cached_hat_key.json"), ) .. GENERATED FROM PYTHON SOURCE LINES 22-24 Add element features ------------------------ .. GENERATED FROM PYTHON SOURCE LINES 24-31 .. code-block:: default m2v.add_features_from_ansa( ["aspect", "warpage"], Path("../../data/hat/Hatprofile.k"), json_mesh_file=Path("../../data/hat/cached_hat_key.json"), ) .. rst-class:: sphx-glr-script-out .. code-block:: none ['aspect', 'warpage'] .. GENERATED FROM PYTHON SOURCE LINES 32-34 Aggregate --------------------------- .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: default m2v.aggregate("aspect", [0, 2, 3], np.nanmean) .. rst-class:: sphx-glr-script-out .. code-block:: none ['aspect-nanmean-0', 'aspect-nanmean-2', 'aspect-nanmean-3'] .. GENERATED FROM PYTHON SOURCE LINES 38-40 Extract Feature Vector ----------------------- .. GENERATED FROM PYTHON SOURCE LINES 40-43 .. code-block:: default m2v.to_dataframe() .. raw:: html
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



.. GENERATED FROM PYTHON SOURCE LINES 44-46 Visualize a single feature --------------------------- .. GENERATED FROM PYTHON SOURCE LINES 46-47 .. code-block:: default m2v.get_visualization_plotly("aspect-nanmean-2") .. raw:: html


.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.858 seconds) .. _sphx_glr_download_generated_examples_quickstart.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: quickstart.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: quickstart.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_