Skip to content

Commit c862997

Browse files
authored
Merge pull request #7 from Renumics/performance_01
Performance 01
2 parents 43d7308 + 80eeca7 commit c862997

14 files changed

+1095
-153
lines changed

.github/workflows/workflow.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
python-version: "3.9"
6060
- name: check
6161
run: |
62-
poetry run pylint mesh2vec tests scripts docs/examples
62+
poetry run pylint mesh2vec tests docs/examples
6363
6464
audit:
6565
needs: [prepare-linux, prepare-win]
@@ -95,7 +95,7 @@ jobs:
9595
python-version: ${{ matrix.python-version }}
9696
- name: test
9797
run: |
98-
poetry run sphinx-build docs/source build/documentation/ -W -b html # autodocs contain tests && poetry run sphinx-build docs/source build/documentation/ -W -b doctest
98+
poetry run sphinx-build docs/source build/documentation/ -W -b html && poetry run sphinx-build docs/source build/documentation/ -W -b doctest
9999
100100
unit-tests:
101101
needs: [prepare-linux, prepare-win]

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
/docs/source/generated*
55
__pycache__
66
/data/tmp_*
7-
/data/*internal*
7+
/data/*internal*
8+
.DS_Store
9+
.venv/
10+
.ipynb_checkpoints
11+
data/data/temp_hg.joblib

docs/examples/plot_stress.py

+11-21
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# pylint: disable=pointless-statement
77
from pathlib import Path
88
import numpy as np
9-
import pandas as pd
109
from lasso.dyna import ArrayType
1110
from mesh2vec.mesh2vec_cae import Mesh2VecCae
1211

@@ -19,34 +18,25 @@
1918
Path("../../data/hat/Hatprofile.k"),
2019
json_mesh_file=Path("../../data/hat/cached_hat_key.json"),
2120
)
22-
hg.add_feature_from_d3plot(
21+
22+
23+
def mean_over_components_all_layers(v):
24+
"""get mean over all components and all layers"""
25+
return np.mean(v, axis=-1)
26+
27+
28+
fature_name = hg.add_feature_from_d3plot(
2329
ArrayType.element_shell_stress,
2430
Path("../../data/hat/HAT.d3plot"),
25-
timestep=1,
26-
shell_layer=0,
31+
timestep=-1,
32+
shell_layer=mean_over_components_all_layers,
2733
)
2834

2935

30-
# %%
31-
# Plot Feature locally
32-
# ------------------------
33-
hg.add_features_from_dataframe(
34-
pd.DataFrame(
35-
{
36-
"vtx_id": hg.vtx_ids(),
37-
"y-stress": [v[1] for v in hg.features()[ArrayType.element_shell_stress + "_1_0"]],
38-
}
39-
)
40-
)
41-
name = hg.aggregate("y-stress", 0, np.mean)
42-
fig = hg.get_visualization_plotly(str(name))
43-
fig.update_layout(title=name)
44-
fig
45-
4636
# %%
4737
# Aggregate Feature and plot
4838
# ---------------------------
49-
name = hg.aggregate("y-stress", 1, np.mean)
39+
name = hg.aggregate(fature_name, 1, lambda x: np.mean(np.mean(x)))
5040
fig = hg.get_visualization_plotly(str(name))
5141
fig.update_layout(title=name)
5242
fig

0 commit comments

Comments
 (0)