Skip to content

Commit 83a6782

Browse files
committed
code readability improvements
1 parent 3e69cbe commit 83a6782

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,16 @@ def _list_outputs(self):
278278
cwd=base_path)
279279
outputs['out_movpar'] = self._gen_fname(base, suffix='_movpar',
280280
ext='.txt', cwd=base_path)
281-
n_vols = nb.load(self.inputs.in_file).shape[-1]
282281

283-
outputs['out_warps'] = [os.path.abspath(self.inputs.out_warp_prefix + "_%02d" % (i+1) + Info.output_type_to_ext(self.inputs.output_type)) for i in range(n_vols)]
284-
outputs['out_jacs'] = [os.path.abspath(
285-
self.inputs.out_jac_prefix + "_%02d" % (
286-
i + 1) + Info.output_type_to_ext(self.inputs.output_type)) for i in
287-
range(n_vols)]
282+
n_vols = nb.load(self.inputs.in_file).shape[-1]
283+
ext = Info.output_type_to_ext(self.inputs.output_type)
284+
fmt = os.path.abspath('{prefix}_{i:02d}{ext}').format
285+
outputs['out_warps'] = [
286+
fmt(prefix=self.inputs.out_warp_prefix, i=i, ext=ext)
287+
for i in range(1, n_vols + 1)]
288+
outputs['out_jacs'] = [
289+
fmt(prefix=self.inputs.out_jac_prefix, i=i, ext=ext)
290+
for i in range(1, n_vols + 1)]
288291

289292
if isdefined(self.inputs.encoding_direction):
290293
outputs['out_enc_file'] = self._get_encfilename()

0 commit comments

Comments
 (0)