Skip to content

Commit c9a3b5e

Browse files
committed
Dynamically update _cmd property
1 parent d088cc2 commit c9a3b5e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,6 @@ class Eddy(FSLCommand):
498498
>>> res = eddy.run() # doctest: +SKIP
499499
500500
"""
501-
_cmd = 'eddy_openmp'
502501
input_spec = EddyInputSpec
503502
output_spec = EddyOutputSpec
504503

@@ -507,8 +506,6 @@ class Eddy(FSLCommand):
507506
def __init__(self, **inputs):
508507
super(Eddy, self).__init__(**inputs)
509508
self.inputs.on_trait_change(self._num_threads_update, 'num_threads')
510-
if isdefined(self.inputs.use_cuda):
511-
self._use_cuda()
512509
if not isdefined(self.inputs.num_threads):
513510
self.inputs.num_threads = self._num_threads
514511
else:
@@ -523,11 +520,10 @@ def _num_threads_update(self):
523520
self.inputs.environ['OMP_NUM_THREADS'] = str(
524521
self.inputs.num_threads)
525522

526-
def _use_cuda(self):
527-
if self.inputs.use_cuda:
528-
self._cmd = 'eddy_cuda'
529-
else:
530-
self._cmd = 'eddy_openmp'
523+
@property
524+
def _cmd(self):
525+
cuda = self.inputs.use_cuda
526+
return 'eddy_cuda' if isdefined(cuda) and cuda else 'eddy_openmp'
531527

532528
def _format_arg(self, name, spec, value):
533529
if name == 'in_topup_fieldcoef':

0 commit comments

Comments
 (0)