Skip to content

Commit 4f9f5a5

Browse files
committed
FIX: PEP8 - E201 whitespace after '(' '[' '{'
1 parent 0ae9f22 commit 4f9f5a5

File tree

26 files changed

+127
-127
lines changed

26 files changed

+127
-127
lines changed

examples/smri_antsregistration_build_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
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',

nipype/algorithms/metrics.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ def _list_outputs(self):
359359

360360

361361
class FuzzyOverlapInputSpec(BaseInterfaceInputSpec):
362-
in_ref = InputMultiPath( File(exists=True), mandatory=True,
362+
in_ref = InputMultiPath(File(exists=True), mandatory=True,
363363
desc='Reference image. Requires the same dimensions as in_tst.')
364-
in_tst = InputMultiPath( File(exists=True), mandatory=True,
364+
in_tst = InputMultiPath(File(exists=True), mandatory=True,
365365
desc='Test image. Requires the same dimensions as in_ref.')
366366
weighting = traits.Enum('none', 'volume', 'squared_vol', usedefault=True,
367367
desc=('\'none\': no class-overlap weighting is '
@@ -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' )
377+
jaccard = traits.Float(desc='Fuzzy Jaccard Index (fJI), all the classes' )
378+
dice = traits.Float(desc='Fuzzy Dice Index (fDI), all the classes' )
379379
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' )
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,17 +444,17 @@ 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
455455
diff+= w* ch
456456

457-
nb.save(nb.Nifti1Image(diff, nb.load( self.inputs.in_ref[0]).get_affine(),
457+
nb.save(nb.Nifti1Image(diff, nb.load(self.inputs.in_ref[0]).get_affine(),
458458
nb.load(self.inputs.in_ref[0]).get_header()), self.inputs.out_file)
459459

460460

@@ -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" %
@@ -596,7 +596,7 @@ class SimilarityInputSpec(BaseInterfaceInputSpec):
596596

597597

598598
class SimilarityOutputSpec(TraitedSpec):
599-
similarity = traits.List( traits.Float(desc="Similarity between volume 1 and 2, frame by frame"))
599+
similarity = traits.List(traits.Float(desc="Similarity between volume 1 and 2, frame by frame"))
600600

601601

602602
class Similarity(BaseInterface):
@@ -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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_normalize_tpms():
2020
tempdir = mkdtemp()
2121

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

2626
mapdata = []
@@ -34,21 +34,21 @@ def test_normalize_tpms():
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(),
4040
im.get_header() ).to_filename(filename)
41-
in_files.append( 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

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

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
@@ -85,7 +85,7 @@ def _find(self, tests, obj, name, module, source_lines, globs, seen):
8585
if ismodule(obj) and self._recurse:
8686
for valname, val in list(obj.__dict__.items()):
8787
valname1 = '%s.%s' % (name, valname)
88-
if ( (isroutine(val) or isclass(val))
88+
if ((isroutine(val) or isclass(val))
8989
and self._from_module(module, val) ):
9090

9191
self._find(tests, val, valname1, module, source_lines,

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: 2 additions & 2 deletions
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
@@ -670,7 +670,7 @@ def _run_interface(self, runtime):
670670
""" Create empty grey matter mask, Populate with only those regions defined in the mapping."""
671671
niiGM = np.zeros(niiAPARCdata.shape, dtype=np.uint)
672672
for ma in MAPPING:
673-
niiGM[ niiAPARCdata == ma[1]] = ma[0]
673+
niiGM[niiAPARCdata == ma[1]] = ma[0]
674674
mapDict[ma[0]] = ma[1]
675675
iflogger.info('Grey matter mask created')
676676
greyMaskLabels = np.unique(niiGM)

nipype/interfaces/cmtk/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def _run_interface(self, runtime):
235235
# metadata information
236236
ne.load()
237237
contitle = mycon.get_connectome_meta().get_title()
238-
ne.set_name( str(i) + ': ' + contitle + ' - ' + ne.get_name() )
238+
ne.set_name(str(i) + ': ' + contitle + ' - ' + ne.get_name() )
239239
ne.set_src(ne.get_name())
240240
extracted_networks.append(ne)
241241

0 commit comments

Comments
 (0)