Skip to content

Commit fbde4a5

Browse files
committed
Disabled synthetic tests by default, added some analysis
1 parent 0911c03 commit fbde4a5

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

pytest.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[pytest]
2+
markers =
3+
slow: marks tests as slow (deselect with '-m "not slow"')
4+
addopts =
5+
-m 'not slow'

tests/IVIMmodels/unit_tests/analyze.r

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
library(tidyverse)
2+
data <- read.csv("test_output.csv", skip=1, col.names=c("Algorithm", "Region", "SNR", "Truth", "Fitted"))
3+
data<-separate_wider_delim(data, cols = Truth, delim = ",", names = c("f", "D", "Dp"))
4+
data$f <- substring(data$f, 2)
5+
data$Dp <- substring(data$Dp, 1, nchar(data$Dp) - 1)
6+
data<-separate_wider_delim(data, cols = Fitted, delim = ",", names = c("f_fitted", "D_fitted", "Dp_fitted"))
7+
data$f_fitted <- substring(data$f_fitted, 2)
8+
data$Dp_fitted <- substring(data$Dp_fitted, 1, nchar(data$Dp_fitted) - 1)
9+
data[c("Algorithm", "Region")] <- sapply(data[c("Algorithm", "Region")], as.factor)
10+
data[c("SNR", "f", "D", "Dp", "f_fitted", "D_fitted", "Dp_fitted")] <- sapply(data[c("SNR", "f", "D", "Dp", "f_fitted", "D_fitted", "Dp_fitted")], as.numeric)
11+
ggplot(data, aes(x=Algorithm)) + geom_boxplot(aes(y=f_fitted)) + geom_boxplot(color="red", aes(y=f)) + facet_grid(SNR ~ Region) + scale_x_discrete(guide = guide_axis(angle = 90)) + ylim(0, 1) + ggtitle("Perfusion fraction grid") + xlab("Perfusion fraction")
12+
ggsave("f.pdf", width = 50, height = 50, units = "cm")
13+
ggplot(data, aes(x=Algorithm)) + geom_boxplot(aes(y=D_fitted)) + geom_boxplot(color="red", aes(y=D)) + facet_grid(SNR ~ Region) + scale_x_discrete(guide = guide_axis(angle = 90)) + ggtitle("Diffusion grid") + xlab("Diffusion")
14+
ggsave("D.pdf", width = 50, height = 50, units = "cm")
15+
ggplot(data, aes(x=Algorithm)) + geom_boxplot(aes(y=Dp_fitted)) + geom_boxplot(color="red", aes(y=Dp)) + facet_grid(SNR ~ Region) + scale_x_discrete(guide = guide_axis(angle = 90)) + ggtitle("Perfusion grid") + xlab("Perfusion")
16+
ggsave("Dp.pdf", width = 50, height = 50, units = "cm")
17+
#why?
18+
ggplot(data, aes(x=Algorithm)) + geom_boxplot(aes(y=D_fitted)) + geom_boxplot(color="red", aes(y=Dp)) + facet_grid(SNR ~ Region) + scale_x_discrete(guide = guide_axis(angle = 90)) + ggtitle("Diffusion grid") + xlab("Diffusion")
19+
ggsave("D_tweak.pdf", width = 50, height = 50, units = "cm")
20+
ggplot(data, aes(x=Algorithm)) + geom_boxplot(aes(y=Dp_fitted)) + geom_boxplot(color="red", aes(y=D)) + facet_grid(SNR ~ Region) + scale_x_discrete(guide = guide_axis(angle = 90)) + ggtitle("Perfusion grid") + xlab("Perfusion")
21+
ggsave("Dp_tweak.pdf", width = 50, height = 50, units = "cm")

tests/IVIMmodels/unit_tests/test_ivim_synthetic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
from utilities.data_simulation.GenerateData import GenerateData
1212

1313
#run using pytest <path_to_this_file> --saveFileName test_output.txt --SNR 50 100 200
14-
#e.g. pytest tests/IVIMmodels/unit_tests/test_ivim_synthetic.py --saveFileName test_output.txt --SNR 50 100 200
14+
#e.g. pytest -m slow tests/IVIMmodels/unit_tests/test_ivim_synthetic.py --saveFileName test_output.csv --SNR 10 50 100 200 --fitCount 20
15+
@pytest.mark.slow
1516
def test_generated(ivim_algorithm, ivim_data, SNR, rtol, atol, fit_count, save_file):
1617
# assert save_file == "test"
1718
random.seed(42)

0 commit comments

Comments
 (0)