Skip to content

Commit

Permalink
Added integrity test for prepare fieldmap
Browse files Browse the repository at this point in the history
  • Loading branch information
jcohenadad committed Nov 18, 2020
1 parent ca94e4d commit 57a86e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/test_prepare_fieldmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def test_prepare_fieldmap_1_echo(self):
fieldmap = prepare_fieldmap([self.phase], self.echo_times, self.affine)

assert fieldmap.shape == self.phase.shape
# If the behaviour of the called function is modified, this assertion below should capture it:
assert np.all(np.isclose(fieldmap[30:35, 40, 0, 0],
np.array([18.51355514, 13.84794053, 9.48013154, 5.11232207, 0.64524454])))

def test_prepare_fieldmap_with_mag(self):
"""Test mag works"""
Expand Down Expand Up @@ -82,6 +85,7 @@ def test_prepare_fieldmap_wrong_echo_times(self):
try:
fieldmap = prepare_fieldmap([self.phase], echo_times, self.affine)
except RuntimeError:
# TODO: message below is suspicious
# If an exception occurs, this is the desired behaviour since the mask is the wrong dimensions
return 0

Expand Down Expand Up @@ -129,4 +133,4 @@ def test_prepare_fieldmap_phadiff_1_echotime(self):

# If there isn't an error, then there is a problem
print('\necho_time hase the wrong shape but does not throw an error')
assert False
assert False

0 comments on commit 57a86e0

Please sign in to comment.