Skip to content

Commit c0d0655

Browse files
author
Renumics
authored
Merge pull request #1 from Renumics/feature/new_readme
Feature/new readme
2 parents 320635d + 23b41b5 commit c0d0655

File tree

10 files changed

+249
-233
lines changed

10 files changed

+249
-233
lines changed

.github/actions/ci-setup/action.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ runs:
1313
using: composite
1414
steps:
1515
- name: Set up Python ${{ inputs.python-version }}
16-
uses: actions/setup-python@v3
16+
uses: actions/setup-python@v4
1717
with:
1818
python-version: ${{ inputs.python-version }}
1919
- name: Install Poetry
@@ -26,7 +26,9 @@ runs:
2626
if: runner.os == 'Windows'
2727
run: echo "C:/Users/runneradmin/.local/bin" >> $GITHUB_PATH
2828
shell: bash
29-
29+
- name: add dynamic versioning
30+
run: poetry self add "poetry-dynamic-versioning[plugin]"
31+
shell: bash
3032
- name: Cache Packages
3133
id: poetry-cache
3234
uses: actions/cache@v3
@@ -39,6 +41,3 @@ runs:
3941
if: steps.poetry-cache.outputs.cache-hit != 'true'
4042
run: poetry install
4143
shell: bash
42-
- name: add dynamic versioning
43-
run: poetry self add "poetry-dynamic-versioning[plugin]"
44-
shell: bash

.github/workflows/workflow.yml

+29-24
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,6 @@ jobs:
7979
run: |
8080
poetry run pip-audit --ignore-vuln GHSA-w596-4wvx-j9j6
8181
82-
docs:
83-
needs: prepare-linux
84-
runs-on: ubuntu-latest
85-
steps:
86-
- uses: actions/checkout@v3
87-
- name: Setup CI
88-
uses: './.github/actions/ci-setup'
89-
with:
90-
os: "ubuntu-latest"
91-
python-version: "3.9"
92-
- name: build docs
93-
run: |
94-
poetry run sphinx-build docs/source build/documentation/ -W -b html
95-
9682
doctest:
9783
needs: [prepare-linux, prepare-win]
9884
strategy:
@@ -129,6 +115,25 @@ jobs:
129115
run: |
130116
poetry run pytest tests
131117
118+
docs:
119+
needs: prepare-linux
120+
runs-on: ubuntu-latest
121+
steps:
122+
- uses: actions/checkout@v3
123+
- name: Setup CI
124+
uses: './.github/actions/ci-setup'
125+
with:
126+
os: "ubuntu-latest"
127+
python-version: "3.9"
128+
- name: build docs
129+
run: |
130+
poetry run sphinx-build docs/source build/documentation/ -W -b html
131+
- name: Store docs
132+
uses: actions/upload-artifact@v3
133+
with:
134+
name: docs
135+
path: build/documentation/
136+
132137
build:
133138
needs: prepare-linux
134139
runs-on: ubuntu-latest
@@ -146,11 +151,12 @@ jobs:
146151
uses: actions/upload-artifact@v3
147152
with:
148153
name: dist
149-
path: dist
154+
path: dist/
150155

151156

152157
release-docs:
153-
needs: prepare-linux
158+
if: startsWith(github.ref, 'refs/tags/v')
159+
needs: [ check-format, build, unit-tests, doctest, docs, audit, pylint ]
154160
runs-on: ubuntu-latest
155161
steps:
156162
- uses: actions/checkout@v3
@@ -159,9 +165,11 @@ jobs:
159165
with:
160166
os: "ubuntu-latest"
161167
python-version: "3.9"
162-
- name: build docs
163-
run: |
164-
poetry run sphinx-build docs/source build/documentation/ -W -b html
168+
- name: Download docs
169+
uses: actions/download-artifact@v3
170+
with:
171+
name: docs
172+
path: build/documentation/
165173
- name: Deploy
166174
uses: peaceiris/actions-gh-pages@v3
167175
with:
@@ -179,17 +187,14 @@ jobs:
179187
with:
180188
os: "ubuntu-latest"
181189
python-version: "3.9"
182-
- name: build wheels
183-
run: |
184-
poetry build -f wheel -vvv && poetry run check-wheel-contents dist/
185190
- name: Download wheels
186191
uses: actions/download-artifact@v3
187192
with:
188193
name: dist
194+
path: dist/
189195
- name: Publish package to TestPyPI
190196
uses: pypa/gh-action-pypi-publish@release/v1
191197
with:
192-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
193-
repository_url: https://test.pypi.org/legacy/
198+
password: ${{ secrets.PYPI_API_TOKEN }}
194199

195200

README.md

+65-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,71 @@
11
Mesh2Vec
22
========
33

4-
Installation
5-
-------------
4+
Quickstart
5+
-----------
6+
7+
<h1 align="center">mesh2vec</h1>
8+
<p align="center">Turn CAE Mesh Data Into Vectors</p>
9+
10+
<p align="center">
11+
<a href="https://github.com/renumics/mesh2vec"><img src="https://img.shields.io/github/license/renumics/mesh2vec" height="20"/></a>
12+
<a href="https://github.com/renumics/mesh2vec"><img src="https://img.shields.io/pypi/pyversions/renumics-mesh2vec" height="20"/></a>
13+
<a href="https://github.com/renumics/mesh2vec"><img src="https://img.shields.io/pypi/wheel/renumics-mesh2vec" height="20"/></a>
14+
</p>
15+
<h3 align="center">
16+
<a href="https://renumics.github.io/mesh2vec/"><b>Latest Documentation</b></a>
17+
</h3>
18+
19+
## 🚀 Introduction
20+
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) .
21+
It utilizes various metrics of elements and their surrounding neighborhood to aggregate feature vectors for each element.
22+
23+
## ⏱️ Quickstart
24+
25+
26+
### Installation
627
1. Create and activate a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/).
728
2. Use the following command to install mesh2vec into your environment:
8-
``pip install mesh2vec``
929

10-
Documentation
11-
---------------
12-
[Documentation](https://readthedocs.org/...)
30+
```bash
31+
pip install mesh2vec
32+
```
33+
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.
34+
35+
### Load Mesh
36+
```python
37+
38+
from pathlib import Path
39+
from mesh2vec.mesh2vec_cae import Mesh2VecCae
40+
m2v = Mesh2VecCae.from_ansa_shell(4,
41+
Path("data/hat/Hatprofile.k"),
42+
json_mesh_file=Path("data/hat/cached_hat_key.json"))
43+
```
44+
45+
### Add element features
46+
```python
47+
m2v.add_features_from_ansa(
48+
["aspect", "warpage"],
49+
Path("data/hat/Hatprofile.k"),
50+
json_mesh_file=Path("data/hat/cached_hat_key.json"))
51+
```
52+
53+
### Aggregate
54+
```python
55+
import numpy as np
56+
m2v.aggregate("aspect", [0,2,3], np.nanmean)
57+
```
58+
59+
### Extract Feature Vectors
60+
```python
61+
m2v.to_dataframe()
62+
```
63+
![data frame with feature vectors](docs/source/_static/m2v.to_df.png)
64+
65+
### Optional: Visualize a single aggregated feature on mesh
66+
```python
67+
m2v.get_visualization_plotly("aspect-nanmean-2")
68+
```
69+
![3d mesh plot of agggredated](docs/source/_static/hat_aspect_3_plot.png)
70+
71+

docs/examples/quickstart.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""
2+
Quick Start Example
3+
====================
4+
"""
5+
# pylint: disable=pointless-statement
6+
from pathlib import Path
7+
import numpy as np
8+
from mesh2vec.mesh2vec_cae import Mesh2VecCae
9+
10+
11+
# %%
12+
# Load Shell from ANSA
13+
# -----------------------------------------------------
14+
m2v = Mesh2VecCae.from_ansa_shell(
15+
4,
16+
Path("../../data/hat/Hatprofile.k"),
17+
json_mesh_file=Path("../../data/hat/cached_hat_key.json"),
18+
)
19+
20+
# %%
21+
# Add element features
22+
# ------------------------
23+
m2v.add_features_from_ansa(
24+
["aspect", "warpage"],
25+
Path("../../data/hat/Hatprofile.k"),
26+
json_mesh_file=Path("../../data/hat/cached_hat_key.json"),
27+
)
28+
29+
30+
# %%
31+
# Aggregate
32+
# ---------------------------
33+
m2v.aggregate("aspect", [0, 2, 3], np.nanmean)
34+
35+
36+
# %%
37+
# Extract Feature Vector
38+
# -----------------------
39+
m2v.to_dataframe()
40+
41+
42+
# %%
43+
# Visualize a single feature
44+
# ---------------------------
45+
m2v.get_visualization_plotly("aspect-nanmean-2")
163 KB
Loading

docs/source/_static/m2v.to_df.png

41.2 KB
Loading

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
88

99
project = "Mesh2vec"
10-
copyright = "2022, Renumics GmbH"
10+
copyright = "2023, Renumics GmbH"
1111
author = "Renumics GmbH"
1212
from sphinx_gallery.sorting import FileNameSortKey
1313

docs/source/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Welcome to mesh2vec's documentation!
77
=====================================
88

9-
Check out the examples to make your first steps.
9+
Check out the `Quickstart <https://github.com/Renumics/mesh2vec>`_ to make your first steps.
1010

1111
Please make sure you have an environment variable `ANSA_EXECUTABLE` set pointing to your ANSA executable
1212
to use ANSA depended features like shell and feature import.

0 commit comments

Comments
 (0)