-
Notifications
You must be signed in to change notification settings - Fork 27
173 lines (164 loc) · 5.46 KB
/
analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Algorithm Analysis
on:
push:
branches:
- 'main'
- 'analysis/**'
jobs:
algorithms:
runs-on: ubuntu-latest
outputs: # here we use the outputs from steps, and set outputs for the job `configure`
algorithms: ${{ steps.algorithms.outputs.algorithms }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
id: setup_python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pip
uses: actions/cache@v3
id: pip-cache
with:
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}
path: ${{ env.pythonLocation }}
if: steps.pip-cache.outputs.cache-hit != 'true'
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Read algorithms
id: algorithms
run: |
echo 'algorithms<<EOF' >> $GITHUB_OUTPUT
cat ./tests/IVIMmodels/unit_tests/algorithms.json >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Log algorithms
run: |
echo "${{fromJson(steps.algorithms.outputs.algorithms)}}"
echo "${{fromJson(steps.algorithms.outputs.algorithms).algorithms}}"
- name: Log algorithms file
run: cat ./tests/IVIMmodels/unit_tests/algorithms.json
build:
runs-on: ubuntu-latest
needs: algorithms
continue-on-error: false
strategy:
fail-fast: false
matrix:
algorithm: ${{fromJson(needs.algorithms.outputs.algorithms).algorithms}}
SNR: [10, 30, 50, 100, 200]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
if: steps.pip-cache.outputs.cache-hit != 'true'
- name: Restore cache
id: python-cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}
path: ${{ env.pythonLocation }}
- name: Generate fitting data
run: |
python -m pytest -m slow --selectAlgorithm ${{ matrix.algorithm }} --saveFileName test_output_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv --SNR ${{ matrix.SNR }} --fitCount 300 --saveDurationFileName test_duration_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv
- name: Upload raw data
uses: actions/upload-artifact@v3
with:
name: Working_Data
retention-days: 1
path: |
test_output_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv
test_duration_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv
merge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Merge fitting results
run: |
head -n 1 $(ls artifacts/Working_Data/test_output_*.csv | head -n 1) > test_output.csv
tail -q -n +2 artifacts/Working_Data/test_output_*.csv >> test_output.csv
- name: Merge timing results
run: |
head -n 1 $(ls artifacts/Working_Data/test_duration_*.csv | head -n 1) > test_duration.csv
tail -q -n +2 artifacts/Working_Data/test_duration_*.csv >> test_duration.csv
- name: Upload merged artifacts
uses: actions/upload-artifact@v3
with:
name: Data
path: |
test_output.csv
test_duration.csv
analyze:
runs-on: ubuntu-latest
needs: merge
steps:
- uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: |
any::plyr
any::dplyr
any::tidyverse
any::data.table
any::ggplot2
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: Data
- name: Generate figures
run: Rscript --vanilla tests/IVIMmodels/unit_tests/analyze.r test_output.csv test_duration.csv
- name: Upload figures
uses: actions/upload-artifact@v3
if: always()
with:
name: Figures
path: |
D.pdf
f.pdf
Dp.pdf
D_limited.pdf
f_limited.pdf
Dp_limited.pdf
durations.pdf
curve_plot.pdf
fitted_curves.pdf
compare:
runs-on: ubuntu-latest
needs: merge
steps:
- uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: |
any::tidyverse
any::assertr
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: Data
- name: Test against previous results
run: Rscript --vanilla tests/IVIMmodels/unit_tests/compare.r test_output.csv test_reference.csv tests/IVIMmodels/unit_tests/reference_output.csv test_results.csv
- name: Upload data
uses: actions/upload-artifact@v3
if: always()
with:
name: Comparison
path: |
test_reference.csv
test_results.csv