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
Model registry
Operate
Environments
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
FSL
fslpy
Commits
ac4abe63
Commit
ac4abe63
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Unit test for generateVest function
parent
e48b6ac2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_vest.py
+34
-0
34 additions, 0 deletions
tests/test_vest.py
with
34 additions
and
0 deletions
tests/test_vest.py
+
34
−
0
View file @
ac4abe63
...
...
@@ -7,6 +7,7 @@
import
os.path
as
op
import
io
import
shutil
import
tempfile
import
warnings
...
...
@@ -214,3 +215,36 @@ def test_loadVestLutFile():
finally
:
shutil
.
rmtree
(
testdir
)
def
test_generateVest
():
def
readvest
(
vstr
):
lines
=
vstr
.
split
(
'
\n
'
)
nrows
=
[
l
for
l
in
lines
if
'
NumPoints
'
in
l
][
0
]
ncols
=
[
l
for
l
in
lines
if
'
NumWaves
'
in
l
][
0
]
nrows
=
int
(
nrows
.
split
()[
1
])
ncols
=
int
(
ncols
.
split
()[
1
])
data
=
'
\n
'
.
join
(
lines
[
3
:])
data
=
np
.
loadtxt
(
io
.
StringIO
(
data
)).
reshape
((
nrows
,
ncols
))
return
((
nrows
,
ncols
),
data
)
# shape, expectedshape
tests
=
[
((
10
,
),
(
1
,
10
)),
((
10
,
1
),
(
10
,
1
)),
((
1
,
10
),
(
1
,
10
)),
((
3
,
5
),
(
3
,
5
)),
((
5
,
3
),
(
5
,
3
))
]
for
shape
,
expshape
in
tests
:
data
=
np
.
random
.
random
(
shape
)
vstr
=
vest
.
generateVest
(
data
)
gotshape
,
gotdata
=
readvest
(
vstr
)
data
=
data
.
reshape
(
expshape
)
assert
expshape
==
gotshape
assert
np
.
all
(
np
.
isclose
(
data
,
gotdata
))
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