Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: test
run: |
poetry run sphinx-build docs/source build/documentation/ -W -vvv -b doctest
poetry run sphinx-build docs/source build/documentation/ -W -b doctest

unit-test:
name: "🧪 Run Unit Tests"
Expand All @@ -139,7 +139,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: test
run: |
poetry run pytest -vv -s --tb=long tests
poetry run pytest -s --tb=long tests

build-docs:
name: "🧱 Build Documentation"
Expand All @@ -154,7 +154,7 @@ jobs:
python-version: "3.13"
- name: build docs
run: |
poetry run sphinx-build docs/source build/documentation/ -W -vvv -b html
poetry run sphinx-build docs/source build/documentation/ -W -b html
- name: Store docs
uses: actions/upload-artifact@v5
with:
Expand Down Expand Up @@ -199,6 +199,22 @@ jobs:
- name: check wheel contents
run: poetry run check-wheel-contents dist/

check-version:
name: "🔍 Check Version"
if: startsWith(github.ref, 'refs/tags/v')
needs: prepare-linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup CI
uses: "./.github/actions/ci-setup"
with:
os: "ubuntu-latest"
python-version: "3.13"
- name: check version
run: |
[ "${GITHUB_REF_NAME#v}" = "$(poetry version -s)" ] || { echo "ERROR: Package version mismatches the git tag!" >&2; exit 1; }

release-docs:
name: "🚀 Release Documentation"
if: startsWith(github.ref, 'refs/tags/v')
Expand All @@ -211,6 +227,7 @@ jobs:
- doctest
- build-wheel
- check-wheel
- check-version
- build-docs
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -238,6 +255,7 @@ jobs:
- doctest
- build-wheel
- check-wheel
- check-version
- build-docs
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
poetry 2.2.1
python 3.14.0
python 3.13.9
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ check: check-format lint typecheck audit

.PHONY: doctest
doctest: ## Run doctests
poetry run sphinx-build docs/source build/documentation/ -W -vvv -b doctest
poetry run sphinx-build docs/source build/documentation/ -W -b doctest

.PHONY: unit-test
unit-test: ## Run unit tests
poetry run pytest -vv -s --tb=long tests
poetry run pytest -s --tb=long tests

.PHONY: test
test: ## Run all tests
Expand All @@ -60,7 +60,7 @@ check-wheel: wheel

.PHONY: docs
docs: ## Build documentation
poetry run sphinx-build docs/source build/documentation/ -W -vvv -b html
poetry run sphinx-build docs/source build/documentation/ -W -b html

.PHONY: build
build: ## Build all distributables
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
Mesh2Vec
========
# Mesh2Vec

Quickstart
-----------
## Quickstart

<h1 align="center">mesh2vec</h1>
<p align="center">Turn CAE mesh data into aggregated element feature vectors for ML</p>
Expand All @@ -17,23 +15,26 @@ Quickstart
</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 quality metrics of elements and their surrounding neighborhood to aggregate feature vectors for each element. These feature vectors are of equal length and can be effectively utilized as inputs for machine learning methods. This represents a simpler and more efficient alternative to traditional mesh and graph-based approaches for automatic mesh quality analysis.

## ⏱️ 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.
4. You may temporarily need to set an environment variable SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True.

### Load Mesh

```python

from pathlib import Path
Expand All @@ -44,6 +45,7 @@ m2v = Mesh2VecCae.from_ansa_shell(4,
```

### Add element features

```python
m2v.add_features_from_ansa(
["aspect", "warpage"],
Expand All @@ -52,21 +54,24 @@ m2v.add_features_from_ansa(
```

### 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)


![3d mesh plot of agggredated](docs/source/_static/hat_aspect_3_plot.png)
8 changes: 4 additions & 4 deletions docs/source/sg_execution_times.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Computation times
=================
**00:00.000** total execution time for 5 files **from all galleries**:
**00:00.883** total execution time for 5 files **from all galleries**:

.. container::

Expand All @@ -32,6 +32,9 @@ Computation times
* - Example
- Time
- Mem (MB)
* - :ref:`sphx_glr_generated_examples_plot_stress.py` (``../examples/plot_stress.py``)
- 00:00.883
- 0.0
* - :ref:`sphx_glr_generated_examples_aggregate_categorical.py` (``../examples/aggregate_categorical.py``)
- 00:00.000
- 0.0
Expand All @@ -41,9 +44,6 @@ Computation times
* - :ref:`sphx_glr_generated_examples_plot_neighbor_distances.py` (``../examples/plot_neighbor_distances.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_generated_examples_plot_stress.py` (``../examples/plot_stress.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_generated_examples_quickstart.py` (``../examples/quickstart.py``)
- 00:00.000
- 0.0
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 41 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
[tool.poetry]
[project]
name = "mesh2vec"
version = "0.0.2"
authors = ["Renumics GmbH <info@renumics.com>"]
description = "Aggregate feature vectors on CAE meshes."
authors = [
{name = "Renumics GmbH",email = "info@renumics.com"}
]
license = "MIT"
readme = "README.md"
requires-python = ">=3.11,<4.0"
dependencies = [
"scipy (>=1.15.0,<2.0.0)",
"pandas (>=2.3.0,<3.0.0)",
"trimesh (>=4.6.0,<5.0.0)",
"lasso-python (>=2.0.4,<3.0.0)",
"networkx (>=3.5.0,<4.0.0)",
"loguru (>=0.7.0,<1.0.0)",
"plotly (>=5.24.0,<6.0.0)",
"joblib (>=1.5.0,<2.0.0)",
"numpy (>=2.2.2,<3.0.0)"
]
dynamic = ["version"]

[dependency-groups]
dev = [
"sphinx (>=8.2.0,<9.0.0)",
"sphinx-autobuild (>=2025.8.25,<2026.0.0)",
"sphinx-rtd-theme (>=3.0.0,<4.0.0)",
"sphinx-gallery (>=0.19.0,<1.0.0)",
"pylint (>=4.0.0,<5.0.0)",
"mypy (>=1.18.2,<2.0.0)",
"check-wheel-contents (>=0.6.3,<1.0.0)",
"pip-audit (>=2.9.0,<3.0.0)",
"pytest (>=8.4.2,<9.0.0)",
"black (>=25.9.0,<26.0.0)",
"matplotlib (>=3.10.1,<4.0.0)",
"ipython (>=9.0.0,<10.0.0)",
"notebook (>=7.4.7,<8.0.0)"
]

[tool.poetry]
packages = [
{ include = "mesh2vec" }
]
readme = "README.md"
description = "mesh2vec"

[tool.poetry.dependencies]
python = "^3.11"
scipy = "^1.15.0"
pandas = "^2.3.0"
trimesh = "^4.6.0"
lasso-python = "^2.0.4"
networkx = "^3.5.0"
loguru = "^0.7.0"
plotly = "^5.24.0"
joblib = "^1.5.0"
numpy = "^2.2.2"

[tool.poetry.group.dev.dependencies]
sphinx = "^8.2.0"
sphinx-autobuild = "^2025.8.25"
sphinx-rtd-theme = "^3.0.0"
sphinx-gallery = "^0.19.0"
pylint = "^4.0.0"
mypy = "^1.18.2"
check-wheel-contents = "^0.6.3"
pip-audit = "^2.9.0"
pytest = "^8.4.2"
black = "^25.9.0"
matplotlib = "^3.10.1"
ipython = "^9.0.0"
notebook = "^7.4.7"
version = "0.0.0"

[tool.poetry-dynamic-versioning]
enable = true
Expand All @@ -55,5 +63,5 @@ ignore_missing_imports = true
disallow_untyped_defs = true

[build-system]
requires = ["poetry-core>=1.2.2", "poetry-dynamic-versioning"]
requires = ["poetry-core>=2.0.0,<3.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"