From 0fe45912cea0df43698d0a06099cefa44d728453 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Fri, 21 Feb 2025 14:04:40 +0000 Subject: [PATCH] TEST: Test for loadFEATDesignFile --- fsl/tests/test_featdesign.py | 44 ++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/fsl/tests/test_featdesign.py b/fsl/tests/test_featdesign.py index e8ffdecec..1855b56d4 100644 --- a/fsl/tests/test_featdesign.py +++ b/fsl/tests/test_featdesign.py @@ -103,8 +103,9 @@ with the following commands: """ -import os.path as op -import numpy as np +import os.path as op +import textwrap as tw +import numpy as np import pytest @@ -400,6 +401,45 @@ def test_loadDesignMat(): featdesign.loadDesignMat(badfile) +# fsl/fslpy!469 +def test_loadFEATDesignFile(): + with tempdir(): + with open('design1.con', 'wt') as f: + f.write(tw.dedent(""" + /ContrastName1 mycontrast + /NumWaves 2 + /NumContrasts 1 + + /Matrix + 10 20 + """).strip()) + + with open('design2.con', 'wt') as f: + f.write(tw.dedent(""" + /ContrastName1 + /NumWaves 2 + /NumContrasts 1 + + /Matrix + 10 20 + """).strip()) + + des1 = featanalysis.loadFEATDesignFile('design1.con') + exp1 = {'ContrastName1': 'mycontrast', + 'NumWaves': '2', + 'NumContrasts': '1', + 'Matrix': '10 20'} + + des2 = featanalysis.loadFEATDesignFile('design2.con') + exp2 = {'ContrastName1': '', + 'NumWaves': '2', + 'NumContrasts': '1', + 'Matrix': '10 20'} + + assert des1 == exp1 + assert des2 == exp2 + + def test_VoxelwiseEVs(): with tempdir(): img = tests.make_random_image('image.nii.gz', (10, 10, 10, 10)) -- GitLab