diff --git a/fsl/data/featanalysis.py b/fsl/data/featanalysis.py index 718ef679b0502337ecf5aba68a481b336fedd0e6..a8aa25f097d3b20e97fa5f74e4542fa887b09608 100644 --- a/fsl/data/featanalysis.py +++ b/fsl/data/featanalysis.py @@ -215,19 +215,16 @@ def loadContrasts(featdir): return names, contrasts +def loadFsf(designfsf): + """Loads the analysis settings from a text file (.fsf) used to configure FEAT. -def loadSettings(featdir): - """Loads the analysis settings from a FEAT directory. - - Returns a dict containing the settings specified in the ``design.fsf`` - file within the directory + Returns a dict containing the settings specified in the file - :arg featdir: A FEAT directory. + :arg designfsf: A .fsf file. """ - + settings = collections.OrderedDict() - designfsf = op.join(featdir, 'design.fsf') - + log.debug('Loading FEAT settings from {}'.format(designfsf)) with open(designfsf, 'rt') as f: @@ -250,6 +247,19 @@ def loadSettings(featdir): return settings +def loadSettings(featdir): + """Loads the analysis settings from a FEAT directory. + + Returns a dict containing the settings specified in the ``design.fsf`` + file within the directory + + :arg featdir: A FEAT directory. + """ + + designfsf = op.join(featdir, 'design.fsf') + + return loadFsf(designfsf) + def loadDesign(featdir, settings): """Loads the design matrix from a FEAT directory. diff --git a/tests/test_featanalysis.py b/tests/test_featanalysis.py index c58758c7ebfd0b862d20480cc54f8e9d0963ec96..ffb5d8b3c6ed4330d285a04d68cfe2e8da2cbd15 100644 --- a/tests/test_featanalysis.py +++ b/tests/test_featanalysis.py @@ -240,9 +240,10 @@ def test_loadSettings(): with tests.testdir() as testdir: featdir = op.join(testdir, 'analysis.feat') - tests.make_dummy_file(op.join(featdir, 'design.fsf'), contents) - result = featanalysis.loadSettings(featdir) - assert result == expected + designfsf = op.join(featdir, 'design.fsf') + tests.make_dummy_file(designfsf, contents) + assert featanalysis.loadSettings(featdir) == expected + assert featanalysis.loadFsf(designfsf) == expected def test_loadDesign():