7
7
import nipype .interfaces .fsl .model as fsl
8
8
from nipype .interfaces .fsl import no_fsl
9
9
from pathlib import Path
10
+ from ....pipeline import engine as pe
10
11
11
12
12
13
@pytest .mark .skipif (no_fsl (), reason = "fsl is not installed" )
13
14
def test_MultipleRegressDesign (tmpdir ):
14
- foo = fsl .MultipleRegressDesign ()
15
- foo .inputs .regressors = dict (
15
+ designer = pe . Node ( fsl .MultipleRegressDesign (), name = 'designer' , base_dir = str ( tmpdir ) )
16
+ designer .inputs .regressors = dict (
16
17
voice_stenght = [1 , 1 , 1 ], age = [0.2 , 0.4 , 0.5 ], BMI = [1 , - 1 , 2 ]
17
18
)
18
19
con1 = ["voice_and_age" , "T" , ["age" , "voice_stenght" ], [0.5 , 0.5 ]]
19
20
con2 = ["just_BMI" , "T" , ["BMI" ], [1 ]]
20
- foo .inputs .contrasts = [con1 , con2 , ["con3" , "F" , [con1 , con2 ]], ["con4" , "F" , [con2 ]]]
21
- res = foo .run ()
21
+ designer .inputs .contrasts = [con1 , con2 , ["con3" , "F" , [con1 , con2 ]], ["con4" , "F" , [con2 ]]]
22
+ res = designer .run ()
23
+ outputs = res .outputs .get_traitsfree ()
22
24
23
- for ii in ["mat" , "con" , "fts" , "grp" ]:
24
- assert (
25
- os .path .exists (eval ('res.outputs.design_' + ii ))
26
- )
25
+ for ftype in ["mat" , "con" , "fts" , "grp" ]:
26
+ assert Path (outputs ["design_" + ftype ]).exists ()
27
27
28
28
expected_content = {}
29
29
@@ -37,7 +37,7 @@ def test_MultipleRegressDesign(tmpdir):
37
37
2.000000e+00 5.000000e-01 1.000000e+00
38
38
"""
39
39
40
- design_con_expected_content = """/ContrastName1 voice_and_age
40
+ expected_content [ "design_con" ] = """/ContrastName1 voice_and_age
41
41
/ContrastName2 just_BMI
42
42
/NumWaves 3
43
43
/NumContrasts 2
@@ -49,22 +49,22 @@ def test_MultipleRegressDesign(tmpdir):
49
49
1.000000e+00 0.000000e+00 0.000000e+00
50
50
"""
51
51
52
- design_fts_expected_content = """/NumWaves 2
52
+ expected_content [ "design_fts" ] = """/NumWaves 2
53
53
/NumContrasts 2
54
54
55
55
/Matrix
56
56
1 1
57
57
0 1
58
58
"""
59
59
60
- design_grp_expected_content = """/NumWaves 1
60
+ expected_content [ "design_grp" ] = """/NumWaves 1
61
61
/NumPoints 3
62
62
63
63
/Matrix
64
64
1
65
65
1
66
66
1
67
67
"""
68
- for ii in ["mat" , "con" , "fts" , "grp" ]:
69
- outfile = "design_" + ii
68
+ for ftype in ["mat" , "con" , "fts" , "grp" ]:
69
+ outfile = "design_" + ftype
70
70
assert Path (outputs [outfile ]).read_text () == expected_content [outfile ]
0 commit comments