Skip to content

Commit 01e7b30

Browse files
committed
FIX: PEP8 - E202 whitespace before ')' ']' '}'
1 parent 4f9f5a5 commit 01e7b30

27 files changed

+130
-130
lines changed

examples/smri_ants_build_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
datasource = pe.Node(interface=util.IdentityInterface(fields=
8484
['imageList', 'passiveImagesDictionariesList']),
8585
run_without_submitting=True,
86-
name='InputImages' )
86+
name='InputImages')
8787
datasource.inputs.imageList=input_images
8888
datasource.inputs.passiveImagesDictionariesList=input_passive_images
8989
datasource.inputs.sort_filelist = True

examples/smri_antsregistration_build_template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@
103103
4. Define data sources. In real life these would be replace by DataGrabbers
104104
"""
105105

106-
InitialTemplateInputs=[mdict['T1'] for mdict in ListOfImagesDictionaries ]
106+
InitialTemplateInputs=[mdict['T1'] for mdict in ListOfImagesDictionaries]
107107

108108
datasource = pe.Node(interface=util.IdentityInterface(fields=
109109
['InitialTemplateInputs', 'ListOfImagesDictionaries',
110110
'registrationImageTypes','interpolationMapping']),
111111
run_without_submitting=True,
112-
name='InputImages' )
112+
name='InputImages')
113113
datasource.inputs.InitialTemplateInputs=InitialTemplateInputs
114114
datasource.inputs.ListOfImagesDictionaries=ListOfImagesDictionaries
115115
datasource.inputs.registrationImageTypes=registrationImageTypes

nipype/algorithms/metrics.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,11 @@ class FuzzyOverlapInputSpec(BaseInterfaceInputSpec):
374374

375375

376376
class FuzzyOverlapOutputSpec(TraitedSpec):
377-
jaccard = traits.Float(desc='Fuzzy Jaccard Index (fJI), all the classes' )
378-
dice = traits.Float(desc='Fuzzy Dice Index (fDI), all the classes' )
379-
diff_file = File(exists=True, desc='resulting difference-map of all classes, using the chosen weighting' )
380-
class_fji = traits.List(traits.Float(), desc='Array containing the fJIs of each computed class' )
381-
class_fdi = traits.List(traits.Float(), desc='Array containing the fDIs of each computed class' )
377+
jaccard = traits.Float(desc='Fuzzy Jaccard Index (fJI), all the classes')
378+
dice = traits.Float(desc='Fuzzy Dice Index (fDI), all the classes')
379+
diff_file = File(exists=True, desc='resulting difference-map of all classes, using the chosen weighting')
380+
class_fji = traits.List(traits.Float(), desc='Array containing the fJIs of each computed class')
381+
class_fdi = traits.List(traits.Float(), desc='Array containing the fDIs of each computed class')
382382

383383

384384
class FuzzyOverlap(BaseInterface):
@@ -406,11 +406,11 @@ class FuzzyOverlap(BaseInterface):
406406

407407
def _run_interface(self, runtime):
408408
ncomp = len(self.inputs.in_ref)
409-
assert(ncomp == len(self.inputs.in_tst) )
410-
weights = np.ones(shape=ncomp )
409+
assert(ncomp == len(self.inputs.in_tst))
410+
weights = np.ones(shape=ncomp)
411411

412-
img_ref = np.array([nb.load(fname ).get_data() for fname in self.inputs.in_ref ] )
413-
img_tst = np.array([nb.load(fname ).get_data() for fname in self.inputs.in_tst ] )
412+
img_ref = np.array([nb.load(fname).get_data() for fname in self.inputs.in_ref])
413+
img_tst = np.array([nb.load(fname).get_data() for fname in self.inputs.in_tst])
414414

415415

416416
msk = np.sum(img_ref, axis=0)
@@ -425,11 +425,11 @@ def _run_interface(self, runtime):
425425
self._jaccards = []
426426
volumes = []
427427

428-
diff_im = np.zeros(img_ref.shape )
428+
diff_im = np.zeros(img_ref.shape)
429429

430-
for ref_comp, tst_comp, diff_comp in zip(img_ref, img_tst, diff_im ):
431-
num = np.minimum(ref_comp, tst_comp )
432-
ddr = np.maximum(ref_comp, tst_comp )
430+
for ref_comp, tst_comp, diff_comp in zip(img_ref, img_tst, diff_im):
431+
num = np.minimum(ref_comp, tst_comp)
432+
ddr = np.maximum(ref_comp, tst_comp)
433433
diff_comp[ddr>0] += 1.0 - (num[ddr>0] / ddr[ddr>0])
434434
self._jaccards.append(np.sum(num) / np.sum(ddr))
435435
volumes.append(np.sum(ref_comp))
@@ -444,11 +444,11 @@ def _run_interface(self, runtime):
444444

445445
weights = weights / np.sum(weights)
446446

447-
setattr(self, '_jaccard', np.sum(weights * self._jaccards ) )
448-
setattr(self, '_dice', np.sum(weights * self._dices ) )
447+
setattr(self, '_jaccard', np.sum(weights * self._jaccards))
448+
setattr(self, '_dice', np.sum(weights * self._dices))
449449

450450

451-
diff = np.zeros(diff_im[0].shape )
451+
diff = np.zeros(diff_im[0].shape)
452452

453453
for w,ch in zip(weights,diff_im):
454454
ch[msk==0] = 0
@@ -519,7 +519,7 @@ def _run_interface(self, runtime):
519519
mapshape = ref_data.shape[:-1]
520520

521521
if isdefined(self.inputs.mask):
522-
msk = nb.load(self.inputs.mask ).get_data()
522+
msk = nb.load(self.inputs.mask).get_data()
523523
if (mapshape != msk.shape):
524524
raise RuntimeError("Mask should match volume shape, \
525525
mask is %s and volumes are %s" %
@@ -645,14 +645,14 @@ def _run_interface(self, runtime):
645645
dims = vol1_nii.get_data().ndim
646646

647647
if dims==3 or dims==2:
648-
vols1 = [vol1_nii ]
649-
vols2 = [vol2_nii ]
648+
vols1 = [vol1_nii]
649+
vols2 = [vol2_nii]
650650
if dims==4:
651-
vols1 = nb.four_to_three(vol1_nii )
652-
vols2 = nb.four_to_three(vol2_nii )
651+
vols1 = nb.four_to_three(vol1_nii)
652+
vols2 = nb.four_to_three(vol2_nii)
653653

654654
if dims<2 or dims>4:
655-
raise RuntimeError('Image dimensions not supported (detected %dD file)' % dims )
655+
raise RuntimeError('Image dimensions not supported (detected %dD file)' % dims)
656656

657657
if isdefined(self.inputs.mask1):
658658
mask1 = nb.load(self.inputs.mask1).get_data() == 1
@@ -666,13 +666,13 @@ def _run_interface(self, runtime):
666666

667667
self._similarity = []
668668

669-
for ts1,ts2 in zip(vols1, vols2 ):
669+
for ts1,ts2 in zip(vols1, vols2):
670670
histreg = HistogramRegistration(from_img = ts1,
671671
to_img = ts2,
672672
similarity=self.inputs.metric,
673673
from_mask = mask1,
674674
to_mask = mask2)
675-
self._similarity.append(histreg.eval(Affine()) )
675+
self._similarity.append(histreg.eval(Affine()))
676676

677677
return runtime
678678

nipype/algorithms/misc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,12 +1269,12 @@ def normalize_tpms(in_files, in_mask=None, out_files=[]):
12691269
weights = np.sum(img_data, axis=0)
12701270

12711271
msk = np.ones_like(imgs[0].get_data())
1272-
msk[weights<= 0 ] = 0
1272+
msk[weights<= 0] = 0
12731273

12741274
if not in_mask is None:
12751275
msk = nib.load(in_mask).get_data()
1276-
msk[msk<=0 ] = 0
1277-
msk[msk>0 ] = 1
1276+
msk[msk<=0] = 0
1277+
msk[msk>0] = 1
12781278

12791279
msk = np.ma.masked_equal(msk, 0)
12801280

nipype/algorithms/tests/test_normalize_tpms.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from tempfile import mkdtemp
99

1010
from nipype.testing import (assert_equal,assert_raises,
11-
assert_almost_equal,example_data )
11+
assert_almost_equal,example_data)
1212

1313
import numpy as np
1414
import nibabel as nb
@@ -19,8 +19,8 @@
1919
def test_normalize_tpms():
2020
tempdir = mkdtemp()
2121

22-
in_mask = example_data('tpms_msk.nii.gz' )
23-
mskdata = nb.load(in_mask ).get_data()
22+
in_mask = example_data('tpms_msk.nii.gz')
23+
mskdata = nb.load(in_mask).get_data()
2424
mskdata[mskdata>0.0] = 1.0
2525

2626
mapdata = []
@@ -29,27 +29,27 @@ def test_normalize_tpms():
2929

3030
for i in range(3):
3131
mapname = example_data('tpm_%02d.nii.gz' % i)
32-
filename = os.path.join(tempdir, 'modtpm_%02d.nii.gz' % i )
33-
out_files.append(os.path.join(tempdir, 'normtpm_%02d.nii.gz' % i ))
32+
filename = os.path.join(tempdir, 'modtpm_%02d.nii.gz' % i)
33+
out_files.append(os.path.join(tempdir, 'normtpm_%02d.nii.gz' % i))
3434

3535
im = nb.load(mapname)
3636
data = im.get_data()
37-
mapdata.append(data.copy() )
37+
mapdata.append(data.copy())
3838

3939
nb.Nifti1Image(2.0 * (data * mskdata), im.get_affine(),
40-
im.get_header() ).to_filename(filename)
41-
in_files.append(filename )
40+
im.get_header()).to_filename(filename)
41+
in_files.append(filename)
4242

43-
normalize_tpms(in_files, in_mask, out_files=out_files )
43+
normalize_tpms(in_files, in_mask, out_files=out_files)
4444

4545
sumdata = np.zeros_like(mskdata)
4646

47-
for i,tstfname in enumerate(out_files ):
48-
normdata = nb.load(tstfname ).get_data()
47+
for i,tstfname in enumerate(out_files):
48+
normdata = nb.load(tstfname).get_data()
4949
sumdata+=normdata
50-
yield assert_equal, np.all(normdata[mskdata==0]==0 ), True
51-
yield assert_equal, np.allclose(normdata, mapdata[i] ), True
50+
yield assert_equal, np.all(normdata[mskdata==0]==0), True
51+
yield assert_equal, np.allclose(normdata, mapdata[i]), True
5252

53-
yield assert_equal, np.allclose(sumdata[sumdata>0.0], 1.0 ), True
53+
yield assert_equal, np.allclose(sumdata[sumdata>0.0], 1.0), True
5454

5555
rmtree(tempdir)

nipype/external/portalocker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def unlock(file):
133133
portalocker.lock(log, portalocker.LOCK_EX)
134134

135135
timestamp = strftime('%m/%d/%Y %H:%M:%S\n', localtime(time()))
136-
log.write(timestamp )
136+
log.write(timestamp)
137137

138138
print('Wrote lines. Hit enter to release lock.')
139139
dummy = sys.stdin.readline()

nipype/fixes/numpy/testing/noseclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _find(self, tests, obj, name, module, source_lines, globs, seen):
8686
for valname, val in list(obj.__dict__.items()):
8787
valname1 = '%s.%s' % (name, valname)
8888
if ((isroutine(val) or isclass(val))
89-
and self._from_module(module, val) ):
89+
and self._from_module(module, val)):
9090

9191
self._find(tests, val, valname1, module, source_lines,
9292
globs, seen)

nipype/interfaces/ants/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ def _num_threads_update(self):
5959
## default behavior should be the one specified by ITKv4 rules
6060
## (i.e. respect SGE $NSLOTS or environmental variables of threads, or
6161
## user environmental settings)
62-
if (self.inputs.num_threads == -1 ):
63-
if (ALT_ITKv4_THREAD_LIMIT_VARIABLE in self.inputs.environ ):
62+
if (self.inputs.num_threads == -1):
63+
if (ALT_ITKv4_THREAD_LIMIT_VARIABLE in self.inputs.environ):
6464
del self.inputs.environ[ALT_ITKv4_THREAD_LIMIT_VARIABLE]
65-
if (PREFERED_ITKv4_THREAD_LIMIT_VARIABLE in self.inputs.environ ):
65+
if (PREFERED_ITKv4_THREAD_LIMIT_VARIABLE in self.inputs.environ):
6666
del self.inputs.environ[PREFERED_ITKv4_THREAD_LIMIT_VARIABLE]
6767
else:
6868
self.inputs.environ.update({PREFERED_ITKv4_THREAD_LIMIT_VARIABLE:

nipype/interfaces/ants/registration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def _formatMetric(self, index):
553553
else:
554554
temp["moving_image"] = self.inputs.moving_image[i]
555555

556-
specs.append(temp )
556+
specs.append(temp)
557557
else:
558558
specs = [stage_inputs]
559559

nipype/interfaces/cmtk/cmtk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def cmat(track_file, roi_file, resolution_network_file, matrix_name, matrix_mat_
265265
fiberlabels[i, 0] = startROI
266266
fiberlabels[i, 1] = endROI
267267

268-
final_fiberlabels.append([startROI, endROI ])
268+
final_fiberlabels.append([startROI, endROI])
269269
final_fibers_idx.append(i)
270270

271271
# Add edge to graph

0 commit comments

Comments
 (0)