Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evan Edmond
fslpy
Commits
673a206d
Commit
673a206d
authored
4 years ago
by
Evan Edmond
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add function to load settings from arbitrary fsf
parent
8c7adadc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/data/featanalysis.py
+19
-9
19 additions, 9 deletions
fsl/data/featanalysis.py
tests/test_featanalysis.py
+4
-3
4 additions, 3 deletions
tests/test_featanalysis.py
with
23 additions
and
12 deletions
fsl/data/featanalysis.py
+
19
−
9
View file @
673a206d
...
@@ -215,19 +215,16 @@ def loadContrasts(featdir):
...
@@ -215,19 +215,16 @@ def loadContrasts(featdir):
return
names
,
contrasts
return
names
,
contrasts
def
loadFsf
(
designfsf
):
"""
Loads the analysis settings from a text file (.fsf) used to configure FEAT.
def
loadSettings
(
featdir
):
Returns a dict containing the settings specified in the file
"""
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
.
:arg
designfsf: A .fsf file
.
"""
"""
settings
=
collections
.
OrderedDict
()
settings
=
collections
.
OrderedDict
()
designfsf
=
op
.
join
(
featdir
,
'
design.fsf
'
)
log
.
debug
(
'
Loading FEAT settings from {}
'
.
format
(
designfsf
))
log
.
debug
(
'
Loading FEAT settings from {}
'
.
format
(
designfsf
))
with
open
(
designfsf
,
'
rt
'
)
as
f
:
with
open
(
designfsf
,
'
rt
'
)
as
f
:
...
@@ -250,6 +247,19 @@ def loadSettings(featdir):
...
@@ -250,6 +247,19 @@ def loadSettings(featdir):
return
settings
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
):
def
loadDesign
(
featdir
,
settings
):
"""
Loads the design matrix from a FEAT directory.
"""
Loads the design matrix from a FEAT directory.
...
...
This diff is collapsed.
Click to expand it.
tests/test_featanalysis.py
+
4
−
3
View file @
673a206d
...
@@ -240,9 +240,10 @@ def test_loadSettings():
...
@@ -240,9 +240,10 @@ def test_loadSettings():
with
tests
.
testdir
()
as
testdir
:
with
tests
.
testdir
()
as
testdir
:
featdir
=
op
.
join
(
testdir
,
'
analysis.feat
'
)
featdir
=
op
.
join
(
testdir
,
'
analysis.feat
'
)
tests
.
make_dummy_file
(
op
.
join
(
featdir
,
'
design.fsf
'
),
contents
)
designfsf
=
op
.
join
(
featdir
,
'
design.fsf
'
)
result
=
featanalysis
.
loadSettings
(
featdir
)
tests
.
make_dummy_file
(
designfsf
,
contents
)
assert
result
==
expected
assert
featanalysis
.
loadSettings
(
featdir
)
==
expected
assert
featanalysis
.
loadFsf
(
designfsf
)
==
expected
def
test_loadDesign
():
def
test_loadDesign
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment