Skip to content

Commit 77fe390

Browse files
Merge pull request #70 from OSIPI/main
abdominal phantom up to date
2 parents 11445d7 + b099579 commit 77fe390

File tree

93 files changed

+10011
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+10011
-297
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: 🐞 Bug report
2+
description: Create a report to help us improve (use this to report bugs only).
3+
title: "[BUG] <title>"
4+
labels: [🐞 bug]
5+
body:
6+
- type: checkboxes
7+
attributes:
8+
label: Is there an existing issue for this?
9+
description: Please search to see if an issue already exists for the bug you encountered.
10+
options:
11+
- label: I have searched the existing issues
12+
required: true
13+
- type: textarea
14+
attributes:
15+
label: Describe the bug
16+
description: A clear and concise description of what the bug is. Include images if relevant.
17+
placeholder: A bug happened!
18+
validations:
19+
required: true
20+
- type: textarea
21+
attributes:
22+
label: Screenshots [optional]
23+
description: |
24+
Add screenshots to help explain your problem. You can also add a video here.
25+
26+
Tip: You can attach images or video files by clicking this area to highlight it and then dragging files in.
27+
validations:
28+
required: false
29+
- type: textarea
30+
attributes:
31+
label: Steps To Reproduce
32+
description: Steps to reproduce the bug.
33+
placeholder: |
34+
1. Visit '...'
35+
2. Click on '...'
36+
3. Scroll to '...'
37+
4. See error
38+
validations:
39+
required: true
40+
- type: textarea
41+
attributes:
42+
label: Expected behavior
43+
description: A clear and concise description of what you expected to happen
44+
validations:
45+
required: true
46+
- type: textarea
47+
attributes:
48+
label: Additional context
49+
description: |
50+
Links? References? Anything that will give us more context about the issue you are encountering!
51+
validations:
52+
required: false
53+
- type: dropdown
54+
id: assign
55+
attributes:
56+
label: Are you working on this?
57+
options:
58+
- "Yes"
59+
- "No"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: ✨ Idea [Feature request]
2+
description: Tell us about the idea you have !
3+
title: "[Feature] <title>"
4+
labels: [idea]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Your suggestions are highly valuable.
10+
- type: textarea
11+
attributes:
12+
label: Feature description
13+
description: |
14+
Is your feature request related to a problem? A clear and concise description of what the feature is.
15+
validations:
16+
required: true
17+
- type: textarea
18+
attributes:
19+
label: Describe the solution
20+
description: A clear and concise description of what you want to happen.
21+
validations:
22+
required: true
23+
- type: textarea
24+
attributes:
25+
label: Describe alternatives
26+
description: |
27+
A clear and concise description of any alternative solutions or features you have considered.
28+
- type: textarea
29+
attributes:
30+
label: Additional context
31+
description: |
32+
Add any other additional context or screenshots about the feature request here.
33+
- type: dropdown
34+
id: assign
35+
attributes:
36+
label: Are you working on this?
37+
options:
38+
- "Yes"
39+
- "No"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Download Artifact
3+
description: Download artifact from the same or different workflow
4+
5+
inputs:
6+
name:
7+
description: Artifact to be downloaded
8+
required: true
9+
type: string
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Download Artifact
15+
uses: actions/github-script@v6
16+
with:
17+
script: |
18+
var inputs = ${{ toJSON(inputs) }}
19+
var artifactName = inputs['name']
20+
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
21+
owner: context.repo.owner,
22+
repo: context.repo.repo,
23+
run_id: context.payload.workflow_run.id,
24+
});
25+
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
26+
return artifact.name == artifactName
27+
})[0];
28+
let download = await github.rest.actions.downloadArtifact({
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
artifact_id: matchArtifact.id,
32+
archive_format: 'zip',
33+
});
34+
let fs = require('fs');
35+
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data));
36+
37+
- name: 'Unzip artifact'
38+
run: unzip ${{ inputs.name }}.zip
39+
shell: bash

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### Describe the changes you have made in this PR
2+
3+
_A clear and concise description of what you want to happen_
4+
5+
### Link this PR to an issue [optional]
6+
7+
Fixes _#ISSUE-NUMBER_
8+
9+
### Checklist
10+
11+
- [ ] Self-review of changed code
12+
- [ ] Added automated tests where applicable
13+
- [ ] Update Docs & Guides

.github/workflows/analysis.yml

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

.github/workflows/documentation.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build & Deploy Documentation
2+
3+
on:
4+
workflow_run:
5+
workflows: [Algorithm Analysis]
6+
types:
7+
- completed
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Setup Pages
18+
uses: actions/configure-pages@v4
19+
- name: Set up Python
20+
id: setup_python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.11"
24+
- name: Cache pip
25+
uses: actions/cache@v3
26+
id: pip-cache
27+
with:
28+
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}
29+
path: ${{ env.pythonLocation }}
30+
if: steps.pip-cache.outputs.cache-hit != 'true'
31+
32+
- name: Install dependencies
33+
run: |
34+
pip install -r requirements.txt
35+
36+
# Action to download artifacts from a different workflow (analysis.yml)
37+
- name: 'Download artifact'
38+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
39+
uses: ./.github/actions/download-artifact
40+
with:
41+
name: 'Figures'
42+
43+
- name: Build html
44+
run: |
45+
mkdir docs/_static
46+
mv *.pdf docs/_static/
47+
sphinx-apidoc -o docs src
48+
cd docs/
49+
make html
50+
51+
- name: Upload docs artifact
52+
uses: actions/upload-pages-artifact@v3
53+
with:
54+
path: 'docs/_build/html'
55+
56+
deploy:
57+
needs: build
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Deploy to GitHub Pages
65+
id: deployment
66+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)