Merged
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Original file line numberDiff line numberDiff line change
Expand Up@@ -714,7 +714,7 @@ def _run_interface(self, runtime):
mx = shape[0]
else:
mx = 1
for idx in range(0, mx):
for idx in range(mx):
extrafieldlist.append(self.inputs.extra_field)
iflogger.info(len(extrafieldlist))
output[extraheading] = extrafieldlist
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,7 +72,7 @@ def length(xyz, along=False):
def get_rois_crossed(pointsmm, roiData, voxelSize):
n_points = len(pointsmm)
rois_crossed = []
for j in range(0, n_points):
for j in range(n_points):
# store point
x = int(pointsmm[j, 0] / float(voxelSize[0]))
y = int(pointsmm[j, 1] / float(voxelSize[1]))
Expand DownExpand Up@@ -894,7 +894,7 @@ def _run_interface(self, runtime):
iflogger.info("Number of labels in LUT: %s", numLUTLabels)
LUTlabelDict = {}
""" Create dictionary for input LUT table"""
for labels in range(0, numLUTLabels):
for labels in range(numLUTLabels):
LUTlabelDict[LUTlabelsRGBA[labels][0]] = [
LUTlabelsRGBA[labels][1],
LUTlabelsRGBA[labels][2],
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -353,7 +353,7 @@ def add_edge_data(edge_array, ntwk, above=0, below=0):
edge_ntwk = ntwk.copy()
data = {}
for x, row in enumerate(edge_array):
for y in range(0, np.max(np.shape(edge_array[x]))):
for y in range(np.max(np.shape(edge_array[x]))):
if not edge_array[x, y] == 0:
data["value"] = edge_array[x, y]
if data["value"] <= below or data["value"] >= above:
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -471,20 +471,15 @@ def _parse_files(self, filenames):
for filename in filenames:
# search for relevant files, and sort accordingly
for fl in search_files(filename, outtypes, self.inputs.crop):
if (
fl.endswith(".nii")
or fl.endswith(".gz")
or fl.endswith(".nrrd")
or fl.endswith(".nhdr")
):
if fl.endswith((".nii", ".gz", ".nrrd", ".nhdr")):
outfiles.append(fl)
elif fl.endswith(".bval"):
bvals.append(fl)
elif fl.endswith(".bvec"):
bvecs.append(fl)
elif fl.endswith(".mvec"):
mvecs.append(fl)
elif fl.endswith(".json") or fl.endswith(".txt"):
elif fl.endswith((".json", ".txt")):
bids.append(fl)

# in siemens mosaic conversion nipype misread dcm2niix output and generate a duplicate list of results
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -136,7 +136,6 @@ def _run_interface(self, runtime):
)
except:
bias = 0.0
pass

sigma = mean_std * (1 + bias)

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -344,7 +344,7 @@ def _generate_gradients(ndirs=64, values=[1000, 3000], nb0s=1):
bvecs = np.vstack((bvecs, vertices))
bvals = np.hstack((bvals, v * np.ones(vertices.shape[0])))

for i in range(0, nb0s):
for i in range(nb0s):
bvals = bvals.tolist()
bvals.insert(0, 0)

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -580,7 +580,7 @@ def _list_outputs(self):
stem = ".".join(outfile.split(".")[:-1])
ext = "." + outfile.split(".")[-1]
outfile = []
for idx in range(0, tp):
for idx in range(tp):
outfile.append(stem + "%04d" % idx + ext)
if isdefined(self.inputs.out_type):
if self.inputs.out_type in ["spm", "analyze"]:
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -2836,7 +2836,7 @@ def _format_arg(self, name, spec, value):
suffix = basename.split(".")[1]
return spec.argstr % suffix
elif name == "in_orig":
if value.endswith("lh.orig") or value.endswith("rh.orig"):
if value.endswith(("lh.orig", "rh.orig")):
# {lh,rh}.orig inputs are not specified on command line
return
else:
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,7 +259,7 @@ def _create_ev_files(
# add ev orthogonalization
for i in range(1, num_evs[0] + 1):
initial = ev_ortho.substitute(c0=i, c1=0, orthogonal=1)
for j in range(0, num_evs[0] + 1):
for j in range(num_evs[0] + 1):
try:
orthogonal = int(orthogonalization[i][j])
except (KeyError, TypeError, ValueError, IndexError):
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,6 @@ def _format_arg(self, name, trait_spec, value):
value = cpu_count()
except:
iflogger.warning("Number of threads could not be computed")
pass
return trait_spec.argstr % value

if name == "in_bvec":
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -356,7 +356,7 @@ def func1(in1):
# check that multiple json's don't trigger rerun
with open(os.path.join(node.output_dir(), "test.json"), "w") as fp:
fp.write("dummy file")
w1.config["execution"].update(**{"stop_on_first_rerun": True})
w1.config["execution"].update(stop_on_first_rerun=True)

w1.run()

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,7 @@ def dummyFunction(filename):
This function writes the value 45 to the given filename.
"""
j = 0
for i in range(0, 10):
for i in range(10):
j += i

# j is now 45 (0+1+2+3+4+5+6+7+8+9)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,6 @@
"Pandas not found; in order for full functionality of this module "
"install the pandas package"
)
pass


def create_event_dict(start_time, nodes_list):
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -566,7 +566,7 @@ def load_json(filename):


def loadcrash(infile, *args):
if infile.endswith("pkl") or infile.endswith("pklz"):
if infile.endswith(("pkl", "pklz")):
return loadpkl(infile)
else:
raise ValueError("Only pickled crashfiles are supported")
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -288,7 +288,7 @@ def get_boutiques_input(
if handler_type == "TraitCompound":
input_list = []
# Recursively create an input for each trait
for i in range(0, len(trait_handler.handlers)):
for i in range(len(trait_handler.handlers)):
inp = get_boutiques_input(
inputs,
interface,
Expand Down