77import nipype .interfaces .fsl .model as fsl
88from nipype .interfaces .fsl import no_fsl
99from pathlib import Path
10+ from ....pipeline import engine as pe
1011
1112
1213@pytest .mark .skipif (no_fsl (), reason = "fsl is not installed" )
1314def 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 (
1617 voice_stenght = [1 , 1 , 1 ], age = [0.2 , 0.4 , 0.5 ], BMI = [1 , - 1 , 2 ]
1718 )
1819 con1 = ["voice_and_age" , "T" , ["age" , "voice_stenght" ], [0.5 , 0.5 ]]
1920 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 ()
2224
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 ()
2727
2828 expected_content = {}
2929
@@ -37,7 +37,7 @@ def test_MultipleRegressDesign(tmpdir):
37372.000000e+00 5.000000e-01 1.000000e+00
3838"""
3939
40- design_con_expected_content = """/ContrastName1 voice_and_age
40+ expected_content [ "design_con" ] = """/ContrastName1 voice_and_age
4141/ContrastName2 just_BMI
4242/NumWaves 3
4343/NumContrasts 2
@@ -49,22 +49,22 @@ def test_MultipleRegressDesign(tmpdir):
49491.000000e+00 0.000000e+00 0.000000e+00
5050"""
5151
52- design_fts_expected_content = """/NumWaves 2
52+ expected_content [ "design_fts" ] = """/NumWaves 2
5353/NumContrasts 2
5454
5555/Matrix
56561 1
57570 1
5858"""
5959
60- design_grp_expected_content = """/NumWaves 1
60+ expected_content [ "design_grp" ] = """/NumWaves 1
6161/NumPoints 3
6262
6363/Matrix
64641
65651
66661
6767"""
68- for ii in ["mat" , "con" , "fts" , "grp" ]:
69- outfile = "design_" + ii
68+ for ftype in ["mat" , "con" , "fts" , "grp" ]:
69+ outfile = "design_" + ftype
7070 assert Path (outputs [outfile ]).read_text () == expected_content [outfile ]
0 commit comments