Skip to content

Commit f4db65f

Browse files
committed
Add workflow for reproducing results and update results due to changes in the underlying ldrb package
1 parent 4b845f7 commit f4db65f

File tree

5 files changed

+67
-10
lines changed

5 files changed

+67
-10
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Reproduce results
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
branches: ["main"]
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
workflow_call:
13+
14+
15+
jobs:
16+
run:
17+
runs-on: ubuntu-22.04
18+
container:
19+
image: ghcr.io/scientificcomputing/fenics-gmsh:2023-08-16
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Cache
25+
id: cache
26+
uses: actions/cache@v3
27+
with:
28+
path: |
29+
~/.cache/pip
30+
key: cache_v1
31+
restore-keys: |
32+
cache_v1
33+
34+
- name: Install dependencies
35+
run: python3 -m pip install -r requirements.txt
36+
37+
- name: Download data
38+
run: cd data && bash download_data.sh && cd ..
39+
40+
- name: Run pre-processing
41+
run: cd code && python3 pre_processing.py && cd ..
42+
43+
- name: Run simulation
44+
run: cd code && python3 run_fiber_generation.py && cd ..
45+
46+
- name: Postprocess
47+
run: cd code && python3 postprocess.py && cd ..
48+
49+
- name: Upload artifact
50+
if: always()
51+
uses: actions/upload-artifact@v3
52+
with:
53+
path: |
54+
./data/mesh
55+
./code/results
56+
if-no-files-found: error

code/postprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def check_results(features_path: Path, features: dict):
6464
# Check each (key, value) pair in the features and check they are
6565
# within machine precision
6666
for key in expected_features.keys():
67-
if not np.isclose(expected_features[key], features[key]):
67+
if not np.isclose(expected_features[key], features[key], rtol=1e-8):
6868
logger.error(f"{key}: {expected_features[key]}!={features[key]}")
6969
reproducible = False
7070

code/results/features_01.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"size": 4713,
3-
"min": -0.9986740049294516,
4-
"max": 0.9997579018328593,
5-
"mean": 0.08134810142530069,
6-
"std": 0.5715906050031196
3+
"min": -0.9989439046376276,
4+
"max": 0.9997658401474652,
5+
"mean": -0.001603664479271975,
6+
"std": 0.5773480419933641
77
}

code/results/features_02.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"size": 139263,
3-
"min": -0.9999307486841351,
4-
"max": 0.99999840073201,
5-
"mean": 0.05442689976746109,
6-
"std": 0.5747791279396253
3+
"min": -0.9999985280667274,
4+
"max": 0.9999988537980897,
5+
"mean": -0.07252592808131289,
6+
"std": 0.57277685148967
77
}

data/download_data.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

33
# Removing the dl=0 from the end of the shared link from dropbox
4-
curl -L https://www.dropbox.com/s/6bkbw6v269dyfie/data.tar -o data.tar
4+
# curl -L https://www.dropbox.com/s/6bkbw6v269dyfie/data.tar -o data.tar
5+
wget https://www.dropbox.com/s/6bkbw6v269dyfie/data.tar
56
tar -xvf data.tar

0 commit comments

Comments
 (0)