Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
5f42941c
Commit
5f42941c
authored
Jul 21, 2020
by
Paul McCarthy
🚵
Browse files
TEST: Test vest convert scripts
parent
d878d612
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_scripts/test_vest2text.py
0 → 100644
View file @
5f42941c
#!/usr/bin/env python
#
# test_vest2text.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import
numpy
as
np
import
fsl.data.vest
as
fslvest
import
fsl.scripts.Text2Vest
as
Text2Vest
import
fsl.scripts.Vest2Text
as
Vest2Text
from
tests
import
tempdir
def
test_usage
():
assert
Vest2Text
.
main
([])
==
0
assert
Text2Vest
.
main
([])
==
0
def
test_Vest2Text
():
with
tempdir
():
data
=
np
.
random
.
random
((
20
,
10
))
vest
=
fslvest
.
generateVest
(
data
)
with
open
(
'data.vest'
,
'wt'
)
as
f
:
f
.
write
(
vest
)
assert
Vest2Text
.
main
([
'data.vest'
,
'data.txt'
])
==
0
got
=
np
.
loadtxt
(
'data.txt'
)
assert
np
.
all
(
np
.
isclose
(
data
,
got
))
def
test_Text2Vest
():
with
tempdir
():
data
=
np
.
random
.
random
((
20
,
10
))
np
.
savetxt
(
'data.txt'
,
data
)
assert
Text2Vest
.
main
([
'data.txt'
,
'data.vest'
])
==
0
got
=
fslvest
.
loadVestFile
(
'data.vest'
,
ignoreHeader
=
False
)
assert
np
.
all
(
np
.
isclose
(
data
,
got
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment