Skip to content

Commit 29fdee8

Browse files
Merge pull request #122 from OSIPI/Fix_website
Needs to be in main to test website...
2 parents 960b446 + 40eb3a8 commit 29fdee8

File tree

9 files changed

+2624
-372
lines changed

9 files changed

+2624
-372
lines changed

.github/workflows/analysis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: Algorithm Analysis
22

33
on:
4+
45
push:
56
branches:
67
- 'main'
78
- 'analysis/**'
8-
9+
- 'Fix_website'
910
jobs:
1011
algorithms:
1112
runs-on: ubuntu-latest
@@ -79,6 +80,7 @@ jobs:
7980
test_output_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv
8081
test_duration_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv
8182
overwrite: true
83+
8284
merge:
8385
runs-on: ubuntu-latest
8486
needs: build

.github/workflows/website.yml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- name: Checkout the same branch as the triggering workflow
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.event.workflow_run.head_branch }}
1720
- name: Setup Pages
1821
uses: actions/configure-pages@v4
1922
- name: Set up Python
2023
id: setup_python
2124
uses: actions/setup-python@v5
2225
with:
23-
python-version: "3.11"
26+
python-version: "3.13"
2427
- name: Cache pip
2528
uses: actions/cache@v3
2629
id: pip-cache
@@ -33,35 +36,51 @@ jobs:
3336
run: |
3437
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
3538
pip install -r requirements.txt
36-
37-
# Action Figures artifact
38-
- name: 'Download artifact'
39+
40+
# Download Figures artifact
41+
- name: Download Figures artifact
42+
3943
if: ${{ github.event.workflow_run.conclusion == 'success' }}
40-
uses: ./.github/actions/download-artifact
44+
uses: actions/download-artifact@v4
4145
with:
42-
name: 'Figures'
43-
# Action analysis data artifact
44-
- name: 'Download analysis data'
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
run-id: ${{ github.event.workflow_run.id }}
48+
name: Figures
49+
path: Figures
50+
51+
# Download Data artifact
52+
- name: Download Data artifact
4553
if: ${{ github.event.workflow_run.conclusion == 'success' }}
46-
uses: ./.github/actions/download-artifact
54+
uses: actions/download-artifact@v4
4755
with:
48-
name: 'Data'
56+
github-token: ${{ secrets.GITHUB_TOKEN }}
57+
run-id: ${{ github.event.workflow_run.id }}
58+
name: Data
59+
path: Data
60+
61+
- name: Debug artifact contents
62+
run: |
63+
echo "Current directory:"
64+
pwd
65+
echo "Files after artifact download:"
66+
ls -R
4967
5068
- name: Run the test that generates the plots report.
69+
env:
70+
PYTHONPATH: ${{ github.workspace }}
5171
run: |
5272
pytest tests/IVIMmodels/unit_tests/test_ivim_fit.py --json-report
5373
mv .report.json utilities/
5474
python utilities/report-summary.py .report.json report-summary.json
5575
5676
- name: 'Filter and compress results file.'
57-
run: python utilities/reduce_output_size.py test_output.csv test_output.csv.gz
77+
run: python utilities/reduce_output_size.py Data/test_output.csv test_output.csv.gz
5878

5979
- name: move data to the dashboard folder
6080
run: |
6181
mv test_output.csv.gz website/dashboard
6282
mv report-summary.json website/dashboard
6383
64-
6584
- name: Build documentation
6685
run: |
6786
mkdir docs/_static

conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# import datetime
66
import numpy as np
77
from phantoms.MR_XCAT_qMRI.sim_ivim_sig import phantom
8+
import warnings
9+
from tests.IVIMmodels.unit_tests.test_ivim_fit import PerformanceWarning
10+
warnings.simplefilter("always", PerformanceWarning)
811

912
def pytest_addoption(parser):
1013
parser.addoption(
@@ -316,3 +319,4 @@ def threeddata(request):
316319
bvals = np.array(bvals['bvalues'])
317320
sig, _, Dim, fim, Dpim, _=phantom(bvals, 1/1000, TR=3000, TE=40, motion=False, rician=False, interleaved=False, T1T2=True)
318321
return sig[::16,::8,::6,:], Dim[::16,::8,::6], fim[::16,::8,::6], Dpim[::16,::8,::6], bvals
322+

src/standardized/PV_MUMC_biexp.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import numpy as np
22
from src.wrappers.OsipiBase import OsipiBase
3-
from src.original.PV_MUMC.two_step_IVIM_fit import fit_least_squares_array, fit_least_squares
3+
from src.original.PV_MUMC.two_step_IVIM_fit import fit_least_squares
44

55

66
class PV_MUMC_biexp(OsipiBase):
@@ -62,7 +62,15 @@ def ivim_fit(self, signals, bvalues=None):
6262
if self.bounds is None:
6363
self.bounds = ([0.9, 0.0001, 0.0, 0.0025], [1.1, 0.003, 1, 0.2])
6464

65-
fit_results = self.PV_algorithm(bvalues, signals, bounds=self.bounds, cutoff=self.thresholds)
65+
DEFAULT_PARAMS = [0.003,0.1,0.05]
66+
67+
try:
68+
fit_results = self.PV_algorithm(bvalues, signals, bounds=self.bounds, cutoff=self.thresholds)
69+
except RuntimeError as e:
70+
if "maximum number of function evaluations" in str(e):
71+
fit_results = DEFAULT_PARAMS
72+
else:
73+
raise
6674

6775
results = {}
6876
results["f"] = fit_results[1]

tests/IVIMmodels/unit_tests/compare.r

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
# 1. Save the "Comparison" file from the run on Github, OR run this file directly
88
# 2. Find the file producted "test_reference.csv" on Github, or whatever the "reference_file" variable was called
99
# 3. This replaces "tests/IVIMmodels/unit_tests/reference_output.csv" in the repository
10-
# 4. For the algorithm "IAR_LU_modified_mix", replace the "f_f_alpha, Dp_f_alpha, D_f_alpha, f_t_alpha, Dp_t_alpha, D_t_alpha" columns with "0.01,0.01,0.01,0.0,0.0,0.0"
10+
# 4. For the algorithm "IAR_LU_modified_mix" and "TCML_TechnionIIT_lsqtrf", replace the "f_f_alpha, Dp_f_alpha, D_f_alpha, f_t_alpha, Dp_t_alpha, D_t_alpha" columns with "0.01,0.01,0.01,0.0,0.0,0.0"
11+
12+
# Exclude certain algorithms
13+
exclude_algorithms <- c("IAR_LU_modified_mix", "TCML_TechnionIIT_lsqtrf")
1114

1215
args = commandArgs(trailingOnly=TRUE)
1316
# Define file paths
@@ -45,8 +48,8 @@ keep_columns_test <- c("Algorithm", "Region", "SNR", "index", "f", "Dp", "D", "f
4548

4649
test <- read_csv(test_file) %>%
4750
select(all_of(keep_columns_test)) %>%
48-
# Convert Algorithm and Region to factors
49-
mutate(Algorithm = as.factor(Algorithm), Region = as.factor(Region))
51+
mutate(Algorithm = as.factor(Algorithm), Region = as.factor(Region)) %>%
52+
filter(!Algorithm %in% exclude_algorithms) # <-- skip these
5053

5154
# Group data by relevant factors
5255
grouped_data <- test %>%

0 commit comments

Comments
 (0)