Skip to content

Commit 1a43d2b

Browse files
committed
BF: Resolve error handling logic.
1 parent a416a11 commit 1a43d2b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

nipy/algorithms/registration/scripting.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import nibabel.eulerangles as euler
1616
from nibabel.optpkg import optional_package
1717
matplotlib, HAVE_MPL, _ = optional_package('matplotlib')
18+
1819
if HAVE_MPL:
1920
import matplotlib.pyplot as plt
2021

@@ -116,10 +117,11 @@ def space_time_realign(input, tr, slice_order='descending', slice_dim=2,
116117
point in the time-series. These can be used as affine transforms by
117118
referring to their `.as_affine` attribute.
118119
"""
119-
if make_figure and ~HAVE_MPL:
120-
e_s = "You need to have matplotlib installed to run this function with"
121-
e_s += " `make_figure` set to `True`"
122-
raise RuntimeError(e_s)
120+
if make_figure:
121+
if not HAVE_MPL:
122+
e_s ="You need to have matplotlib installed to run this function"
123+
e_s += " with `make_figure` set to `True`"
124+
raise RuntimeError(e_s)
123125

124126
# If we got only a single file, we motion correct that one:
125127
if op.isfile(input):

0 commit comments

Comments
 (0)