Commit 1bf1c735 authored by Evan Edmond's avatar Evan Edmond Committed by Paul McCarthy
Browse files

ENH: add function to load settings from arbitrary fsf

parent 9f467c88
......@@ -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.
......
......@@ -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():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment