Skip to content

Commit 12e2d7f

Browse files
committed
Extra tests for desing generation.
1 parent fdee8bf commit 12e2d7f

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

nipype/interfaces/fsl/tests/test_model.py

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,56 @@ def teardown_infile(tmp_dir):
3333
def test_MultipleRegressDesign():
3434
_, tp_dir = setup_infile()
3535
foo = fsl.MultipleRegressDesign()
36-
foo.inputs.regressors = dict(reg1=[1,1,1],reg2=[0.2,0.4,0.5],reg3=[1,-1,2])
37-
con1 = ['con1','T',['reg1','reg2'],[0.5,0.5]]
38-
con2 = ['con2','T',['reg3'],[1]]
36+
foo.inputs.regressors = dict(voice_stenght=[1,1,1],age=[0.2,0.4,0.5],BMI=[1,-1,2])
37+
con1 = ['voice_and_age','T',['age','voice_stenght'],[0.5,0.5]]
38+
con2 = ['just_BMI','T',['BMI'],[1]]
3939
foo.inputs.contrasts = [con1,con2,['con3','F',[con1,con2]]]
4040
res = foo.run()
4141
yield assert_equal, res.outputs.design_mat, os.path.join(os.getcwd(),'design.mat')
4242
yield assert_equal, res.outputs.design_con, os.path.join(os.getcwd(),'design.con')
4343
yield assert_equal, res.outputs.design_fts, os.path.join(os.getcwd(),'design.fts')
4444
yield assert_equal, res.outputs.design_grp, os.path.join(os.getcwd(),'design.grp')
45+
46+
design_mat_expected_content = """/NumWaves 3
47+
/NumPoints 3
48+
/PPheights 3.000000e+00 5.000000e-01 1.000000e+00
49+
50+
/Matrix
51+
1.000000e+00 2.000000e-01 1.000000e+00
52+
-1.000000e+00 4.000000e-01 1.000000e+00
53+
2.000000e+00 5.000000e-01 1.000000e+00
54+
"""
55+
56+
design_con_expected_content = """/ContrastName1 voice_and_age
57+
/ContrastName2 just_BMI
58+
/NumWaves 3
59+
/NumContrasts 2
60+
/PPheights 1.000000e+00 1.000000e+00
61+
/RequiredEffect 100.000 100.000
62+
63+
/Matrix
64+
0.000000e+00 5.000000e-01 5.000000e-01
65+
1.000000e+00 0.000000e+00 0.000000e+00
66+
"""
67+
68+
design_fts_expected_content = """/NumWaves 2
69+
/NumContrasts 1
70+
71+
/Matrix
72+
1 1
73+
"""
74+
75+
design_grp_expected_content = """/NumWaves 1
76+
/NumPoints 3
77+
78+
/Matrix
79+
1
80+
1
81+
1
82+
"""
83+
yield assert_equal, open(os.path.join(os.getcwd(),'design.con'), 'r').read(), design_con_expected_content
84+
yield assert_equal, open(os.path.join(os.getcwd(),'design.mat'), 'r').read(), design_mat_expected_content
85+
yield assert_equal, open(os.path.join(os.getcwd(),'design.fts'), 'r').read(), design_fts_expected_content
86+
yield assert_equal, open(os.path.join(os.getcwd(),'design.grp'), 'r').read(), design_grp_expected_content
87+
88+
teardown_infile(tp_dir)

0 commit comments

Comments
 (0)