Metadata-Version: 2.1
Name: mesh2vec
Version: 1.0.1
Summary: mesh2vec
Author: Markus Stoll
Author-email: markus.stoll@renumics.com
Requires-Python: >=3.8,<3.12
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: cleo (>=2.0.1,<3.0.0)
Requires-Dist: ipython (>=8.10.0,<9.0.0)
Requires-Dist: joblib (>=1.2.0,<2.0.0)
Requires-Dist: lasso-python (>=1.5.2.post1,<2.0.0)
Requires-Dist: loguru (>=0.6.0,<0.7.0)
Requires-Dist: networkx (>=2.8.6,<3.0.0)
Requires-Dist: notebook (>=6.5.2,<7.0.0)
Requires-Dist: pandas (>=1.4.4,<2.0.0)
Requires-Dist: pillow (>=9.3.0,<10.0.0)
Requires-Dist: plotly (>=5.11.0,<6.0.0)
Requires-Dist: py (>=1.11.0,<2.0.0)
Requires-Dist: pyglet (>=1.5.26,<2.0.0)
Requires-Dist: scipy (>=1.9.1,<2.0.0)
Requires-Dist: trimesh (>=3.14.1,<4.0.0)
Requires-Dist: werkzeug (>=2.2.3,<3.0.0)
Description-Content-Type: text/markdown

Mesh2Vec
========

Quickstart
-----------

<h1 align="center">mesh2vec</h1>
<p align="center">Turn CAE Mesh Data Into Vectors</p>

<p align="center">
	<a href="https://github.com/renumics/mesh2vec"><img src="https://img.shields.io/github/license/renumics/mesh2vec" height="20"/></a>    
 	<a href="https://github.com/renumics/mesh2vec"><img src="https://img.shields.io/pypi/pyversions/renumics-mesh2vec" height="20"/></a>   
 	<a href="https://github.com/renumics/mesh2vec"><img src="https://img.shields.io/pypi/wheel/renumics-mesh2vec" height="20"/></a>   
</p>
<h3 align="center">
   <a href="https://renumics.github.io/mesh2vec/"><b>Latest Documentation</b></a>
</h3>

## 🚀 Introduction
Mesh2vec is a tool that facilitates the import of Computer-Aided Engineering (CAE) mesh data from [LS-DYNA](https://www.ansys.com/de-de/products/structures/ansys-ls-dyna) .
It utilizes various metrics of elements and their surrounding neighborhood to aggregate feature vectors for each element.

## ⏱️ Quickstart


### Installation
1. Create and activate a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/).
2. Use the following command to install mesh2vec into your environment:

```bash
pip install mesh2vec
```
3. Please make sure you have an environment variable ANSA_EXECUTABLE set pointing to your ANSA executable to use ANSA depended features like shell and feature import.

### Load Mesh
```python

from pathlib import Path
from mesh2vec.mesh2vec_cae import Mesh2VecCae
m2v = Mesh2VecCae.from_ansa_shell(4,
    Path("data/hat/Hatprofile.k"),
    json_mesh_file=Path("data/hat/cached_hat_key.json"))
```

### Add element features
```python
m2v.add_features_from_ansa(
    ["aspect", "warpage"],
    Path("data/hat/Hatprofile.k"),
    json_mesh_file=Path("data/hat/cached_hat_key.json"))
```

### Aggregate
```python
import numpy as np
m2v.aggregate("aspect", [0,2,3], np.nanmean)
```

### Extract Feature Vectors
```python
m2v.to_dataframe()
```
![data frame with feature vectors](docs/source/_static/m2v.to_df.png)

### Optional: Visualize a single aggregated feature on mesh
```python
m2v.get_visualization_plotly("aspect-nanmean-2")
```
![3d mesh plot of agggredated](docs/source/_static/hat_aspect_3_plot.png)



