Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Michiel Cottaar
fslpy
Commits
f8f758ae
Commit
f8f758ae
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Update tests
parent
98e181dc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/scripts/extract_noise.py
+1
-1
1 addition, 1 deletion
fsl/scripts/extract_noise.py
tests/test_extract_noise.py
+26
-16
26 additions, 16 deletions
tests/test_extract_noise.py
with
27 additions
and
17 deletions
fsl/scripts/extract_noise.py
+
1
−
1
View file @
f8f758ae
...
...
@@ -211,7 +211,7 @@ def main(argv=None):
if
argv
is
None
:
argv
=
sys
.
argv
[
1
:]
args
=
parseArgs
(
argv
)
args
=
parseArgs
(
argv
)
try
:
comps
=
genComponentIndexList
(
args
.
components
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_extract_noise.py
+
26
−
16
View file @
f8f758ae
...
...
@@ -8,6 +8,8 @@
import
numpy
as
np
import
pytest
import
fsl.utils.tempdir
as
tempdir
import
fsl.scripts.extract_noise
as
extn
...
...
@@ -17,8 +19,6 @@ def test_genComponentIndexList():
with
tempdir
.
tempdir
():
# sequence of 1-indexed integers/file paths
# both potentially containing larger than
# the actual number of components
icomps
=
[
1
,
5
,
28
,
12
,
42
,
54
]
fcomps1
=
[
1
,
4
,
6
,
3
,
7
]
fcomps2
=
[
12
,
42
,
31
,
1
,
4
,
8
]
...
...
@@ -35,12 +35,10 @@ def test_genComponentIndexList():
assert
extn
.
genComponentIndexList
(
comps
,
ncomps
)
==
expcomps
ncomps
=
40
comps
=
icomps
+
[
'
comps1.txt
'
,
'
comps2.txt
'
]
+
[
0
,
-
1
]
expcomps
=
list
(
sorted
(
set
(
icomps
+
fcomps1
+
fcomps2
)))
expcomps
=
[
c
-
1
for
c
in
expcomps
if
c
<=
ncomps
]
assert
extn
.
genComponentIndexList
(
comps
,
ncomps
)
==
expcomps
with
pytest
.
raises
(
ValueError
):
extn
.
genComponentIndexList
(
comps
+
[
-
1
],
60
)
with
pytest
.
raises
(
ValueError
):
extn
.
genComponentIndexList
(
comps
,
40
)
def
test_loadConfoundFiles
():
...
...
@@ -50,17 +48,17 @@ def test_loadConfoundFiles():
confs
=
[
np
.
random
.
randint
(
1
,
100
,
(
50
,
10
)),
np
.
random
.
randint
(
1
,
100
,
(
50
,
1
)),
np
.
random
.
randint
(
1
,
100
,
(
50
,
5
)),
np
.
random
.
randint
(
1
,
100
,
(
50
,
5
))]
badconfs
=
[
np
.
random
.
randint
(
1
,
100
,
(
40
,
10
)),
np
.
random
.
randint
(
1
,
100
,
(
60
,
10
))]
expected
=
np
.
empty
((
50
,
36
),
dtype
=
np
.
float64
)
expected
[:,
:]
=
np
.
nan
expected
[:,
:
10
]
=
confs
[
0
]
expected
[:,
10
:
11
]
=
confs
[
1
]
expected
[:,
11
:
16
]
=
confs
[
2
]
expected
[:
40
,
16
:
26
]
=
confs
[
3
]
expected
[:,
26
:
36
]
=
confs
[
4
][:
50
,
:]
expected
=
np
.
empty
((
50
,
16
),
dtype
=
np
.
float64
)
expected
[:,
:]
=
np
.
nan
expected
[:,
:
10
]
=
confs
[
0
]
expected
[:,
10
:
11
]
=
confs
[
1
]
expected
[:,
11
:
16
]
=
confs
[
2
]
conffiles
=
[]
for
i
,
c
in
enumerate
(
confs
):
...
...
@@ -74,3 +72,15 @@ def test_loadConfoundFiles():
assert
np
.
all
(
~
np
.
isnan
(
result
)
==
amask
)
assert
np
.
all
(
result
[
amask
]
==
expected
[
amask
])
assert
np
.
all
(
result
[
amask
]
==
expected
[
amask
])
badconfs
=
[
np
.
random
.
randint
(
1
,
100
,
(
40
,
10
)),
np
.
random
.
randint
(
1
,
100
,
(
60
,
10
))]
conffiles
=
[]
for
i
,
c
in
enumerate
(
badconfs
):
fname
=
'
conf{}.txt
'
.
format
(
i
)
conffiles
.
append
(
fname
)
np
.
savetxt
(
fname
,
c
)
with
pytest
.
raises
(
ValueError
):
extn
.
loadConfoundFiles
(
conffiles
,
npts
)
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