From 83e0aa9b16c3b146a4d2b35049c24fcae068c805 Mon Sep 17 00:00:00 2001 From: fliem Date: Thu, 3 Mar 2016 20:00:11 +0100 Subject: [PATCH 001/365] wip: added wrapper for antsRegistrationSyNQuick.sh --- nipype/interfaces/ants/registration.py | 86 ++++++++++++++++++++++++++ nipype/interfaces/ants/syn_test.py | 1 + 2 files changed, 87 insertions(+) create mode 100644 nipype/interfaces/ants/syn_test.py diff --git a/nipype/interfaces/ants/registration.py b/nipype/interfaces/ants/registration.py index 89af092a33..beda7b6977 100644 --- a/nipype/interfaces/ants/registration.py +++ b/nipype/interfaces/ants/registration.py @@ -975,3 +975,89 @@ def _list_outputs(self): if len(self.inputs.save_state): outputs['save_state'] = os.path.abspath(self.inputs.save_state) return outputs + + + + + +class RegistrationSynQuickInputSpec(ANTSCommandInputSpec): + dimension = traits.Enum(3, 2, argstr='-d %d', + usedefault=True, desc='image dimension (2 or 3)') + fixed_image = InputMultiPath(File(exists=True), mandatory=True, argstr='-f %s', + desc='Fixed image or source image or reference image') + moving_image = InputMultiPath(File(exists=True), mandatory=True, argstr='-m %s', + desc='Moving image or target image') + output_prefix = traits.Str("transform", usedefault=True, argstr='-o %s', + desc="A prefix that is prepended to all output files") + + # todo ANTSCommandInputSpec already has this, but I can't figure out how to set it without defining it again + num_threads = traits.Int(default_value=1, desc='Number of threads (default = 1)', argstr='-n %d') + + transform_type = traits.Enum('s', 't', 'r', 'a', 'sr', 'b', 'br', argstr='-t %s', + desc='transform type\n\ + t: translation\ + r: rigid \n\ + a: rigid + affine\n\ + s: rigid + affine + deformable syn (default)\ + sr: rigid + deformable syn\ + b: rigid + affine + deformable b-spline syn\n\ + br: rigid + deformable b-spline syn', + usedefault=True) + + use_histogram_matching = traits.Bool(default=False, argstr='-j %s', + desc='use histogram matching') + histogram_bins = traits.Int(default_value=32, argstr='-r %d', + desc='histogram bins for mutual information in SyN stage \ + (default = 32)') + spline_distance = traits.Int(default_value=26, argstr='-s %d', + desc='spline distance for deformable B-spline SyN transform \ + (default = 26)') + precision_type = traits.Enum('double', 'float', argstr='-p %s', + desc='precision type (default = double)', usedefault=True) + + +class RegistrationSynQuickOutputSpec(TraitedSpec): + warped_image = File(exists=True, desc="Warped image") + inverse_warped_image = File(exists=True, desc="Inverse warped image") + out_matrix = File(exists=True, desc='Affine matrix') + forward_warp_field = File(exists=True, desc='Forward warp field') + inverse_warp_field = File(exists=True, desc='Inverse warp field') + + +class RegistrationSynQuick(ANTSCommand): + """ + Examples + -------- + + """ + # todo examples + + _cmd = 'antsRegistrationSynQuick.sh' + input_spec = RegistrationSynQuickInputSpec + output_spec = RegistrationSynQuickOutputSpec + + def _format_arg(self, name, spec, value): + if name == 'use_histogram_matching': + if isdefined(self.inputs.use_histogram_matching): + return spec.argstr % {False: '0', True: '1'}[value] + + elif name == 'precision_type': + if isdefined(self.inputs.precision_type): + return spec.argstr % {'float': 'f', 'double': 'd'}[value] + return super(RegistrationSynQuick, self)._format_arg(name, spec, value) + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['warped_image'] = os.path.abspath(self.inputs.output_prefix + 'Warped.nii.gz') + outputs['inverse_warped_image'] = os.path.abspath( + self.inputs.output_prefix + 'InverseWarped.nii.gz') + outputs['out_matrix'] = os.path.abspath(self.inputs.output_prefix + '0GenericAffine.mat') + + # todo in the case of linear transformation-only there won't be fields. is there a more elegant way to specify that? + if self.inputs.transform_type not in ('t', 'r', 'a'): + outputs['forward_warp_field'] = os.path.abspath( + self.inputs.output_prefix + '1Warp.nii.gz') + outputs['inverse_warp_field'] = os.path.abspath( + self.inputs.output_prefix + '1InverseWarp.nii.gz') + return outputs + diff --git a/nipype/interfaces/ants/syn_test.py b/nipype/interfaces/ants/syn_test.py new file mode 100644 index 0000000000..25e255a40c --- /dev/null +++ b/nipype/interfaces/ants/syn_test.py @@ -0,0 +1 @@ +__author__ = 'franzliem' From 26aa5d5bd46431d2c935202932f042504da98ae1 Mon Sep 17 00:00:00 2001 From: fliem Date: Thu, 3 Mar 2016 20:21:38 +0100 Subject: [PATCH 002/365] removed wrongly commited file --- nipype/interfaces/ants/syn_test.py | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nipype/interfaces/ants/syn_test.py diff --git a/nipype/interfaces/ants/syn_test.py b/nipype/interfaces/ants/syn_test.py deleted file mode 100644 index 25e255a40c..0000000000 --- a/nipype/interfaces/ants/syn_test.py +++ /dev/null @@ -1 +0,0 @@ -__author__ = 'franzliem' From 307fdde6996d6046e12df08690a8a8bf06d3c09e Mon Sep 17 00:00:00 2001 From: forwho Date: Tue, 20 Sep 2016 23:27:49 +0800 Subject: [PATCH 003/365] Update dti.py fix the bug of diffusion_toolkit interfaces --- nipype/interfaces/diffusion_toolkit/dti.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/diffusion_toolkit/dti.py b/nipype/interfaces/diffusion_toolkit/dti.py index 3ba0beeafc..ead0e222c6 100644 --- a/nipype/interfaces/diffusion_toolkit/dti.py +++ b/nipype/interfaces/diffusion_toolkit/dti.py @@ -129,7 +129,7 @@ class DTITrackerInputSpec(CommandLineInputSpec): angle_threshold_weight = traits.Float(desc="set angle threshold weighting factor. weighting will be be applied \ on top of the angle_threshold", argstr="-atw %f") random_seed = traits.Int(desc="use random location in a voxel instead of the center of the voxel \ - to seed. can also define number of seed per voxel. default is 1", argstr="-rseed") + to seed. can also define number of seed per voxel. default is 1", argstr="-rseed %d") invert_x = traits.Bool(desc="invert x component of the vector", argstr="-ix") invert_y = traits.Bool(desc="invert y component of the vector", argstr="-iy") invert_z = traits.Bool(desc="invert z component of the vector", argstr="-iz") From 6ea8e5d70868517e5da9f17eacd4303f9285202a Mon Sep 17 00:00:00 2001 From: Kesshi jordan Date: Fri, 19 May 2017 14:29:35 -0700 Subject: [PATCH 004/365] added interface for dtitk --- .zenodo.json | 5 + nipype/interfaces/dtitk/utils.py | 461 +++++++++++++++++++++++++++++++ 2 files changed, 466 insertions(+) create mode 100644 nipype/interfaces/dtitk/utils.py diff --git a/.zenodo.json b/.zenodo.json index f5ec9ab0ea..acb88c13e5 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -81,6 +81,11 @@ "name": "Keshavan, Anisha", "orcid": "0000-0003-3554-043X" }, + { + "affiliation": "UC Berkeley - UCSF Graduate Program in Bioengineering", + "name": "Jordan, Kesshi", + "orcid": "0000-0001-6313-0580" + }, { "affiliation": "Developer", "name": "Clark, Daniel", diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py new file mode 100644 index 0000000000..4863a1fe94 --- /dev/null +++ b/nipype/interfaces/dtitk/utils.py @@ -0,0 +1,461 @@ +__author__ = 'kjordan' + +from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, CommandLine, File, traits, isdefined, split_filename +from nipype.utils.filemanip import fname_presuffix +import os +from nipype.interfaces.fsl.base import Info + + + +# TODO: fix all wrappers to reflect the one with ScalarVol + +class CommandLineDtitk(CommandLine): + + def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, + ext=None): + """Generate a filename based on the given parameters. + + The filename will take the form: cwd/basename. + If change_ext is True, it will use the extentions specified in + intputs.output_type. + + Parameters + ---------- + basename : str + Filename to base the new filename on. + cwd : str + Path to prefix to the new filename. (default is os.getcwd()) + suffix : str + Suffix to add to the `basename`. (defaults is '' ) + change_ext : bool + Flag to change the filename extension to the FSL output type. + (default True) + + Returns + ------- + fname : str + New filename based on given parameters. + + """ + + if basename == '': + msg = 'Unable to generate filename for command %s. ' % self.cmd + msg += 'basename is not set!' + raise ValueError(msg) + if cwd is None: + cwd = os.getcwd() + if ext is None: + #print "AAA" + #print self.inputs.output_type + ext = Info.output_type_to_ext(self.inputs.output_type) + if change_ext: + if suffix: + suffix = ''.join((suffix, ext)) + else: + suffix = ext + if suffix is None: + suffix = '' + fname = fname_presuffix(basename, suffix=suffix, + use_ext=False, newpath=cwd) + return fname + + +class TVAdjustOriginInputSpec(CommandLineInputSpec): + in_file = File(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + out_file = traits.Str(genfile=True, desc='output path', position=1, argstr="-out %s") + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + + +class TVAdjustOriginOutputSpec(TraitedSpec): + out_file = traits.Str(exists=True) + + +class TVAdjustOriginTask(CommandLineDtitk): + input_spec = TVAdjustOriginInputSpec + output_spec = TVAdjustOriginOutputSpec + _cmd = 'TVAdjustVoxelspace' + _suffix = "_originzero" + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join(self.inputs.in_file.split(".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) + return outputs + + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + +class TVAdjustVoxSpInputSpec(CommandLineInputSpec): + in_file = File(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + out_file = traits.Str(genfile=True, desc='output path', position=1, argstr="-out %s") + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, \ + argstr="-target %s") + vsize = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, \ + argstr="-vsize %s") + +class TVAdjustVoxSpOutputSpec(TraitedSpec): + out_file = traits.Str(exists=True) + + +class TVAdjustVoxSpTask(CommandLineDtitk): + input_spec = TVAdjustVoxSpInputSpec + output_spec = TVAdjustVoxSpOutputSpec + _cmd = 'TVAdjustVoxelspace' + _suffix = '_reslice' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join(self.inputs.in_file.split(".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) + return outputs + + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + + +class RigidInputSpec(CommandLineInputSpec): + fixed_file = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=True, \ + position=0, argstr="%s") + moving_file = traits.Str(desc="diffusion tensor image path", exists=True, mandatory=True, \ + position=1, argstr="%s") + similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', \ + exists=True, mandatory=True, position=2, + argstr="%s", desc="similarity metric") + +class RigidOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class RigidTask(CommandLineDtitk): + input_spec = RigidInputSpec + output_spec = RigidOutputSpec + _cmd = 'dti_rigid_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz','.aff') + outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', '_aff.nii.gz') + return outputs + + +class AffineInputSpec(CommandLineInputSpec): + in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=False, \ + position=0, argstr="%s") + in_moving_txt = traits.Str(desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, \ + position=1, argstr="%s") + in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', \ + exists=True, mandatory=False, position=3, argstr="%s", desc = "similarity metric") + in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, mandatory=False, position=4, argstr="%s", \ + desc="initialize using rigid transform??") + + +class AffineOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class AffineTask(CommandLineDtitk): + input_spec = AffineInputSpec + output_spec = AffineOutputSpec + _cmd = 'dti_affine_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz','.aff') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', '_aff.nii.gz') + return outputs + + +class DiffeoInputSpec(CommandLineInputSpec): + in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=False, \ + position=0, argstr="%s") + in_moving_txt = traits.Str(desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, \ + position=1, argstr="%s") + in_mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, argstr="%s") + in_numbers = traits.Str(desc='#iters ftol', exists=True, mandatory=False, position=3, argstr="%s") + + +class DiffeoOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class DiffeoTask(CommandLineDtitk): + input_spec = DiffeoInputSpec + output_spec = DiffeoOutputSpec + _cmd = 'dti_diffeomorphic_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz','_aff_diffeo.df.nii.gz') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', '_aff_diffeo.nii.gz') + return outputs + + +class ComposeXfmInputSpec(CommandLineInputSpec): + in_df = traits.Str(desc='diffeomorphic file.df.nii.gz', exists=True, mandatory=False, position=1, argstr="-df %s") + in_aff = traits.Str(desc='affine file.aff', exists=True, mandatory=False, position=0, argstr="-aff %s") + out_path = traits.Str(desc='output_path', exists=True, mandatory=False, position=2, argstr="-out %s", \ + name_source="in_df", name_template="%s_comboaff.nii.gz") + + +class ComposeXfmOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class ComposeXfmTask(CommandLineDtitk): + input_spec = ComposeXfmInputSpec + output_spec = ComposeXfmOutputSpec + _cmd = 'dfRightComposeAffine' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.in_df.replace('.df.nii.gz', '_combo.df.nii.gz') + return outputs + + +class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", \ + name_source="in_tensor", name_template="%s_diffeoxfmd.nii.gz") + + +class diffeoSymTensor3DVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class diffeoSymTensor3DVolTask(CommandLineDtitk): + input_spec = diffeoSymTensor3DVolInputSpec + output_spec = diffeoSymTensor3DVolOutputSpec + _cmd = 'deformationSymTensor3DVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_path + return outputs + + +class affSymTensor3DVolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", \ + name_source="in_tensor", name_template="%s_affxfmd.nii.gz") + + +class affSymTensor3DVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class affSymTensor3DVolTask(CommandLineDtitk): + input_spec = affSymTensor3DVolInputSpec + output_spec = affSymTensor3DVolOutputSpec + _cmd = 'affineSymTensor3DVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class affScalarVolInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") + in_target = traits.Str(desc='', position=2, argstr="-target %s") + out_path = traits.Str(desc='', mandatory=False, position=3, argstr="-out %s", + name_source="in_volume", name_template="%s_affxfmd.nii.gz") + + +class affScalarVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='moved volume', exists=True) + + +class affScalarVolTask(CommandLineDtitk): + input_spec = affScalarVolInputSpec + output_spec = affScalarVolOutputSpec + _cmd = 'affineScalarVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class diffeoScalarVolInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=2, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") + out_path = traits.Str(desc='', position=1, argstr="-out %s", name_source="in_volume", \ + name_template="%s_diffeoxfmd.nii.gz") + in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, argstr="-vsize %s") + in_flip = traits.Str(desc='', exists=True, mandatory=False, position=5, argstr="-flip %s") + in_type = traits.Str(desc='', exists=True, mandatory=False, position=6, argstr="-type %s") + in_interp = traits.Str(desc='0 trilin, 1 NN', exists=True, mandatory=False, position=7, argstr="-interp %s") + + +class diffeoScalarVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='moved volume', exists=True) + + +class diffeoScalarVolTask(CommandLineDtitk): + input_spec = diffeoScalarVolInputSpec + output_spec = diffeoScalarVolOutputSpec + _cmd = 'deformationScalarVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + if not isdefined(self.inputs.out_path): + self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_diffeoxfmd",newpath=os.path.abspath(".")) + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + +''' +#TODO not using these yet... need to be tested + +class SVAdjustVoxSpInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + in_target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, \ + argstr="-target %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, \ + argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=1, \ + argstr="-out %s", name_source="in_volume", name_template='%s_origmvd.nii.gz') + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + + +class SVAdjustVoxSpOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class SVAdjustVoxSpTask(CommandLineDtitk): + input_spec = SVAdjustVoxSpInputSpec + output_spec = SVAdjustVoxSpOutputSpec + _cmd = 'SVAdjustVoxelspace' + + def _list_outputs(self): + outputs = self.output_spec().get() + if not isdefined(self.inputs.out_path): + self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_origmvd", newpath=os.path.abspath(".")) + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs +''' + +''' +class TVResampleInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ + argstr="-size %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, \ + argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, \ + argstr="-out %s", name_source="in_volume", name_template="%s_resampled.nii.gz" ) + + +class TVResampleOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class TVResampleTask(CommandLineDtitk): + input_spec = TVResampleInputSpec + output_spec = TVResampleOutputSpec + _cmd = 'TVResample' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class SVResampleInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") + in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ + argstr="-size %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, \ + argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, \ + argstr="-out %s", name_source="in_volume", name_template="%s_resampled.nii.gz") + + +class SVResampleOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class SVResampleTask(CommandLineDtitk): + input_spec = SVResampleInputSpec + output_spec = SVResampleOutputSpec + _cmd = 'SVResample' + + def _list_outputs(self): + outputs = self.output_spec().get() + if not isdefined(self.inputs.out_path): + self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_resampled",newpath=os.path.abspath(".")) + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + +class TVtoolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc="image to resample", exists=True, mandatory=False, position=0, argstr="-in %s") + in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, mandatory=False, position=1, \ + argstr="-%s", desc='') + + +class TVtoolOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class TVtoolTask(CommandLineDtitk): + input_spec = TVtoolInputSpec + output_spec = TVtoolOutputSpec + _cmd = 'TVtool' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.in_tensor.replace('.nii.gz', '_'+self.inputs.in_flag+'.nii.gz') + return outputs + + +class BinThreshInputSpec(CommandLineInputSpec): + in_image = traits.Str(desc='', exists=True, mandatory=False, position=0, argstr="%s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") + in_numbers = traits.Str(desc='LB UB inside_value outside_value', exists=True, mandatory=False, position=2, argstr="%s") + + +class BinThreshOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + + +class BinThreshTask(CommandLineDtitk): + input_spec = BinThreshInputSpec + output_spec = BinThreshOutputSpec + _cmd='BinaryThresholdImageFilter' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_path + return outputs + +''' +''' + def _gen_filename(self, name): + print "diffeo worked" + out_file = self.inputs.out_file + if not isdefined(out_file) and isdefined(self.inputs.in_volume): + out_file = self._gen_filename(self.inputs.in_file, suffix='_diffeoxfmd') + return os.path.abspath(out_file) + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_path + return outputs +''' From 52325527acf43a2171b34d4924c67d0895154051 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 19 May 2017 15:49:22 -0700 Subject: [PATCH 005/365] Added interface for DTITK command-line tools --- nipype/interfaces/dtitk/base.py | 81 +++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 nipype/interfaces/dtitk/base.py diff --git a/nipype/interfaces/dtitk/base.py b/nipype/interfaces/dtitk/base.py new file mode 100644 index 0000000000..d5a10af8bf --- /dev/null +++ b/nipype/interfaces/dtitk/base.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: +"""The dtitk module provides classes for interfacing with the `DTITK +`_ command line tools. + +These are the base tools for working with DTITK. +Preprocessing tools are found in dtitk/preprocess.py +Registration tools are found in dtitk/registration.py + +Currently these tools are supported: + +* Rigid Tensor Registration +* Affine Tensor Registration +* Diffeomorphic Tensor Registration + +Examples +-------- +See the docstrings of the individual classes for examples. + +""" +from __future__ import print_function, division, unicode_literals, \ + absolute_import + +import os + +from ... import logging +from ...utils.filemanip import fname_presuffix +from ..base import traits, CommandLine +from nipype.interfaces.fsl.base import Info + +LOGGER = logging.getLogger('interface') + + +class CommandLineDtitk(CommandLine): + + def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, + ext=None): + """Generate a filename based on the given parameters. + + The filename will take the form: cwd/basename. + If change_ext is True, it will use the extentions specified in + intputs.output_type. + + Parameters + ---------- + basename : str + Filename to base the new filename on. + cwd : str + Path to prefix to the new filename. (default is os.getcwd()) + suffix : str + Suffix to add to the `basename`. (defaults is '' ) + change_ext : bool + Flag to change the filename extension to the FSL output type. + (default True) + + Returns + ------- + fname : str + New filename based on given parameters. + + """ + + if basename == '': + msg = 'Unable to generate filename for command %s. ' % self.cmd + msg += 'basename is not set!' + raise ValueError(msg) + if cwd is None: + cwd = os.getcwd() + if ext is None: + ext = Info.output_type_to_ext(self.inputs.output_type) + if change_ext: + if suffix: + suffix = ''.join((suffix, ext)) + else: + suffix = ext + if suffix is None: + suffix = '' + fname = fname_presuffix(basename, suffix=suffix, + use_ext=False, newpath=cwd) + return fname From ae5922677f4bc6952f212c298de2678e7f06480d Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 19 May 2017 16:51:41 -0700 Subject: [PATCH 006/365] Added several docstring tests and untested interfaces --- nipype/interfaces/dtitk/utils.py | 545 +++++++++++++------------------ 1 file changed, 224 insertions(+), 321 deletions(-) diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 4863a1fe94..e7dfa2272f 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -1,69 +1,18 @@ __author__ = 'kjordan' -from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, CommandLine, File, traits, isdefined, split_filename -from nipype.utils.filemanip import fname_presuffix +from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, File, \ + traits, isdefined, split_filename import os -from nipype.interfaces.fsl.base import Info - - - -# TODO: fix all wrappers to reflect the one with ScalarVol - -class CommandLineDtitk(CommandLine): - - def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, - ext=None): - """Generate a filename based on the given parameters. - - The filename will take the form: cwd/basename. - If change_ext is True, it will use the extentions specified in - intputs.output_type. - - Parameters - ---------- - basename : str - Filename to base the new filename on. - cwd : str - Path to prefix to the new filename. (default is os.getcwd()) - suffix : str - Suffix to add to the `basename`. (defaults is '' ) - change_ext : bool - Flag to change the filename extension to the FSL output type. - (default True) - - Returns - ------- - fname : str - New filename based on given parameters. - - """ - - if basename == '': - msg = 'Unable to generate filename for command %s. ' % self.cmd - msg += 'basename is not set!' - raise ValueError(msg) - if cwd is None: - cwd = os.getcwd() - if ext is None: - #print "AAA" - #print self.inputs.output_type - ext = Info.output_type_to_ext(self.inputs.output_type) - if change_ext: - if suffix: - suffix = ''.join((suffix, ext)) - else: - suffix = ext - if suffix is None: - suffix = '' - fname = fname_presuffix(basename, suffix=suffix, - use_ext=False, newpath=cwd) - return fname +from .base import CommandLineDtitk class TVAdjustOriginInputSpec(CommandLineInputSpec): - in_file = File(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - out_file = traits.Str(genfile=True, desc='output path', position=1, argstr="-out %s") - origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + in_file = File(desc="image to resample", exists=True, mandatory=True, + position=0, argstr="-in %s") + out_file = traits.Str(genfile=True, desc='output path', position=1, + argstr="-out %s") + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, + position=4, argstr='-origin %s') class TVAdjustOriginOutputSpec(TraitedSpec): @@ -71,6 +20,18 @@ class TVAdjustOriginOutputSpec(TraitedSpec): class TVAdjustOriginTask(CommandLineDtitk): + """ + Moves the origin of a tensor volume to zero + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.TVAdjustOriginTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ + input_spec = TVAdjustOriginInputSpec output_spec = TVAdjustOriginOutputSpec _cmd = 'TVAdjustVoxelspace' @@ -80,7 +41,11 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file'] = self.inputs.out_file if not isdefined(self.inputs.out_file): - outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join(self.inputs.in_file.split(".")[1:])) + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.'+'.'.join( + self.inputs.in_file.split( + ".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -89,20 +54,36 @@ def _gen_filename(self, name): return self._list_outputs()["out_file"] return None + class TVAdjustVoxSpInputSpec(CommandLineInputSpec): - in_file = File(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - out_file = traits.Str(genfile=True, desc='output path', position=1, argstr="-out %s") - origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') - target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, \ - argstr="-target %s") - vsize = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, \ - argstr="-vsize %s") + in_file = File(desc="image to resample", exists=True, mandatory=True, + position=0, argstr="-in %s") + out_file = traits.Str(genfile=True, desc='output path', position=1, + argstr="-out %s") + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, + position=4, argstr='-origin %s') + target = traits.Str(desc='target volume', exists=True, mandatory=False, + position=2, argstr="-target %s") + vsize = traits.Str(desc='resampled voxel size', exists=True, + mandatory=False, position=3, argstr="-vsize %s") + class TVAdjustVoxSpOutputSpec(TraitedSpec): out_file = traits.Str(exists=True) class TVAdjustVoxSpTask(CommandLineDtitk): + """ + Adjusts the voxel space of a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.TVAdjustVoxSpTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ input_spec = TVAdjustVoxSpInputSpec output_spec = TVAdjustVoxSpOutputSpec _cmd = 'TVAdjustVoxelspace' @@ -112,7 +93,11 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file'] = self.inputs.out_file if not isdefined(self.inputs.out_file): - outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join(self.inputs.in_file.split(".")[1:])) + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.'+'.'.join( + self.inputs.in_file.split( + ".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -122,217 +107,21 @@ def _gen_filename(self, name): return None -class RigidInputSpec(CommandLineInputSpec): - fixed_file = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=True, \ - position=0, argstr="%s") - moving_file = traits.Str(desc="diffusion tensor image path", exists=True, mandatory=True, \ - position=1, argstr="%s") - similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', \ - exists=True, mandatory=True, position=2, - argstr="%s", desc="similarity metric") - -class RigidOutputSpec(TraitedSpec): - out_file = traits.File(exists=True) - out_file_xfm = traits.File(exists=True) - - -class RigidTask(CommandLineDtitk): - input_spec = RigidInputSpec - output_spec = RigidOutputSpec - _cmd = 'dti_rigid_sn' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz','.aff') - outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', '_aff.nii.gz') - return outputs - - -class AffineInputSpec(CommandLineInputSpec): - in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=False, \ - position=0, argstr="%s") - in_moving_txt = traits.Str(desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, \ - position=1, argstr="%s") - in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', \ - exists=True, mandatory=False, position=3, argstr="%s", desc = "similarity metric") - in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, mandatory=False, position=4, argstr="%s", \ - desc="initialize using rigid transform??") - - -class AffineOutputSpec(TraitedSpec): - out_file = traits.File(exists=True) - out_file_xfm = traits.File(exists=True) - - -class AffineTask(CommandLineDtitk): - input_spec = AffineInputSpec - output_spec = AffineOutputSpec - _cmd = 'dti_affine_sn' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz','.aff') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', '_aff.nii.gz') - return outputs - - -class DiffeoInputSpec(CommandLineInputSpec): - in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", exists=True, mandatory=False, \ - position=0, argstr="%s") - in_moving_txt = traits.Str(desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, \ - position=1, argstr="%s") - in_mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, argstr="%s") - in_numbers = traits.Str(desc='#iters ftol', exists=True, mandatory=False, position=3, argstr="%s") - - -class DiffeoOutputSpec(TraitedSpec): - out_file = traits.File(exists=True) - out_file_xfm = traits.File(exists=True) - - -class DiffeoTask(CommandLineDtitk): - input_spec = DiffeoInputSpec - output_spec = DiffeoOutputSpec - _cmd = 'dti_diffeomorphic_sn' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz','_aff_diffeo.df.nii.gz') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', '_aff_diffeo.nii.gz') - return outputs - - -class ComposeXfmInputSpec(CommandLineInputSpec): - in_df = traits.Str(desc='diffeomorphic file.df.nii.gz', exists=True, mandatory=False, position=1, argstr="-df %s") - in_aff = traits.Str(desc='affine file.aff', exists=True, mandatory=False, position=0, argstr="-aff %s") - out_path = traits.Str(desc='output_path', exists=True, mandatory=False, position=2, argstr="-out %s", \ - name_source="in_df", name_template="%s_comboaff.nii.gz") - - -class ComposeXfmOutputSpec(TraitedSpec): - out_file = traits.File(desc='cheese', exists=True) - - -class ComposeXfmTask(CommandLineDtitk): - input_spec = ComposeXfmInputSpec - output_spec = ComposeXfmOutputSpec - _cmd = 'dfRightComposeAffine' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.in_df.replace('.df.nii.gz', '_combo.df.nii.gz') - return outputs - - -class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") - in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", \ - name_source="in_tensor", name_template="%s_diffeoxfmd.nii.gz") - - -class diffeoSymTensor3DVolOutputSpec(TraitedSpec): - out_file = traits.File(desc='cheese', exists=True) - - -class diffeoSymTensor3DVolTask(CommandLineDtitk): - input_spec = diffeoSymTensor3DVolInputSpec - output_spec = diffeoSymTensor3DVolOutputSpec - _cmd = 'deformationSymTensor3DVolume' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.out_path - return outputs - - -class affSymTensor3DVolInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") - in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", \ - name_source="in_tensor", name_template="%s_affxfmd.nii.gz") - - -class affSymTensor3DVolOutputSpec(TraitedSpec): - out_file = traits.File(desc='cheese', exists=True) - - -class affSymTensor3DVolTask(CommandLineDtitk): - input_spec = affSymTensor3DVolInputSpec - output_spec = affSymTensor3DVolOutputSpec - _cmd = 'affineSymTensor3DVolume' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) - return outputs - - -class affScalarVolInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=1, argstr="-trans %s") - in_target = traits.Str(desc='', position=2, argstr="-target %s") - out_path = traits.Str(desc='', mandatory=False, position=3, argstr="-out %s", - name_source="in_volume", name_template="%s_affxfmd.nii.gz") - - -class affScalarVolOutputSpec(TraitedSpec): - out_file = traits.File(desc='moved volume', exists=True) +# TODO not using these yet... need to be tested -class affScalarVolTask(CommandLineDtitk): - input_spec = affScalarVolInputSpec - output_spec = affScalarVolOutputSpec - _cmd = 'affineScalarVolume' - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) - return outputs - - -class diffeoScalarVolInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, position=2, argstr="-trans %s") - in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") - out_path = traits.Str(desc='', position=1, argstr="-out %s", name_source="in_volume", \ - name_template="%s_diffeoxfmd.nii.gz") - in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, argstr="-vsize %s") - in_flip = traits.Str(desc='', exists=True, mandatory=False, position=5, argstr="-flip %s") - in_type = traits.Str(desc='', exists=True, mandatory=False, position=6, argstr="-type %s") - in_interp = traits.Str(desc='0 trilin, 1 NN', exists=True, mandatory=False, position=7, argstr="-interp %s") - - -class diffeoScalarVolOutputSpec(TraitedSpec): - out_file = traits.File(desc='moved volume', exists=True) - - -class diffeoScalarVolTask(CommandLineDtitk): - input_spec = diffeoScalarVolInputSpec - output_spec = diffeoScalarVolOutputSpec - _cmd = 'deformationScalarVolume' - - def _list_outputs(self): - outputs = self.output_spec().get() - if not isdefined(self.inputs.out_path): - self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_diffeoxfmd",newpath=os.path.abspath(".")) - outputs['out_file'] = os.path.abspath(self.inputs.out_path) - return outputs - -''' -#TODO not using these yet... need to be tested - class SVAdjustVoxSpInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - in_target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, \ - argstr="-target %s") - in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, \ - argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=1, \ - argstr="-out %s", name_source="in_volume", name_template='%s_origmvd.nii.gz') - origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') + in_volume = traits.Str(desc="image to resample", exists=True, + mandatory=True, position=0, argstr="-in %s") + in_target = traits.Str(desc='target volume', exists=True, mandatory=False, + position=2, argstr="-target %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, + mandatory=False, position=3, argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, + position=1, argstr="-out %s", name_source="in_volume", + name_template='%s_origmvd.nii.gz') + origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, + position=4, argstr='-origin %s') class SVAdjustVoxSpOutputSpec(TraitedSpec): @@ -340,27 +129,50 @@ class SVAdjustVoxSpOutputSpec(TraitedSpec): class SVAdjustVoxSpTask(CommandLineDtitk): + """ + Adjusts the voxel space of a scalar volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.SVAdjustVoxSpTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ input_spec = SVAdjustVoxSpInputSpec output_spec = SVAdjustVoxSpOutputSpec _cmd = 'SVAdjustVoxelspace' + _suffix = '_reslice' def _list_outputs(self): outputs = self.output_spec().get() - if not isdefined(self.inputs.out_path): - self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_origmvd", newpath=os.path.abspath(".")) - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.' + '.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs -''' -''' + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + + class TVResampleInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ - argstr="-size %s") - in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, \ - argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, \ - argstr="-out %s", name_source="in_volume", name_template="%s_resampled.nii.gz" ) + in_tensor = traits.Str(desc="image to resample", exists=True, + mandatory=True, position=0, argstr="-in %s") + in_arraysz = traits.Str(desc='resampled array size', exists=True, + mandatory=False, position=1, argstr="-size %s") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, + mandatory=False, position=2, argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, + position=3, argstr="-out %s", name_source="in_volume", + name_template="%s_resampled.nii.gz" ) class TVResampleOutputSpec(TraitedSpec): @@ -368,24 +180,51 @@ class TVResampleOutputSpec(TraitedSpec): class TVResampleTask(CommandLineDtitk): + """ + Resamples a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.TVResampleTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ input_spec = TVResampleInputSpec output_spec = TVResampleOutputSpec _cmd = 'TVResample' + _suffix = '_resampled' def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.' + '.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + class SVResampleInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") - in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ + in_volume = traits.Str(desc="image to resample", exists=True, + mandatory=True, position=0, argstr="-in %s") + in_arraysz = traits.Str(desc='resampled array size', exists=True, + mandatory=False, position=1, \ argstr="-size %s") - in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, \ - argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, \ - argstr="-out %s", name_source="in_volume", name_template="%s_resampled.nii.gz") + in_voxsz = traits.Str(desc='resampled voxel size', exists=True, + mandatory=False, position=2, argstr="-vsize %s") + out_path = traits.Str(desc='output path', exists=True, mandatory=False, + position=3, argstr="-out %s", name_source="in_volume", + name_template="%s_resampled.nii.gz") class SVResampleOutputSpec(TraitedSpec): @@ -393,21 +232,45 @@ class SVResampleOutputSpec(TraitedSpec): class SVResampleTask(CommandLineDtitk): + """ + Resamples a scalar volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.SVResampleTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.run() + """ input_spec = SVResampleInputSpec output_spec = SVResampleOutputSpec _cmd = 'SVResample' + _suffix = '_resampled' def _list_outputs(self): outputs = self.output_spec().get() - if not isdefined(self.inputs.out_path): - self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_resampled",newpath=os.path.abspath(".")) - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.' + '.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + + class TVtoolInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc="image to resample", exists=True, mandatory=False, position=0, argstr="-in %s") - in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, mandatory=False, position=1, \ - argstr="-%s", desc='') + in_tensor = traits.Str(desc="image to resample", exists=True, + mandatory=False, position=0, argstr="-in %s") + in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, + mandatory=False, position=1, argstr="-%s", desc='') class TVtoolOutputSpec(TraitedSpec): @@ -415,20 +278,49 @@ class TVtoolOutputSpec(TraitedSpec): class TVtoolTask(CommandLineDtitk): + """ + Calculates a tensor metric volume from a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.TVtoolTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.inputs.in_flag = 'fa' + >>> node.run() + """ input_spec = TVtoolInputSpec output_spec = TVtoolOutputSpec _cmd = 'TVtool' def _list_outputs(self): + _suffix = self.inputs.in_flag outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.in_tensor.replace('.nii.gz', '_'+self.inputs.in_flag+'.nii.gz') + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=_suffix, + ext='.' + '.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + class BinThreshInputSpec(CommandLineInputSpec): - in_image = traits.Str(desc='', exists=True, mandatory=False, position=0, argstr="%s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") - in_numbers = traits.Str(desc='LB UB inside_value outside_value', exists=True, mandatory=False, position=2, argstr="%s") + in_image = traits.Str(desc='', exists=True, mandatory=False, position=0, + argstr="%s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, + argstr="%s") + in_numbers = traits.Str(desc='LB UB inside_value outside_value', + exists=True, mandatory=False, position=2, + argstr="%s") class BinThreshOutputSpec(TraitedSpec): @@ -436,26 +328,37 @@ class BinThreshOutputSpec(TraitedSpec): class BinThreshTask(CommandLineDtitk): + """ + Binarizes an image based on parameters + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.BinThreshTask() + >>> node.inputs.in_file = 'diffusion.nii' + >>> node.inputs.in_numbers = '0 100 1 0' + >>> node.run() + """ + input_spec = BinThreshInputSpec output_spec = BinThreshOutputSpec - _cmd='BinaryThresholdImageFilter' + _cmd = 'BinaryThresholdImageFilter' + _suffix = '_bin' def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.out_path + outputs['out_file'] = self.inputs.out_file + if not isdefined(self.inputs.out_file): + outputs["out_file"] = self._gen_fname(self.inputs.in_file, + suffix=self._suffix, + ext='.'+'.'.join( + self.inputs.in_file.split( + ".")[1:])) + outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs -''' -''' def _gen_filename(self, name): - print "diffeo worked" - out_file = self.inputs.out_file - if not isdefined(out_file) and isdefined(self.inputs.in_volume): - out_file = self._gen_filename(self.inputs.in_file, suffix='_diffeoxfmd') - return os.path.abspath(out_file) - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.out_path - return outputs -''' + if name == "out_file": + return self._list_outputs()["out_file"] + return None From f1dc18b57e68b52d8b5d88972cab3a7ce527f860 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 19 May 2017 17:12:53 -0700 Subject: [PATCH 007/365] changed relative imports to absolute, fixed docstring tests --- nipype/interfaces/dtitk/registration.py | 348 ++++++++++++++++++++++++ 1 file changed, 348 insertions(+) create mode 100644 nipype/interfaces/dtitk/registration.py diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py new file mode 100644 index 0000000000..08382a4e25 --- /dev/null +++ b/nipype/interfaces/dtitk/registration.py @@ -0,0 +1,348 @@ +from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, \ + traits, isdefined +from nipype.utils.filemanip import fname_presuffix +import os +from base import CommandLineDtitk + + +class RigidInputSpec(CommandLineInputSpec): + fixed_file = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=True, + position=0, argstr="%s") + moving_file = traits.Str(desc="diffusion tensor image path", exists=True, + mandatory=True, position=1, argstr="%s") + similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, + mandatory=True, position=2, argstr="%s", + desc="similarity metric") + + +class RigidOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class RigidTask(CommandLineDtitk): + """ + Performs rigid registration between two tensor volumes + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.RigidTask() + >>> node.inputs.fixed_file = 'diffusion.nii' + >>> node.inputs.moving_file = 'diffusion.nii' + >>> node.inputs.similarity_metric = 'EDS' + >>> node.run() + """ + input_spec = RigidInputSpec + output_spec = RigidOutputSpec + _cmd = 'dti_rigid_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz', '.aff') + outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', + '_aff.nii.gz') + return outputs + + +class AffineInputSpec(CommandLineInputSpec): + in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=False, position=0, + argstr="%s") + in_moving_txt = traits.Str( + desc="moving list of diffusion tensor image paths", exists=True, + mandatory=False, position=1, argstr="%s") + in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, + mandatory=False, position=3, argstr="%s", + desc = "similarity metric") + in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, + mandatory=False, position=4, argstr="%s", + desc="initialize using rigid transform??") + + +class AffineOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class AffineTask(CommandLineDtitk): + """ + Performs affine registration between two tensor volumes + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.AffineTask() + >>> node.inputs.in_fixed_tensor = 'diffusion.nii' + >>> node.inputs.in_moving_txt = 'dirs.txt' + >>> node.inputs.in_similarity_metric = 'EDS' + >>> node.run() + """ + + input_spec = AffineInputSpec + output_spec = AffineOutputSpec + _cmd = 'dti_affine_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz', + '.aff') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', + '_aff.nii.gz') + return outputs + + +class DiffeoInputSpec(CommandLineInputSpec): + in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=False, position=0, + argstr="%s") + in_moving_txt = traits.Str(desc="moving list of diffusion tensor image " + "paths", exists=True, mandatory=False, + position=1, argstr="%s") + in_mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, + argstr="%s") + in_numbers = traits.Str(desc='#iters ftol', exists=True, mandatory=False, + position=3, argstr="%s") + + +class DiffeoOutputSpec(TraitedSpec): + out_file = traits.File(exists=True) + out_file_xfm = traits.File(exists=True) + + +class DiffeoTask(CommandLineDtitk): + """ + Performs diffeomorphic registration between two tensor volumes + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.DiffeoTask() + >>> node.inputs.in_fixed_tensor = 'diffusion.nii' + >>> node.inputs.in_moving_txt = 'dirs.txt' + >>> node.inputs.in_mask = 'mask.nii' + >>> node.inputs.in_numbers = '6 0.002' + >>> node.run() + """ + input_spec = DiffeoInputSpec + output_spec = DiffeoOutputSpec + _cmd = 'dti_diffeomorphic_sn' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( + '.nii.gz','_aff_diffeo.df.nii.gz') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace( + '.nii.gz', '_aff_diffeo.nii.gz') + return outputs + + +class ComposeXfmInputSpec(CommandLineInputSpec): + in_df = traits.Str(desc='diffeomorphic file.df.nii.gz', exists=True, + mandatory=False, position=1, argstr="-df %s") + in_aff = traits.Str(desc='affine file.aff', exists=True, mandatory=False, + position=0, argstr="-aff %s") + out_path = traits.Str(desc='output_path', exists=True, mandatory=False, + position=2, argstr="-out %s", name_source="in_df", + name_template="%s_comboaff.nii.gz") + + +class ComposeXfmOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class ComposeXfmTask(CommandLineDtitk): + """ + Combines diffeomorphic and affine transforms + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.ComposeXfmTask() + >>> node.inputs.in_df = 'ants_Warp.nii.gz' + >>> node.inputs.in_aff= 'ants_Affine.txt' + >>> node.run() + """ + input_spec = ComposeXfmInputSpec + output_spec = ComposeXfmOutputSpec + _cmd = 'dfRightComposeAffine' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.in_df.replace('.df.nii.gz', + '_combo.df.nii.gz') + return outputs + + +class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, + position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + position=1, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, + argstr="-target %s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, + argstr="-out %s", name_source="in_tensor", + name_template="%s_diffeoxfmd.nii.gz") + + +class diffeoSymTensor3DVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class diffeoSymTensor3DVolTask(CommandLineDtitk): + """ + Applies diffeomorphic transform to a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.diffeoSymTensor3DVolTask() + >>> node.inputs.in_tensor = 'diffusion.nii' + >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' + >>> node.run() + """ + + input_spec = diffeoSymTensor3DVolInputSpec + output_spec = diffeoSymTensor3DVolOutputSpec + _cmd = 'deformationSymTensor3DVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = self.inputs.out_path + return outputs + + +class affSymTensor3DVolInputSpec(CommandLineInputSpec): + in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, + position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + position=1, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, + argstr="-target %s") + out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, + argstr="-out %s", name_source="in_tensor", + name_template="%s_affxfmd.nii.gz") + + +class affSymTensor3DVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='cheese', exists=True) + + +class affSymTensor3DVolTask(CommandLineDtitk): + """ + Applies affine transform to a tensor volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.affSymTensor3DVolTask() + >>> node.inputs.in_tensor = 'diffusion.nii' + >>> node.inputs.in_xfm = 'ants_Affine.txt' + >>> node.run() + """ + input_spec = affSymTensor3DVolInputSpec + output_spec = affSymTensor3DVolOutputSpec + _cmd = 'affineSymTensor3DVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class affScalarVolInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, + position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + position=1, argstr="-trans %s") + in_target = traits.Str(desc='', position=2, argstr="-target %s") + out_path = traits.Str(desc='', mandatory=False, position=3, + argstr="-out %s", name_source="in_volume", + name_template="%s_affxfmd.nii.gz") + + +class affScalarVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='moved volume', exists=True) + + +class affScalarVolTask(CommandLineDtitk): + """ + Applies affine transform to a scalar volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.affScalarVolTask() + >>> node.inputs.in_volume = 'fa.nii.gz' + >>> node.inputs.in_xfm = 'ants_Affine.txt' + >>> node.run() + """ + input_spec = affScalarVolInputSpec + output_spec = affScalarVolOutputSpec + _cmd = 'affineScalarVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs + + +class diffeoScalarVolInputSpec(CommandLineInputSpec): + in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, + position=0, argstr="-in %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + position=2, argstr="-trans %s") + in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, + argstr="-target %s") + out_path = traits.Str(desc='', position=1, argstr="-out %s", + name_source="in_volume", + name_template="%s_diffeoxfmd.nii.gz") + in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, + argstr="-vsize %s") + in_flip = traits.Str(desc='', exists=True, mandatory=False, position=5, + argstr="-flip %s") + in_type = traits.Str(desc='', exists=True, mandatory=False, position=6, + argstr="-type %s") + in_interp = traits.Str(desc='0 trilin, 1 NN', exists=True, mandatory=False, + position=7, argstr="-interp %s") + + +class diffeoScalarVolOutputSpec(TraitedSpec): + out_file = traits.File(desc='moved volume', exists=True) + + +class diffeoScalarVolTask(CommandLineDtitk): + """ + Applies diffeomorphic transform to a scalar volume + + Example + ------- + + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.diffeoScalarVolTask() + >>> node.inputs.in_tensor = 'fa.nii.gz' + >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' + >>> node.run() + """ + + input_spec = diffeoScalarVolInputSpec + output_spec = diffeoScalarVolOutputSpec + _cmd = 'deformationScalarVolume' + + def _list_outputs(self): + outputs = self.output_spec().get() + if not isdefined(self.inputs.out_path): + self.inputs.out_path = fname_presuffix(self.inputs.in_volume, + suffix="_diffeoxfmd", + newpath=os.path.abspath(".")) + outputs['out_file'] = os.path.abspath(self.inputs.out_path) + return outputs From 410a825958222e7522bf526760b3d859952b5b05 Mon Sep 17 00:00:00 2001 From: Joke Durnez Date: Sat, 3 Jun 2017 18:00:46 -0700 Subject: [PATCH 008/365] Update model.py The base name tbss in randomise is very confusing, so I changed it to randomise (and removed the _, as FSL adds it too). Also, the cluster thresholds with 2 digits are not read. Not sure about the other thresholds, so I didn't touch those. --- nipype/interfaces/fsl/model.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nipype/interfaces/fsl/model.py b/nipype/interfaces/fsl/model.py index f45f6d62fb..d1a03a0879 100644 --- a/nipype/interfaces/fsl/model.py +++ b/nipype/interfaces/fsl/model.py @@ -1819,7 +1819,7 @@ class RandomiseInputSpec(FSLCommandInputSpec): in_file = File(exists=True, desc='4D input file', argstr='-i %s', position=0, mandatory=True) base_name = traits.Str( - 'tbss_', desc='the rootname that all generated files will have', + 'randomise', desc='the rootname that all generated files will have', argstr='-o "%s"', position=1, usedefault=True) design_mat = File( exists=True, desc='design matrix file', argstr='-d %s', position=2) @@ -1866,9 +1866,9 @@ class RandomiseInputSpec(FSLCommandInputSpec): var_smooth = traits.Int( argstr='-v %d', desc='use variance smoothing (std is in mm)') c_thresh = traits.Float( - argstr='-c %.2f', desc='carry out cluster-based thresholding') + argstr='-c %.1f', desc='carry out cluster-based thresholding') cm_thresh = traits.Float( - argstr='-C %.2f', desc='carry out cluster-mass-based thresholding') + argstr='-C %.1f', desc='carry out cluster-mass-based thresholding') f_c_thresh = traits.Float( argstr='-F %.2f', desc='carry out f cluster thresholding') f_cm_thresh = traits.Float( @@ -1912,7 +1912,7 @@ class Randomise(FSLCommand): >>> import nipype.interfaces.fsl as fsl >>> rand = fsl.Randomise(in_file='allFA.nii', mask = 'mask.nii', tcon='design.con', design_mat='design.mat') >>> rand.cmdline # doctest: +ALLOW_UNICODE - 'randomise -i allFA.nii -o "tbss_" -d design.mat -t design.con -m mask.nii' + 'randomise -i allFA.nii -o "randomise" -d design.mat -t design.con -m mask.nii' """ From c7122ac8eee27fd63379d186c34c35d2e36a27d9 Mon Sep 17 00:00:00 2001 From: Kesshi Jordan Date: Thu, 7 Sep 2017 13:58:59 -0700 Subject: [PATCH 009/365] added init --- nipype/interfaces/dtitk/__init__.py | 12 ++++++++++++ nipype/interfaces/dtitk/registration.py | 6 +++--- nipype/interfaces/dtitk/utils.py | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 nipype/interfaces/dtitk/__init__.py diff --git a/nipype/interfaces/dtitk/__init__.py b/nipype/interfaces/dtitk/__init__.py new file mode 100644 index 0000000000..1e033a36ea --- /dev/null +++ b/nipype/interfaces/dtitk/__init__.py @@ -0,0 +1,12 @@ +"""The dtitk module provides classes for interfacing with the `Diffusion +Tensor Imaging Toolkit (DTI-TK) +`_ command line tools. + +Top-level namespace for dti-tk. +""" + +#from .base import () +from .registration import (RigidTask, AffineTask, DiffeoTask, ComposeXfmTask, +diffeoSymTensor3DVolTask, affSymTensor3DVolTask, affScalarVolTask, diffeoScalarVolTask) +from .utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, SVAdjustVoxSpTask, +TVResampleTask, SVResampleTask, TVtoolTask, BinThreshTask) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 08382a4e25..8b54dcfc5e 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -1,8 +1,8 @@ -from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, \ +from ..base import TraitedSpec, CommandLineInputSpec, \ traits, isdefined -from nipype.utils.filemanip import fname_presuffix +from ...utils.filemanip import fname_presuffix import os -from base import CommandLineDtitk +from .base import CommandLineDtitk class RigidInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index e7dfa2272f..291007679f 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -1,6 +1,6 @@ __author__ = 'kjordan' -from nipype.interfaces.base import TraitedSpec, CommandLineInputSpec, File, \ +from ..base import TraitedSpec, CommandLineInputSpec, File, \ traits, isdefined, split_filename import os from .base import CommandLineDtitk From 7b8b5db835a8db00543100a6c6525e6c9686fb21 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 15 Sep 2017 09:17:29 -0700 Subject: [PATCH 010/365] changed input variable names --- nipype/interfaces/dtitk/__init__.py | 4 ++-- nipype/interfaces/dtitk/utils.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nipype/interfaces/dtitk/__init__.py b/nipype/interfaces/dtitk/__init__.py index 1e033a36ea..3f50f17d2d 100644 --- a/nipype/interfaces/dtitk/__init__.py +++ b/nipype/interfaces/dtitk/__init__.py @@ -6,7 +6,7 @@ """ #from .base import () -from .registration import (RigidTask, AffineTask, DiffeoTask, ComposeXfmTask, +from ..dtitk.registration import (RigidTask, AffineTask, DiffeoTask, ComposeXfmTask, diffeoSymTensor3DVolTask, affSymTensor3DVolTask, affScalarVolTask, diffeoScalarVolTask) -from .utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, SVAdjustVoxSpTask, +from ..dtitk.utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, SVAdjustVoxSpTask, TVResampleTask, SVResampleTask, TVtoolTask, BinThreshTask) diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 291007679f..754ea26d98 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -111,7 +111,7 @@ def _gen_filename(self, name): class SVAdjustVoxSpInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc="image to resample", exists=True, + in_file = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") in_target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, argstr="-target %s") @@ -164,7 +164,7 @@ def _gen_filename(self, name): class TVResampleInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc="image to resample", exists=True, + in_file = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, argstr="-size %s") @@ -215,7 +215,7 @@ def _gen_filename(self, name): class SVResampleInputSpec(CommandLineInputSpec): - in_volume = traits.Str(desc="image to resample", exists=True, + in_file = traits.Str(desc="image to resample", exists=True, mandatory=True, position=0, argstr="-in %s") in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, \ @@ -267,7 +267,7 @@ def _gen_filename(self, name): class TVtoolInputSpec(CommandLineInputSpec): - in_tensor = traits.Str(desc="image to resample", exists=True, + in_file = traits.Str(desc="image to resample", exists=True, mandatory=False, position=0, argstr="-in %s") in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, mandatory=False, position=1, argstr="-%s", desc='') @@ -314,7 +314,7 @@ def _gen_filename(self, name): class BinThreshInputSpec(CommandLineInputSpec): - in_image = traits.Str(desc='', exists=True, mandatory=False, position=0, + in_file = traits.Str(desc='', exists=True, mandatory=False, position=0, argstr="%s") out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") From 1127b4d7fba6197b1a3c2a1819492730e1e3af71 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 15 Sep 2017 10:27:43 -0700 Subject: [PATCH 011/365] added # doctest: +SKIP --- nipype/interfaces/afni/preprocess.py | 24 +++---- .../afni/tests/test_auto_TCatSubBrick.py | 44 ++++++++++++ nipype/interfaces/dtitk/__init__.py | 13 ++-- nipype/interfaces/dtitk/registration.py | 16 ++--- .../dtitk/tests/test_auto_AffineTask.py | 53 ++++++++++++++ .../dtitk/tests/test_auto_BinThreshTask.py | 47 ++++++++++++ .../dtitk/tests/test_auto_CommandLineDtitk.py | 23 ++++++ .../dtitk/tests/test_auto_ComposeXfmTask.py | 49 +++++++++++++ .../dtitk/tests/test_auto_DiffeoTask.py | 53 ++++++++++++++ .../dtitk/tests/test_auto_RigidTask.py | 48 +++++++++++++ .../tests/test_auto_SVAdjustVoxSpTask.py | 59 +++++++++++++++ .../dtitk/tests/test_auto_SVResampleTask.py | 54 ++++++++++++++ .../tests/test_auto_TVAdjustOriginTask.py | 46 ++++++++++++ .../tests/test_auto_TVAdjustVoxSpTask.py | 56 +++++++++++++++ .../dtitk/tests/test_auto_TVResampleTask.py | 54 ++++++++++++++ .../dtitk/tests/test_auto_TVtoolTask.py | 42 +++++++++++ .../dtitk/tests/test_auto_affScalarVolTask.py | 51 +++++++++++++ .../tests/test_auto_affSymTensor3DVolTask.py | 54 ++++++++++++++ .../tests/test_auto_diffeoScalarVolTask.py | 72 +++++++++++++++++++ .../test_auto_diffeoSymTensor3DVolTask.py | 54 ++++++++++++++ nipype/interfaces/dtitk/utils.py | 21 +++--- 21 files changed, 898 insertions(+), 35 deletions(-) create mode 100644 nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_AffineTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_RigidTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py create mode 100644 nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index e0e2518ef1..91a68bd97b 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -119,7 +119,7 @@ class AlignEpiAnatPyOutputSpec(TraitedSpec): desc="matrix to volume register and align epi" "to anatomy and put into standard space") epi_vr_motion = File( - desc="motion parameters from EPI time-series" + desc="motion parameters from EPI time-series" "registration (tsh included in name if slice" "timing correction is also included).") skullstrip = File( @@ -131,20 +131,20 @@ class AlignEpiAnatPy(AFNIPythonCommand): an EPI and an anatomical structural dataset, and applies the resulting transformation to one or the other to bring them into alignment. - This script computes the transforms needed to align EPI and - anatomical datasets using a cost function designed for this purpose. The - script combines multiple transformations, thereby minimizing the amount of + This script computes the transforms needed to align EPI and + anatomical datasets using a cost function designed for this purpose. The + script combines multiple transformations, thereby minimizing the amount of interpolation applied to the data. - + Basic Usage: align_epi_anat.py -anat anat+orig -epi epi+orig -epi_base 5 - + The user must provide EPI and anatomical datasets and specify the EPI - sub-brick to use as a base in the alignment. + sub-brick to use as a base in the alignment. Internally, the script always aligns the anatomical to the EPI dataset, - and the resulting transformation is saved to a 1D file. - As a user option, the inverse of this transformation may be applied to the + and the resulting transformation is saved to a 1D file. + As a user option, the inverse of this transformation may be applied to the EPI dataset in order to align it to the anatomical data instead. This program generates several kinds of output in the form of datasets @@ -182,7 +182,7 @@ def _list_outputs(self): epi_prefix = ''.join(self._gen_fname(self.inputs.in_file).split('+')[:-1]) outputtype = self.inputs.outputtype if outputtype == 'AFNI': - ext = '.HEAD' + ext = '.HEAD' else: Info.output_type_to_ext(outputtype) matext = '.1D' @@ -620,7 +620,7 @@ class AutoTLRCInputSpec(CommandLineInputSpec): mandatory=True, exists=True, copyfile=False) - base = traits.Str( + base = traits.Str( desc = ' Reference anatomical volume' ' Usually this volume is in some standard space like' ' TLRC or MNI space and with afni dataset view of' @@ -706,7 +706,7 @@ def _list_outputs(self): ext = '.HEAD' outputs['out_file'] = os.path.abspath(self._gen_fname(self.inputs.in_file, suffix='+tlrc')+ext) return outputs - + class BandpassInputSpec(AFNICommandInputSpec): in_file = File( desc='input file to 3dBandpass', diff --git a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py new file mode 100644 index 0000000000..a32e594298 --- /dev/null +++ b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py @@ -0,0 +1,44 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TCatSubBrick + + +def test_TCatSubBrick_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_files=dict(argstr='%s%s ...', + copyfile=False, + mandatory=True, + position=-1, + ), + out_file=dict(argstr='-prefix %s', + genfile=True, + ), + outputtype=dict(), + rlt=dict(argstr='-rlt%s', + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = TCatSubBrick.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TCatSubBrick_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = TCatSubBrick.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/__init__.py b/nipype/interfaces/dtitk/__init__.py index 3f50f17d2d..0f6588ca5f 100644 --- a/nipype/interfaces/dtitk/__init__.py +++ b/nipype/interfaces/dtitk/__init__.py @@ -5,8 +5,11 @@ Top-level namespace for dti-tk. """ -#from .base import () -from ..dtitk.registration import (RigidTask, AffineTask, DiffeoTask, ComposeXfmTask, -diffeoSymTensor3DVolTask, affSymTensor3DVolTask, affScalarVolTask, diffeoScalarVolTask) -from ..dtitk.utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, SVAdjustVoxSpTask, -TVResampleTask, SVResampleTask, TVtoolTask, BinThreshTask) +# from .base import () +from ..dtitk.registration import (RigidTask, AffineTask, DiffeoTask, + ComposeXfmTask, diffeoSymTensor3DVolTask, + affSymTensor3DVolTask, affScalarVolTask, + diffeoScalarVolTask) +from ..dtitk.utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, + SVAdjustVoxSpTask, TVResampleTask, SVResampleTask, + TVtoolTask, BinThreshTask) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 8b54dcfc5e..8a8a0175fd 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -33,7 +33,7 @@ class RigidTask(CommandLineDtitk): >>> node.inputs.fixed_file = 'diffusion.nii' >>> node.inputs.moving_file = 'diffusion.nii' >>> node.inputs.similarity_metric = 'EDS' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = RigidInputSpec output_spec = RigidOutputSpec @@ -79,7 +79,7 @@ class AffineTask(CommandLineDtitk): >>> node.inputs.in_fixed_tensor = 'diffusion.nii' >>> node.inputs.in_moving_txt = 'dirs.txt' >>> node.inputs.in_similarity_metric = 'EDS' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = AffineInputSpec @@ -126,7 +126,7 @@ class DiffeoTask(CommandLineDtitk): >>> node.inputs.in_moving_txt = 'dirs.txt' >>> node.inputs.in_mask = 'mask.nii' >>> node.inputs.in_numbers = '6 0.002' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = DiffeoInputSpec output_spec = DiffeoOutputSpec @@ -166,7 +166,7 @@ class ComposeXfmTask(CommandLineDtitk): >>> node = dtitk.ComposeXfmTask() >>> node.inputs.in_df = 'ants_Warp.nii.gz' >>> node.inputs.in_aff= 'ants_Affine.txt' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = ComposeXfmInputSpec output_spec = ComposeXfmOutputSpec @@ -206,7 +206,7 @@ class diffeoSymTensor3DVolTask(CommandLineDtitk): >>> node = dtitk.diffeoSymTensor3DVolTask() >>> node.inputs.in_tensor = 'diffusion.nii' >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = diffeoSymTensor3DVolInputSpec @@ -246,7 +246,7 @@ class affSymTensor3DVolTask(CommandLineDtitk): >>> node = dtitk.affSymTensor3DVolTask() >>> node.inputs.in_tensor = 'diffusion.nii' >>> node.inputs.in_xfm = 'ants_Affine.txt' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = affSymTensor3DVolInputSpec output_spec = affSymTensor3DVolOutputSpec @@ -284,7 +284,7 @@ class affScalarVolTask(CommandLineDtitk): >>> node = dtitk.affScalarVolTask() >>> node.inputs.in_volume = 'fa.nii.gz' >>> node.inputs.in_xfm = 'ants_Affine.txt' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = affScalarVolInputSpec output_spec = affScalarVolOutputSpec @@ -331,7 +331,7 @@ class diffeoScalarVolTask(CommandLineDtitk): >>> node = dtitk.diffeoScalarVolTask() >>> node.inputs.in_tensor = 'fa.nii.gz' >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = diffeoScalarVolInputSpec diff --git a/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py new file mode 100644 index 0000000000..865619366a --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py @@ -0,0 +1,53 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import AffineTask + + +def test_AffineTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_fixed_tensor=dict(argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + in_moving_txt=dict(argstr='%s', + exists=True, + mandatory=False, + position=1, + ), + in_similarity_metric=dict(argstr='%s', + exists=True, + mandatory=False, + position=3, + ), + in_usetrans_flag=dict(argstr='%s', + exists=True, + mandatory=False, + position=4, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = AffineTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_AffineTask_outputs(): + output_map = dict(out_file=dict(), + out_file_xfm=dict(), + ) + outputs = AffineTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py new file mode 100644 index 0000000000..e430677193 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py @@ -0,0 +1,47 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import BinThreshTask + + +def test_BinThreshTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_image=dict(argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + in_numbers=dict(argstr='%s', + exists=True, + mandatory=False, + position=2, + ), + out_path=dict(argstr='%s', + exists=True, + mandatory=False, + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = BinThreshTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_BinThreshTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = BinThreshTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py new file mode 100644 index 0000000000..e0934c9b76 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py @@ -0,0 +1,23 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..base import CommandLineDtitk + + +def test_CommandLineDtitk_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = CommandLineDtitk.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + diff --git a/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py new file mode 100644 index 0000000000..9b98fc48e4 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py @@ -0,0 +1,49 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import ComposeXfmTask + + +def test_ComposeXfmTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_aff=dict(argstr='-aff %s', + exists=True, + mandatory=False, + position=0, + ), + in_df=dict(argstr='-df %s', + exists=True, + mandatory=False, + position=1, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_df', + name_template='%s_comboaff.nii.gz', + position=2, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = ComposeXfmTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_ComposeXfmTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = ComposeXfmTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py new file mode 100644 index 0000000000..ad3b8b7366 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py @@ -0,0 +1,53 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import DiffeoTask + + +def test_DiffeoTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_fixed_tensor=dict(argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + in_mask=dict(argstr='%s', + exists=True, + mandatory=False, + position=2, + ), + in_moving_txt=dict(argstr='%s', + exists=True, + mandatory=False, + position=1, + ), + in_numbers=dict(argstr='%s', + exists=True, + mandatory=False, + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = DiffeoTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_DiffeoTask_outputs(): + output_map = dict(out_file=dict(), + out_file_xfm=dict(), + ) + outputs = DiffeoTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py new file mode 100644 index 0000000000..e099d4c6a0 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py @@ -0,0 +1,48 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import RigidTask + + +def test_RigidTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + fixed_file=dict(argstr='%s', + exists=True, + mandatory=True, + position=0, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + moving_file=dict(argstr='%s', + exists=True, + mandatory=True, + position=1, + ), + similarity_metric=dict(argstr='%s', + exists=True, + mandatory=True, + position=2, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = RigidTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_RigidTask_outputs(): + output_map = dict(out_file=dict(), + out_file_xfm=dict(), + ) + outputs = RigidTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py new file mode 100644 index 0000000000..c4f1bdeec1 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py @@ -0,0 +1,59 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import SVAdjustVoxSpTask + + +def test_SVAdjustVoxSpTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + in_volume=dict(argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), + in_voxsz=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=3, + ), + origin=dict(argstr='-origin %s', + exists=True, + mandatory=False, + position=4, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_volume', + name_template='%s_origmvd.nii.gz', + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = SVAdjustVoxSpTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_SVAdjustVoxSpTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = SVAdjustVoxSpTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py new file mode 100644 index 0000000000..5e4af63e87 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py @@ -0,0 +1,54 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import SVResampleTask + + +def test_SVResampleTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_arraysz=dict(argstr='-size %s', + exists=True, + mandatory=False, + position=1, + ), + in_volume=dict(argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), + in_voxsz=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=2, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_volume', + name_template='%s_resampled.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = SVResampleTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_SVResampleTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = SVResampleTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py new file mode 100644 index 0000000000..55947095a9 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py @@ -0,0 +1,46 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TVAdjustOriginTask + + +def test_TVAdjustOriginTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-in %s', + mandatory=True, + position=0, + ), + origin=dict(argstr='-origin %s', + exists=True, + mandatory=False, + position=4, + ), + out_file=dict(argstr='-out %s', + genfile=True, + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = TVAdjustOriginTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TVAdjustOriginTask_outputs(): + output_map = dict(out_file=dict(exists=True, + ), + ) + outputs = TVAdjustOriginTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py new file mode 100644 index 0000000000..1512ff67a4 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py @@ -0,0 +1,56 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TVAdjustVoxSpTask + + +def test_TVAdjustVoxSpTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-in %s', + mandatory=True, + position=0, + ), + origin=dict(argstr='-origin %s', + exists=True, + mandatory=False, + position=4, + ), + out_file=dict(argstr='-out %s', + genfile=True, + position=1, + ), + target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + terminal_output=dict(nohash=True, + ), + vsize=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=3, + ), + ) + inputs = TVAdjustVoxSpTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TVAdjustVoxSpTask_outputs(): + output_map = dict(out_file=dict(exists=True, + ), + ) + outputs = TVAdjustVoxSpTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py new file mode 100644 index 0000000000..ec16b3adee --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py @@ -0,0 +1,54 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TVResampleTask + + +def test_TVResampleTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_arraysz=dict(argstr='-size %s', + exists=True, + mandatory=False, + position=1, + ), + in_tensor=dict(argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), + in_voxsz=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=2, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_volume', + name_template='%s_resampled.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = TVResampleTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TVResampleTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = TVResampleTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py new file mode 100644 index 0000000000..bba66e0279 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py @@ -0,0 +1,42 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TVtoolTask + + +def test_TVtoolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_flag=dict(argstr='-%s', + exists=True, + mandatory=False, + position=1, + ), + in_tensor=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = TVtoolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TVtoolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = TVtoolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py new file mode 100644 index 0000000000..55dc779e9a --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py @@ -0,0 +1,51 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import affScalarVolTask + + +def test_affScalarVolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_target=dict(argstr='-target %s', + position=2, + ), + in_volume=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_xfm=dict(argstr='-trans %s', + exists=True, + mandatory=False, + position=1, + ), + out_path=dict(argstr='-out %s', + mandatory=False, + name_source='in_volume', + name_template='%s_affxfmd.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = affScalarVolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_affScalarVolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = affScalarVolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py new file mode 100644 index 0000000000..c0da08cb55 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py @@ -0,0 +1,54 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import affSymTensor3DVolTask + + +def test_affSymTensor3DVolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + in_tensor=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_xfm=dict(argstr='-trans %s', + exists=True, + mandatory=False, + position=1, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_tensor', + name_template='%s_affxfmd.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = affSymTensor3DVolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_affSymTensor3DVolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = affSymTensor3DVolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py new file mode 100644 index 0000000000..c396ec6e4a --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py @@ -0,0 +1,72 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import diffeoScalarVolTask + + +def test_diffeoScalarVolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_flip=dict(argstr='-flip %s', + exists=True, + mandatory=False, + position=5, + ), + in_interp=dict(argstr='-interp %s', + exists=True, + mandatory=False, + position=7, + ), + in_target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=3, + ), + in_type=dict(argstr='-type %s', + exists=True, + mandatory=False, + position=6, + ), + in_volume=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_vsize=dict(argstr='-vsize %s', + exists=True, + mandatory=False, + position=4, + ), + in_xfm=dict(argstr='-trans %s', + exists=True, + mandatory=False, + position=2, + ), + out_path=dict(argstr='-out %s', + name_source='in_volume', + name_template='%s_diffeoxfmd.nii.gz', + position=1, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = diffeoScalarVolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_diffeoScalarVolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = diffeoScalarVolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py new file mode 100644 index 0000000000..af2069fe4f --- /dev/null +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py @@ -0,0 +1,54 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import diffeoSymTensor3DVolTask + + +def test_diffeoSymTensor3DVolTask_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_target=dict(argstr='-target %s', + exists=True, + mandatory=False, + position=2, + ), + in_tensor=dict(argstr='-in %s', + exists=True, + mandatory=False, + position=0, + ), + in_xfm=dict(argstr='-trans %s', + exists=True, + mandatory=False, + position=1, + ), + out_path=dict(argstr='-out %s', + exists=True, + mandatory=False, + name_source='in_tensor', + name_template='%s_diffeoxfmd.nii.gz', + position=3, + ), + terminal_output=dict(nohash=True, + ), + ) + inputs = diffeoSymTensor3DVolTask.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_diffeoSymTensor3DVolTask_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = diffeoSymTensor3DVolTask.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 754ea26d98..2075ac5253 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -29,7 +29,7 @@ class TVAdjustOriginTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.TVAdjustOriginTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = TVAdjustOriginInputSpec @@ -82,7 +82,7 @@ class TVAdjustVoxSpTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.TVAdjustVoxSpTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = TVAdjustVoxSpInputSpec output_spec = TVAdjustVoxSpOutputSpec @@ -138,7 +138,7 @@ class SVAdjustVoxSpTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.SVAdjustVoxSpTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = SVAdjustVoxSpInputSpec output_spec = SVAdjustVoxSpOutputSpec @@ -165,14 +165,15 @@ def _gen_filename(self, name): class TVResampleInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, - mandatory=True, position=0, argstr="-in %s") + mandatory=True, position=0, argstr="-in %s") in_arraysz = traits.Str(desc='resampled array size', exists=True, mandatory=False, position=1, argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") out_path = traits.Str(desc='output path', exists=True, mandatory=False, - position=3, argstr="-out %s", name_source="in_volume", - name_template="%s_resampled.nii.gz" ) + position=3, argstr="-out %s", + name_source="in_volume", + name_template="%s_resampled.nii.gz") class TVResampleOutputSpec(TraitedSpec): @@ -189,7 +190,7 @@ class TVResampleTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.TVResampleTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = TVResampleInputSpec output_spec = TVResampleOutputSpec @@ -241,7 +242,7 @@ class SVResampleTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.SVResampleTask() >>> node.inputs.in_file = 'diffusion.nii' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = SVResampleInputSpec output_spec = SVResampleOutputSpec @@ -288,7 +289,7 @@ class TVtoolTask(CommandLineDtitk): >>> node = dtitk.TVtoolTask() >>> node.inputs.in_file = 'diffusion.nii' >>> node.inputs.in_flag = 'fa' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = TVtoolInputSpec output_spec = TVtoolOutputSpec @@ -338,7 +339,7 @@ class BinThreshTask(CommandLineDtitk): >>> node = dtitk.BinThreshTask() >>> node.inputs.in_file = 'diffusion.nii' >>> node.inputs.in_numbers = '0 100 1 0' - >>> node.run() + >>> node.run() # doctest: +SKIP """ input_spec = BinThreshInputSpec From 54d9d1de3088ed15e1303f0910ce4154b3b0bfea Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 18 Sep 2017 17:32:26 -0700 Subject: [PATCH 012/365] added init file --- nipype/interfaces/dtitk/tests/__init__.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 nipype/interfaces/dtitk/tests/__init__.py diff --git a/nipype/interfaces/dtitk/tests/__init__.py b/nipype/interfaces/dtitk/tests/__init__.py new file mode 100644 index 0000000000..99fb243f19 --- /dev/null +++ b/nipype/interfaces/dtitk/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: From 0a4bda27fdeebffef5709b2239ba809f3026d53a Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 18 Sep 2017 22:19:31 -0700 Subject: [PATCH 013/365] fixed variable name changes --- .cache/v/cache/lastfailed | 22 ++++++++++++ nipype/interfaces/dtitk/base.py | 2 +- nipype/interfaces/dtitk/registration.py | 35 ++++++++++-------- nipype/interfaces/dtitk/utils.py | 48 +++++++++++++------------ 4 files changed, 68 insertions(+), 39 deletions(-) create mode 100644 .cache/v/cache/lastfailed diff --git a/.cache/v/cache/lastfailed b/.cache/v/cache/lastfailed new file mode 100644 index 0000000000..5fcc465fa5 --- /dev/null +++ b/.cache/v/cache/lastfailed @@ -0,0 +1,22 @@ +{ + "nipype/algorithms/tests/test_tsnr.py": true, + "nipype/interfaces/dtitk/tests/test_auto_AffineTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py": true, + "nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_RigidTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py": true, + "nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py": true, + "nipype/pipeline/plugins/tests/test_base.py": true, + "nipype/testing/tests/test_utils.py": true, + "nipype/workflows/rsfmri/fsl/tests/test_resting.py": true +} \ No newline at end of file diff --git a/nipype/interfaces/dtitk/base.py b/nipype/interfaces/dtitk/base.py index d5a10af8bf..b14ad5ed23 100644 --- a/nipype/interfaces/dtitk/base.py +++ b/nipype/interfaces/dtitk/base.py @@ -26,7 +26,7 @@ from ... import logging from ...utils.filemanip import fname_presuffix -from ..base import traits, CommandLine +from ..base import CommandLine from nipype.interfaces.fsl.base import Info LOGGER = logging.getLogger('interface') diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 8a8a0175fd..c30c5f2a8f 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -41,7 +41,8 @@ class RigidTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz', '.aff') + outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz', + '.aff') outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', '_aff.nii.gz') return outputs @@ -55,8 +56,8 @@ class AffineInputSpec(CommandLineInputSpec): desc="moving list of diffusion tensor image paths", exists=True, mandatory=False, position=1, argstr="%s") in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, - mandatory=False, position=3, argstr="%s", - desc = "similarity metric") + mandatory=False, position=3, + argstr="%s", desc="similarity metric") in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, mandatory=False, position=4, argstr="%s", desc="initialize using rigid transform??") @@ -88,10 +89,10 @@ class AffineTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace('.nii.gz', - '.aff') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace('.nii.gz', - '_aff.nii.gz') + outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( + '.nii.gz', '.aff') + outputs['out_file'] = self.inputs.in_fixed_tensor.replace( + '.nii.gz', '_aff.nii.gz') return outputs @@ -135,7 +136,7 @@ class DiffeoTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz','_aff_diffeo.df.nii.gz') + '.nii.gz', '_aff_diffeo.df.nii.gz') outputs['out_file'] = self.inputs.in_fixed_tensor.replace( '.nii.gz', '_aff_diffeo.nii.gz') return outputs @@ -182,7 +183,8 @@ def _list_outputs(self): class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + in_xfm = traits.Str(desc='transform to apply', exists=True, + mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") @@ -222,8 +224,8 @@ def _list_outputs(self): class affSymTensor3DVolInputSpec(CommandLineInputSpec): in_tensor = traits.Str(desc='moving tensor', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, - position=1, argstr="-trans %s") + in_xfm = traits.Str(desc='transform to apply', exists=True, + mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, @@ -261,7 +263,8 @@ def _list_outputs(self): class affScalarVolInputSpec(CommandLineInputSpec): in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + in_xfm = traits.Str(desc='transform to apply', exists=True, + mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', position=2, argstr="-target %s") out_path = traits.Str(desc='', mandatory=False, position=3, @@ -299,7 +302,8 @@ def _list_outputs(self): class diffeoScalarVolInputSpec(CommandLineInputSpec): in_volume = traits.Str(desc='moving volume', exists=True, mandatory=False, position=0, argstr="-in %s") - in_xfm = traits.Str(desc='transform to apply', exists=True, mandatory=False, + in_xfm = traits.Str(desc='transform to apply', exists=True, + mandatory=False, position=2, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") @@ -329,7 +333,7 @@ class diffeoScalarVolTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.diffeoScalarVolTask() - >>> node.inputs.in_tensor = 'fa.nii.gz' + >>> node.inputs.in_volume = 'fa.nii.gz' >>> node.inputs.in_xfm = 'ants_Warp.nii.gz' >>> node.run() # doctest: +SKIP """ @@ -343,6 +347,7 @@ def _list_outputs(self): if not isdefined(self.inputs.out_path): self.inputs.out_path = fname_presuffix(self.inputs.in_volume, suffix="_diffeoxfmd", - newpath=os.path.abspath(".")) + newpath=os.path.abspath( + ".")) outputs['out_file'] = os.path.abspath(self.inputs.out_path) return outputs diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 2075ac5253..31546754d8 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -1,7 +1,7 @@ __author__ = 'kjordan' from ..base import TraitedSpec, CommandLineInputSpec, File, \ - traits, isdefined, split_filename + traits, isdefined import os from .base import CommandLineDtitk @@ -44,8 +44,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -96,8 +96,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -112,13 +112,14 @@ def _gen_filename(self, name): class SVAdjustVoxSpInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, - mandatory=True, position=0, argstr="-in %s") + mandatory=True, position=0, argstr="-in %s") in_target = traits.Str(desc='target volume', exists=True, mandatory=False, position=2, argstr="-target %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, argstr="-vsize %s") out_path = traits.Str(desc='output path', exists=True, mandatory=False, - position=1, argstr="-out %s", name_source="in_volume", + position=1, argstr="-out %s", + name_source="in_file", name_template='%s_origmvd.nii.gz') origin = traits.Str(desc='xyz voxel size', exists=True, mandatory=False, position=4, argstr='-origin %s') @@ -152,8 +153,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.' + '.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + plit(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -172,7 +173,7 @@ class TVResampleInputSpec(CommandLineInputSpec): mandatory=False, position=2, argstr="-vsize %s") out_path = traits.Str(desc='output path', exists=True, mandatory=False, position=3, argstr="-out %s", - name_source="in_volume", + name_source="in_file", name_template="%s_resampled.nii.gz") @@ -204,8 +205,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.' + '.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -217,14 +218,15 @@ def _gen_filename(self, name): class SVResampleInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, - mandatory=True, position=0, argstr="-in %s") + mandatory=True, position=0, argstr="-in %s") in_arraysz = traits.Str(desc='resampled array size', exists=True, - mandatory=False, position=1, \ + mandatory=False, position=1, argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") out_path = traits.Str(desc='output path', exists=True, mandatory=False, - position=3, argstr="-out %s", name_source="in_volume", + position=3, argstr="-out %s", + name_source="in_file", name_template="%s_resampled.nii.gz") @@ -256,8 +258,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.' + '.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -269,7 +271,7 @@ def _gen_filename(self, name): class TVtoolInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, - mandatory=False, position=0, argstr="-in %s") + mandatory=False, position=0, argstr="-in %s") in_flag = traits.Enum('fa', 'tr', 'ad', 'rd', 'pd', 'rgb', exists=True, mandatory=False, position=1, argstr="-%s", desc='') @@ -303,8 +305,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=_suffix, ext='.' + '.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs @@ -316,7 +318,7 @@ def _gen_filename(self, name): class BinThreshInputSpec(CommandLineInputSpec): in_file = traits.Str(desc='', exists=True, mandatory=False, position=0, - argstr="%s") + argstr="%s") out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") in_numbers = traits.Str(desc='LB UB inside_value outside_value', @@ -354,8 +356,8 @@ def _list_outputs(self): outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix, ext='.'+'.'.join( - self.inputs.in_file.split( - ".")[1:])) + self.inputs.in_file. + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs From b37f65f35dfb461473dbc6bafc141686f7c58c19 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Tue, 19 Sep 2017 08:56:45 -0700 Subject: [PATCH 014/365] added auto-generated tests --- .../dtitk/tests/test_auto_BinThreshTask.py | 2 +- .../dtitk/tests/test_auto_SVAdjustVoxSpTask.py | 12 ++++++------ .../dtitk/tests/test_auto_SVResampleTask.py | 4 ++-- .../dtitk/tests/test_auto_TVResampleTask.py | 4 ++-- .../interfaces/dtitk/tests/test_auto_TVtoolTask.py | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py index e430677193..b294953b4d 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py @@ -12,7 +12,7 @@ def test_BinThreshTask_inputs(): ignore_exception=dict(nohash=True, usedefault=True, ), - in_image=dict(argstr='%s', + in_file=dict(argstr='%s', exists=True, mandatory=False, position=0, diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py index c4f1bdeec1..48464fdc0b 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py @@ -12,16 +12,16 @@ def test_SVAdjustVoxSpTask_inputs(): ignore_exception=dict(nohash=True, usedefault=True, ), + in_file=dict(argstr='-in %s', + exists=True, + mandatory=True, + position=0, + ), in_target=dict(argstr='-target %s', exists=True, mandatory=False, position=2, ), - in_volume=dict(argstr='-in %s', - exists=True, - mandatory=True, - position=0, - ), in_voxsz=dict(argstr='-vsize %s', exists=True, mandatory=False, @@ -35,7 +35,7 @@ def test_SVAdjustVoxSpTask_inputs(): out_path=dict(argstr='-out %s', exists=True, mandatory=False, - name_source='in_volume', + name_source='in_file', name_template='%s_origmvd.nii.gz', position=1, ), diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py index 5e4af63e87..28dd918e79 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py @@ -17,7 +17,7 @@ def test_SVResampleTask_inputs(): mandatory=False, position=1, ), - in_volume=dict(argstr='-in %s', + in_file=dict(argstr='-in %s', exists=True, mandatory=True, position=0, @@ -30,7 +30,7 @@ def test_SVResampleTask_inputs(): out_path=dict(argstr='-out %s', exists=True, mandatory=False, - name_source='in_volume', + name_source='in_file', name_template='%s_resampled.nii.gz', position=3, ), diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py index ec16b3adee..a591a20634 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py @@ -17,7 +17,7 @@ def test_TVResampleTask_inputs(): mandatory=False, position=1, ), - in_tensor=dict(argstr='-in %s', + in_file=dict(argstr='-in %s', exists=True, mandatory=True, position=0, @@ -30,7 +30,7 @@ def test_TVResampleTask_inputs(): out_path=dict(argstr='-out %s', exists=True, mandatory=False, - name_source='in_volume', + name_source='in_file', name_template='%s_resampled.nii.gz', position=3, ), diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py index bba66e0279..8452af91ff 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py @@ -12,15 +12,15 @@ def test_TVtoolTask_inputs(): ignore_exception=dict(nohash=True, usedefault=True, ), - in_flag=dict(argstr='-%s', + in_file=dict(argstr='-in %s', exists=True, mandatory=False, - position=1, + position=0, ), - in_tensor=dict(argstr='-in %s', + in_flag=dict(argstr='-%s', exists=True, mandatory=False, - position=0, + position=1, ), terminal_output=dict(nohash=True, ), From 3182baafefec643ac1f80ee9a02b70e2fef070a1 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Tue, 3 Oct 2017 10:37:55 -0700 Subject: [PATCH 015/365] removed .cache from git --- .cache/v/cache/lastfailed | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .cache/v/cache/lastfailed diff --git a/.cache/v/cache/lastfailed b/.cache/v/cache/lastfailed deleted file mode 100644 index 5fcc465fa5..0000000000 --- a/.cache/v/cache/lastfailed +++ /dev/null @@ -1,22 +0,0 @@ -{ - "nipype/algorithms/tests/test_tsnr.py": true, - "nipype/interfaces/dtitk/tests/test_auto_AffineTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py": true, - "nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_RigidTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py": true, - "nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py": true, - "nipype/pipeline/plugins/tests/test_base.py": true, - "nipype/testing/tests/test_utils.py": true, - "nipype/workflows/rsfmri/fsl/tests/test_resting.py": true -} \ No newline at end of file From 8812dc777eea64dcdcbc786ca3fb25fae4c3e63b Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 13 Oct 2017 14:18:17 -0700 Subject: [PATCH 016/365] fixed some changes from mgxd code review, but circle failing so testing that --- nipype/interfaces/dtitk/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nipype/interfaces/dtitk/__init__.py b/nipype/interfaces/dtitk/__init__.py index 0f6588ca5f..e3f3cb7aab 100644 --- a/nipype/interfaces/dtitk/__init__.py +++ b/nipype/interfaces/dtitk/__init__.py @@ -6,10 +6,10 @@ """ # from .base import () -from ..dtitk.registration import (RigidTask, AffineTask, DiffeoTask, - ComposeXfmTask, diffeoSymTensor3DVolTask, - affSymTensor3DVolTask, affScalarVolTask, - diffeoScalarVolTask) -from ..dtitk.utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, - SVAdjustVoxSpTask, TVResampleTask, SVResampleTask, - TVtoolTask, BinThreshTask) +from .registration import (RigidTask, AffineTask, DiffeoTask, + ComposeXfmTask, diffeoSymTensor3DVolTask, + affSymTensor3DVolTask, affScalarVolTask, + diffeoScalarVolTask) +from .utils import (TVAdjustOriginTask, TVAdjustVoxSpTask, + SVAdjustVoxSpTask, TVResampleTask, SVResampleTask, + TVtoolTask, BinThreshTask) From 6a393ca5b0529bd904ef3f17009a1ee085103286 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 30 Oct 2017 12:00:52 -0700 Subject: [PATCH 017/365] testing file naming --- nipype/interfaces/dtitk/registration.py | 13 +++++++++++-- nipype/interfaces/dtitk/utils.py | 16 ++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index c30c5f2a8f..c07fc67410 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -39,14 +39,23 @@ class RigidTask(CommandLineDtitk): output_spec = RigidOutputSpec _cmd = 'dti_rigid_sn' + def _gen_outfilename(self): + out_file = self.inputs.out_file + if not isdefined(out_file) and isdefined(self.inputs.in_file): + out_file = self._gen_fname(self.inputs.in_file, + suffix='.aff', change_ext=False) + def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_file.replace('.nii.gz', - '.aff') + outputs['out_file_xfm'] = self._gen_outfilename() outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', '_aff.nii.gz') return outputs + def _gen_fname(self, name): + if name == 'out_file': + return self._gen_outfilename() + class AffineInputSpec(CommandLineInputSpec): in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 31546754d8..9e036597e7 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -117,7 +117,7 @@ class SVAdjustVoxSpInputSpec(CommandLineInputSpec): position=2, argstr="-target %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=3, argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, + out_file = traits.Str(desc='output path', exists=True, mandatory=False, position=1, argstr="-out %s", name_source="in_file", name_template='%s_origmvd.nii.gz') @@ -146,23 +146,23 @@ class SVAdjustVoxSpTask(CommandLineDtitk): _cmd = 'SVAdjustVoxelspace' _suffix = '_reslice' + def _gen_filename(self, name): + if name == "out_file": + return self._list_outputs()["out_file"] + return None + def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file'] = self.inputs.out_file if not isdefined(self.inputs.out_file): - outputs["out_file"] = self._gen_fname(self.inputs.in_file, + outputs["out_file"] = self._gen_filename(self.inputs.in_file, suffix=self._suffix, ext='.' + '.'.join( self.inputs.in_file. - plit(".")[1:])) + split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) return outputs - def _gen_filename(self, name): - if name == "out_file": - return self._list_outputs()["out_file"] - return None - class TVResampleInputSpec(CommandLineInputSpec): in_file = traits.Str(desc="image to resample", exists=True, From d240443905bd6d53bafbca6e082b76d975368d94 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 30 Oct 2017 13:44:53 -0700 Subject: [PATCH 018/365] Rigid registration node tested and works --- nipype/interfaces/dtitk/registration.py | 37 +++++++++++++++++++------ 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index c07fc67410..a1ebf1c902 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -14,6 +14,20 @@ class RigidInputSpec(CommandLineInputSpec): similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, mandatory=True, position=2, argstr="%s", desc="similarity metric") + samplingX = traits.Float(mandatory=True, position=3, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + samplingY = traits.Float(mandatory=True, position=4, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + samplingZ = traits.Float(mandatory=True, position=5, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + ftol = traits.Float(mandatory=True, position=6, argstr="%s", + desc="cost function tolerance", default_value=0.01) + useInTrans = traits.Float(mandatory=False, position=7, argstr="%s", + desc="to initialize with existing xfm set as 1", + default_value=1) class RigidOutputSpec(TraitedSpec): @@ -33,23 +47,30 @@ class RigidTask(CommandLineDtitk): >>> node.inputs.fixed_file = 'diffusion.nii' >>> node.inputs.moving_file = 'diffusion.nii' >>> node.inputs.similarity_metric = 'EDS' + >>> node.inputs.samplingX = 4 + >>> node.inputs.samplingY = 4 + >>> node.inputs.samplingZ = 4 + >>> node.inputs.ftol = 0.01 + >>> node.inputs.useInTrans = 1 >>> node.run() # doctest: +SKIP """ input_spec = RigidInputSpec output_spec = RigidOutputSpec - _cmd = 'dti_rigid_sn' + _cmd = 'dti_rigid_reg' def _gen_outfilename(self): - out_file = self.inputs.out_file - if not isdefined(out_file) and isdefined(self.inputs.in_file): - out_file = self._gen_fname(self.inputs.in_file, - suffix='.aff', change_ext=False) + # out_file = self.inputs.out_file + # if not isdefined(out_file) and isdefined(self.inputs.in_file): + out_file = self._gen_fname(self.inputs.in_file, + suffix='.aff', change_ext=False) + return out_file def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self._gen_outfilename() - outputs['out_file'] = self.inputs.in_file.replace('.nii.gz', - '_aff.nii.gz') + outputs['out_file_xfm'] = self.inputs.moving_file.replace('.nii.gz', + '.aff') + outputs['out_file'] = self.inputs.moving_file.replace('.nii.gz', + '_aff.nii.gz') return outputs def _gen_fname(self, name): From 0807cdbc623b13880e73c79eaa8cf06b14406c7e Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 30 Oct 2017 15:45:44 -0700 Subject: [PATCH 019/365] tested affine --- nipype/interfaces/dtitk/registration.py | 88 +++++++++++++------------ 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index a1ebf1c902..7c8608cf0a 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -1,5 +1,4 @@ -from ..base import TraitedSpec, CommandLineInputSpec, \ - traits, isdefined +from ..base import TraitedSpec, CommandLineInputSpec, traits, isdefined from ...utils.filemanip import fname_presuffix import os from .base import CommandLineDtitk @@ -44,8 +43,8 @@ class RigidTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.RigidTask() - >>> node.inputs.fixed_file = 'diffusion.nii' - >>> node.inputs.moving_file = 'diffusion.nii' + >>> node.inputs.fixed_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion.nii.gz' >>> node.inputs.similarity_metric = 'EDS' >>> node.inputs.samplingX = 4 >>> node.inputs.samplingY = 4 @@ -58,13 +57,6 @@ class RigidTask(CommandLineDtitk): output_spec = RigidOutputSpec _cmd = 'dti_rigid_reg' - def _gen_outfilename(self): - # out_file = self.inputs.out_file - # if not isdefined(out_file) and isdefined(self.inputs.in_file): - out_file = self._gen_fname(self.inputs.in_file, - suffix='.aff', change_ext=False) - return out_file - def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file_xfm'] = self.inputs.moving_file.replace('.nii.gz', @@ -73,24 +65,30 @@ def _list_outputs(self): '_aff.nii.gz') return outputs - def _gen_fname(self, name): - if name == 'out_file': - return self._gen_outfilename() - class AffineInputSpec(CommandLineInputSpec): - in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", - exists=True, mandatory=False, position=0, - argstr="%s") - in_moving_txt = traits.Str( - desc="moving list of diffusion tensor image paths", exists=True, - mandatory=False, position=1, argstr="%s") - in_similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, - mandatory=False, position=3, - argstr="%s", desc="similarity metric") - in_usetrans_flag = traits.Enum('--useTrans', '', exists=True, - mandatory=False, position=4, argstr="%s", - desc="initialize using rigid transform??") + fixed_file = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=True, + position=0, argstr="%s") + moving_file = traits.Str(desc="diffusion tensor image path", exists=True, + mandatory=True, position=1, argstr="%s") + similarity_metric = traits.Enum('EDS', 'GDS', 'DDS', 'NMI', exists=True, + mandatory=True, position=2, argstr="%s", + desc="similarity metric") + samplingX = traits.Float(mandatory=True, position=3, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + samplingY = traits.Float(mandatory=True, position=4, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + samplingZ = traits.Float(mandatory=True, position=5, argstr="%s", + desc="dist between samp points (mm)", + default_value=4) + ftol = traits.Float(mandatory=True, position=6, argstr="%s", + desc="cost function tolerance", default_value=0.01) + useInTrans = traits.Float(mandatory=False, position=7, argstr="%s", + desc="to initialize with existing xfm set as 1", + default_value=1) class AffineOutputSpec(TraitedSpec): @@ -100,29 +98,33 @@ class AffineOutputSpec(TraitedSpec): class AffineTask(CommandLineDtitk): """ - Performs affine registration between two tensor volumes - - Example - ------- + Performs affine registration between two tensor volumes - >>> import nipype.interfaces.dtitk as dtitk - >>> node = dtitk.AffineTask() - >>> node.inputs.in_fixed_tensor = 'diffusion.nii' - >>> node.inputs.in_moving_txt = 'dirs.txt' - >>> node.inputs.in_similarity_metric = 'EDS' - >>> node.run() # doctest: +SKIP - """ + Example + ------- + >>> import nipype.interfaces.dtitk as dtitk + >>> node = dtitk.AffineTask() + >>> node.inputs.fixed_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion.nii.gz' + >>> node.inputs.similarity_metric = 'EDS' + >>> node.inputs.samplingX = 4 + >>> node.inputs.samplingY = 4 + >>> node.inputs.samplingZ = 4 + >>> node.inputs.ftol = 0.01 + >>> node.inputs.useInTrans = 1 + >>> node.run() # doctest: +SKIP + """ input_spec = AffineInputSpec output_spec = AffineOutputSpec - _cmd = 'dti_affine_sn' + _cmd = 'dti_affine_reg' def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz', '.aff') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz', '_aff.nii.gz') + outputs['out_file_xfm'] = self.inputs.moving_file.replace('.nii.gz', + '.aff') + outputs['out_file'] = self.inputs.moving_file.replace('.nii.gz', + '_aff.nii.gz') return outputs From e420ceb51e8a21cc242568475cfa443d879bd8f8 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 17 Nov 2017 15:50:03 -0800 Subject: [PATCH 020/365] [REF] Clean-up class Node code --- nipype/pipeline/engine/nodes.py | 312 ++++++++++++++++---------------- nipype/pipeline/engine/utils.py | 20 -- nipype/utils/filemanip.py | 49 +++++ 3 files changed, 202 insertions(+), 179 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 36d3ba1b40..4ac300d3be 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -15,10 +15,8 @@ """ from __future__ import print_function, division, unicode_literals, absolute_import -from builtins import range, object, str, bytes, open +from builtins import range, str, bytes, open -from future import standard_library -standard_library.install_aliases() from collections import OrderedDict from copy import deepcopy @@ -28,7 +26,6 @@ import os import os.path as op import shutil -import errno import socket from shutil import rmtree import sys @@ -40,19 +37,20 @@ from ...utils.filemanip import (save_json, FileNotFoundError, filename_to_list, list_to_filename, copyfiles, fnames_presuffix, loadpkl, - split_filename, load_json, savepkl, - write_rst_header, write_rst_dict, - write_rst_list, to_str) + split_filename, load_json, makedirs, + emptydirs, savepkl, write_rst_header, + write_rst_dict, write_rst_list, to_str) from ...interfaces.base import (traits, InputMultiPath, CommandLine, - Undefined, TraitedSpec, DynamicTraitedSpec, + Undefined, DynamicTraitedSpec, Bunch, InterfaceResult, md5, Interface, - TraitDictObject, TraitListObject, isdefined) -from .utils import (generate_expanded_graph, modify_paths, - export_graph, make_output_dir, write_workflow_prov, - clean_working_directory, format_dot, topological_sort, + isdefined) +from .utils import (modify_paths, clean_working_directory, get_print_name, merge_dict, evaluate_connect_function) from .base import EngineBase +from future import standard_library +standard_library.install_aliases() + logger = logging.getLogger('workflow') @@ -162,6 +160,7 @@ def __init__(self, interface, name, iterables=None, itersource=None, self._interface = interface self.name = name + self._output_dir = None self._result = None self.iterables = iterables self.synchronize = synchronize @@ -189,12 +188,11 @@ def interface(self): @property def result(self): - if self._result: - return self._result - else: - cwd = self.output_dir() - result, _, _ = self._load_resultfile(cwd) - return result + # Cache first + if not self._result: + self._result = self._load_resultfile(self.output_dir())[0] + + return self._result @property def inputs(self): @@ -222,7 +220,7 @@ def n_procs(self): if self._n_procs is not None: return self._n_procs elif hasattr(self._interface.inputs, 'num_threads') and isdefined( - self._interface.inputs.num_threads): + self._interface.inputs.num_threads): return self._interface.inputs.num_threads else: return 1 @@ -238,6 +236,11 @@ def n_procs(self, value): def output_dir(self): """Return the location of the output directory for the node""" + # Output dir is cached + if self._output_dir: + return self._output_dir + + # Calculate & cache otherwise if self.base_dir is None: self.base_dir = mkdtemp() outputdir = self.base_dir @@ -248,7 +251,9 @@ def output_dir(self): if not str2bool(self.config['execution']['parameterize_dirs']): params_str = [self._parameterization_dir(p) for p in params_str] outputdir = op.join(outputdir, *params_str) - return op.abspath(op.join(outputdir, self.name)) + + self._output_dir = op.abspath(op.join(outputdir, self.name)) + return self._output_dir def set_input(self, parameter, val): """ Set interface input value""" @@ -258,15 +263,7 @@ def set_input(self, parameter, val): def get_output(self, parameter): """Retrieve a particular output of the node""" - val = None - if self._result: - val = getattr(self._result.outputs, parameter) - else: - cwd = self.output_dir() - result, _, _ = self._load_resultfile(cwd) - if result and result.outputs: - val = getattr(result.outputs, parameter) - return val + return getattr(self.result.outputs, parameter, None) def help(self): """ Print interface help""" @@ -277,23 +274,29 @@ def hash_exists(self, updatehash=False): # of the dictionary itself. hashed_inputs, hashvalue = self._get_hashval() outdir = self.output_dir() - if op.exists(outdir): - logger.debug('Output dir: %s', to_str(os.listdir(outdir))) - hashfiles = glob(op.join(outdir, '_0x*.json')) - logger.debug('Found hashfiles: %s', to_str(hashfiles)) - if len(hashfiles) > 1: - logger.info(hashfiles) - logger.info('Removing multiple hashfiles and forcing node to rerun') - for hashfile in hashfiles: - os.unlink(hashfile) hashfile = op.join(outdir, '_0x%s.json' % hashvalue) - logger.debug('Final hashfile: %s', hashfile) - if updatehash and op.exists(outdir): - logger.debug("Updating hash: %s", hashvalue) - for file in glob(op.join(outdir, '_0x*.json')): - os.remove(file) - self._save_hashfile(hashfile, hashed_inputs) - return op.exists(hashfile), hashvalue, hashfile, hashed_inputs + logger.debug('Node hash value: %s', hashvalue) + + if op.exists(outdir): + # Find previous hashfiles + hashfiles = glob(op.join(outdir, '_0x*.json')) + if len(hashfiles) > 1: # Remove hashfiles if more than one found + logger.info('Removing hashfiles (%s) and forcing node to rerun', + ', '.join(['"%s"' % op.basename(h) for h in hashfiles])) + for hf in hashfiles: + os.remove(hf) + + if updatehash and len(hashfiles) == 1: + logger.debug("Updating hash: %s", hashvalue) + os.remove(hashfiles[0]) + self._save_hashfile(hashfile, hashed_inputs) + + hash_exists = op.exists(hashfile) + logger.debug( + 'updatehash=%s, overwrite=%s, always_run=%s, hash_exists=%s, ' + 'hash_method=%s', updatehash, self.overwrite, self._interface.always_run, + hash_exists, self.config['execution']['hash_method'].lower()) + return hash_exists, hashvalue, hashfile, hashed_inputs def run(self, updatehash=False): """Execute the node in its directory. @@ -304,123 +307,113 @@ def run(self, updatehash=False): updatehash: boolean Update the hash stored in the output directory """ - # check to see if output directory and hash exist + cwd = os.getcwd() if self.config is None: - self.config = deepcopy(config._sections) - else: - self.config = merge_dict(deepcopy(config._sections), self.config) + self.config = {} + self.config = merge_dict(deepcopy(config._sections), self.config) + if not self._got_inputs: self._get_inputs() self._got_inputs = True + + # Check if output directory exists outdir = self.output_dir() - logger.info("Executing node %s in dir: %s", self.fullname, outdir) if op.exists(outdir): - logger.debug('Output dir: %s', to_str(os.listdir(outdir))) + logger.debug('Output directory (%s) exists and is %sempty,', + outdir, 'not ' * bool(os.listdir(outdir))) + + # Make sure outdir is created + makedirs(outdir, exist_ok=True) + os.chdir(outdir) + + logger.info('[Node] Executing "%s" (%s)', self.fullname, outdir) hash_info = self.hash_exists(updatehash=updatehash) hash_exists, hashvalue, hashfile, hashed_inputs = hash_info - logger.debug( - 'updatehash=%s, overwrite=%s, always_run=%s, hash_exists=%s', - updatehash, self.overwrite, self._interface.always_run, hash_exists) - if (not updatehash and (((self.overwrite is None and - self._interface.always_run) or - self.overwrite) or not - hash_exists)): - logger.debug("Node hash: %s", hashvalue) - - # by rerunning we mean only nodes that did finish to run previously - json_pat = op.join(outdir, '_0x*.json') - json_unfinished_pat = op.join(outdir, '_0x*_unfinished.json') - need_rerun = (op.exists(outdir) and not - isinstance(self, MapNode) and - len(glob(json_pat)) != 0 and - len(glob(json_unfinished_pat)) == 0) - if need_rerun: - logger.debug( - "Rerunning node:\n" - "updatehash = %s, self.overwrite = %s, self._interface.always_run = %s, " - "os.path.exists(%s) = %s, hash_method = %s", updatehash, self.overwrite, - self._interface.always_run, hashfile, op.exists(hashfile), - self.config['execution']['hash_method'].lower()) - log_debug = config.get('logging', 'workflow_level') == 'DEBUG' - if log_debug and not op.exists(hashfile): - exp_hash_paths = glob(json_pat) - if len(exp_hash_paths) == 1: - split_out = split_filename(exp_hash_paths[0]) - exp_hash_file_base = split_out[1] - exp_hash = exp_hash_file_base[len('_0x'):] - logger.debug("Previous node hash = %s", exp_hash) - try: - prev_inputs = load_json(exp_hash_paths[0]) - except: - pass - else: - logging.logdebug_dict_differences(prev_inputs, - hashed_inputs) - cannot_rerun = (str2bool( - self.config['execution']['stop_on_first_rerun']) and not - (self.overwrite is None and self._interface.always_run)) - if cannot_rerun: - raise Exception(("Cannot rerun when 'stop_on_first_rerun' " - "is set to True")) - hashfile_unfinished = op.join(outdir, - '_0x%s_unfinished.json' % - hashvalue) - if op.exists(hashfile): - os.remove(hashfile) - rm_outdir = (op.exists(outdir) and not - (op.exists(hashfile_unfinished) and - self._interface.can_resume) and not - isinstance(self, MapNode)) - if rm_outdir: - logger.debug("Removing old %s and its contents", outdir) - try: - rmtree(outdir) - except OSError as ex: - outdircont = os.listdir(outdir) - if ((ex.errno == errno.ENOTEMPTY) and (len(outdircont) == 0)): - logger.warn( - 'An exception was raised trying to remove old %s, but the path ' - 'seems empty. Is it an NFS mount?. Passing the exception.', outdir) - elif ((ex.errno == errno.ENOTEMPTY) and (len(outdircont) != 0)): - logger.debug( - 'Folder contents (%d items): %s', len(outdircont), outdircont) - raise ex - else: - raise ex + force_run = self.overwrite or (self.overwrite is None and self._interface.always_run) + + # If the node is cached, set-up pklz files and exit + if updatehash or (hash_exists and not force_run): + logger.debug("Only updating node hashes or skipping execution") + inputs_file = op.join(outdir, '_inputs.pklz') + if not op.exists(inputs_file): + logger.debug('Creating inputs file %s', inputs_file) + savepkl(inputs_file, self.inputs.get_traitsfree()) + + node_file = op.join(outdir, '_node.pklz') + if not op.exists(node_file): + logger.debug('Creating node file %s', node_file) + savepkl(node_file, self) - else: - logger.debug( - "%s found and can_resume is True or Node is a MapNode - resuming execution", - hashfile_unfinished) - if isinstance(self, MapNode): - # remove old json files - for filename in glob(op.join(outdir, '_0x*.json')): - os.unlink(filename) - outdir = make_output_dir(outdir) - self._save_hashfile(hashfile_unfinished, hashed_inputs) - self.write_report(report_type='preexec', cwd=outdir) - savepkl(op.join(outdir, '_node.pklz'), self) - savepkl(op.join(outdir, '_inputs.pklz'), - self.inputs.get_traitsfree()) - try: - self._run_interface() - except: - os.remove(hashfile_unfinished) - raise - shutil.move(hashfile_unfinished, hashfile) - self.write_report(report_type='postexec', cwd=outdir) - else: - if not op.exists(op.join(outdir, '_inputs.pklz')): - logger.debug('%s: creating inputs file', self.name) - savepkl(op.join(outdir, '_inputs.pklz'), - self.inputs.get_traitsfree()) - if not op.exists(op.join(outdir, '_node.pklz')): - logger.debug('%s: creating node file', self.name) - savepkl(op.join(outdir, '_node.pklz'), self) - logger.debug("Hashfile exists. Skipping execution") self._run_interface(execute=False, updatehash=updatehash) - logger.debug('Finished running %s in dir: %s\n', self._id, outdir) + logger.info('[Node] Cached "%s" (%s)\n', self.fullname, outdir) + os.chdir(cwd) + return self.result + + # by rerunning we mean only nodes that did finish to run previously + json_pat = op.join(outdir, '_0x*.json') + json_unfinished_pat = op.join(outdir, '_0x*_unfinished.json') + is_mapnode = isinstance(self, MapNode) + need_rerun = (not is_mapnode and + glob(json_pat) and not glob(json_unfinished_pat)) + if need_rerun: + log_debug = config.get('logging', 'workflow_level') == 'DEBUG' + logger.debug('[Node] Rerunning "%s"', self.fullname) + if log_debug and not hash_exists: + exp_hash_paths = glob(json_pat) + if len(exp_hash_paths) == 1: + split_out = split_filename(exp_hash_paths[0]) + exp_hash_file_base = split_out[1] + exp_hash = exp_hash_file_base[len('_0x'):] + logger.debug("Previous node hash = %s", exp_hash) + try: + prev_inputs = load_json(exp_hash_paths[0]) + except: + pass + else: + logging.logdebug_dict_differences(prev_inputs, + hashed_inputs) + if not force_run and str2bool(self.config['execution']['stop_on_first_rerun']): + raise Exception('Cannot rerun when "stop_on_first_rerun" is set to True') + hashfile_unfinished = op.join(outdir, + '_0x%s_unfinished.json' % + hashvalue) + if op.exists(hashfile): + os.remove(hashfile) + + # Delete directory contents if this is not a MapNode or can't resume + rm_outdir = not is_mapnode and not ( + self._interface.can_resume and op.isfile(hashfile_unfinished)) + + if rm_outdir: + emptydirs(outdir) + else: + logger.debug( + "%s hashfile=%s", '[MapNode] Resume -' if is_mapnode + else '[Node] Resume - can_resume=True,', hashfile_unfinished) + if is_mapnode: + # remove old json files + for filename in glob(op.join(outdir, '_0x*.json')): + os.remove(filename) + + self._save_hashfile(hashfile_unfinished, hashed_inputs) + self.write_report(report_type='preexec', cwd=outdir) + savepkl(op.join(outdir, '_node.pklz'), self) + savepkl(op.join(outdir, '_inputs.pklz'), + self.inputs.get_traitsfree()) + try: + self._run_interface(execute=True) + except: + logger.warning('[Node] Exception "%s" (%s)', self.fullname, outdir) + os.remove(hashfile_unfinished) + os.chdir(cwd) + raise + + # Tear-up + shutil.move(hashfile_unfinished, hashfile) + self.write_report(report_type='postexec', cwd=outdir) + logger.info('[Node] Completed "%s" (%s)', self.fullname, outdir) + os.chdir(cwd) return self._result # Private functions @@ -512,10 +505,7 @@ def _get_inputs(self): def _run_interface(self, execute=True, updatehash=False): if updatehash: return - old_cwd = os.getcwd() - os.chdir(self.output_dir()) self._result = self._run_command(execute) - os.chdir(old_cwd) def _save_results(self, result, cwd): resultsfile = op.join(cwd, 'result_%s.pklz' % self.name) @@ -967,7 +957,8 @@ def _collate_join_field_inputs(self): try: setattr(self._interface.inputs, field, val) except Exception as e: - raise ValueError(">>JN %s %s %s %s %s: %s" % (self, field, val, self.inputs.copyable_trait_names(), self.joinfield, e)) + raise ValueError(">>JN %s %s %s %s %s: %s" % ( + self, field, val, self.inputs.copyable_trait_names(), self.joinfield, e)) elif hasattr(self._interface.inputs, field): # copy the non-join field val = getattr(self._inputs, field) @@ -1039,10 +1030,12 @@ def __init__(self, interface, iterfield, name, serial=False, nested=False, **kwa name : alphanumeric string node specific name serial : boolean - flag to enforce executing the jobs of the mapnode in a serial manner rather than parallel + flag to enforce executing the jobs of the mapnode in a serial + manner rather than parallel nested : boolea - support for nested lists, if set the input list will be flattened before running, and the - nested list structure of the outputs will be resored + support for nested lists, if set the input list will be flattened + before running, and the nested list structure of the outputs will + be resored See Node docstring for additional keyword arguments. """ @@ -1219,7 +1212,8 @@ def _collate_results(self, nodes): for key, _ in list(self.outputs.items()): values = getattr(self._result.outputs, key) if isdefined(values): - values = unflatten(values, filename_to_list(getattr(self.inputs, self.iterfield[0]))) + values = unflatten(values, filename_to_list( + getattr(self.inputs, self.iterfield[0]))) setattr(self._result.outputs, key, values) if returncode and any([code is not None for code in returncode]): diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index 05c5345a12..12da40c5ec 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -1067,26 +1067,6 @@ def format_dot(dotfilename, format='png'): return dotfilename -def make_output_dir(outdir): - """Make the output_dir if it doesn't exist. - - Parameters - ---------- - outdir : output directory to create - - """ - # this odd approach deals with concurrent directory cureation - try: - if not os.path.exists(os.path.abspath(outdir)): - logger.debug("Creating %s", outdir) - os.makedirs(outdir) - except OSError: - logger.debug("Problem creating %s", outdir) - if not os.path.exists(outdir): - raise OSError('Could not create %s' % outdir) - return outdir - - def get_all_files(infile): files = [infile] if infile.endswith(".img"): diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 16eabbb69c..6a367ab4d7 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -8,6 +8,7 @@ import sys import pickle +import errno import subprocess import gzip import hashlib @@ -663,3 +664,51 @@ def dist_is_editable(dist): if os.path.isfile(egg_link): return True return False + + +def makedirs(path, exist_ok=False): + """ + Create path, if it doesn't exist. + + Parameters + ---------- + path : output directory to create + + """ + if not exist_ok: # The old makedirs + os.makedirs(path) + return path + + # this odd approach deals with concurrent directory cureation + try: + if not os.path.exists(os.path.abspath(path)): + fmlogger.debug("Creating directory %s", path) + os.makedirs(path) + except OSError: + fmlogger.debug("Problem creating directory %s", path) + if not os.path.exists(path): + raise OSError('Could not create directory %s' % path) + return path + + +def emptydirs(path): + fmlogger.debug("Removing contents of %s", path) + pathconts = os.listdir(path) + + if not pathconts: + return True + + for el in pathconts: + try: + shutil.rmtree(el) + except OSError as ex: + elcont = os.listdir(el) + if ex.errno == errno.ENOTEMPTY and not elcont: + fmlogger.warning( + 'An exception was raised trying to remove old %s, but the path ' + 'seems empty. Is it an NFS mount?. Passing the exception.', el) + elif ex.errno == errno.ENOTEMPTY and elcont: + fmlogger.debug('Folder %s contents (%d items).', el, len(elcont)) + raise ex + else: + raise ex From a5ba8131d2e7d793be82f72ad191ee0d8aa0638b Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 17 Nov 2017 18:26:27 -0800 Subject: [PATCH 021/365] general cleanup --- nipype/pipeline/engine/nodes.py | 8 ++++---- nipype/pipeline/engine/workflows.py | 6 +++--- nipype/pipeline/plugins/base.py | 9 +++++---- nipype/pipeline/plugins/multiproc.py | 23 +++++++++++++++------- nipype/utils/filemanip.py | 29 +++++++++++++++------------- 5 files changed, 44 insertions(+), 31 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 4ac300d3be..527e592c10 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -327,7 +327,7 @@ def run(self, updatehash=False): makedirs(outdir, exist_ok=True) os.chdir(outdir) - logger.info('[Node] Executing "%s" (%s)', self.fullname, outdir) + logger.info('[Node] Setting-up "%s" in "%s".', self.fullname, outdir) hash_info = self.hash_exists(updatehash=updatehash) hash_exists, hashvalue, hashfile, hashed_inputs = hash_info force_run = self.overwrite or (self.overwrite is None and self._interface.always_run) @@ -346,7 +346,7 @@ def run(self, updatehash=False): savepkl(node_file, self) self._run_interface(execute=False, updatehash=updatehash) - logger.info('[Node] Cached "%s" (%s)\n', self.fullname, outdir) + logger.info('[Node] Cached "%s".', self.fullname) os.chdir(cwd) return self.result @@ -412,7 +412,7 @@ def run(self, updatehash=False): # Tear-up shutil.move(hashfile_unfinished, hashfile) self.write_report(report_type='postexec', cwd=outdir) - logger.info('[Node] Completed "%s" (%s)', self.fullname, outdir) + logger.info('[Node] Finished "%s".', self.fullname) os.chdir(cwd) return self._result @@ -623,7 +623,7 @@ def _run_command(self, execute, copyfiles=True): if copyfiles: self._copyfiles_to_wd(cwd, execute) - message = 'Running node "%s" ("%s.%s")' + message = '[Node] Running "%s" ("%s.%s")' if issubclass(self._interface.__class__, CommandLine): try: cmd = self._interface.cmdline diff --git a/nipype/pipeline/engine/workflows.py b/nipype/pipeline/engine/workflows.py index cd50bb72b3..8522e4ee30 100644 --- a/nipype/pipeline/engine/workflows.py +++ b/nipype/pipeline/engine/workflows.py @@ -47,11 +47,11 @@ from ...utils.filemanip import (save_json, FileNotFoundError, filename_to_list, list_to_filename, copyfiles, fnames_presuffix, loadpkl, - split_filename, load_json, savepkl, + split_filename, load_json, makedirs, savepkl, write_rst_header, write_rst_dict, write_rst_list, to_str) from .utils import (generate_expanded_graph, modify_paths, - export_graph, make_output_dir, write_workflow_prov, + export_graph, write_workflow_prov, write_workflow_resources, clean_working_directory, format_dot, topological_sort, get_print_name, merge_dict, evaluate_connect_function, @@ -424,7 +424,7 @@ def write_graph(self, dotfilename='graph.dot', graph2use='hierarchical', base_dir = op.join(base_dir, self.name) else: base_dir = os.getcwd() - base_dir = make_output_dir(base_dir) + base_dir = makedirs(base_dir) if graph2use in ['hierarchical', 'colored']: if self.name[:1].isdigit(): # these graphs break if int raise ValueError('{} graph failed, workflow name cannot begin ' diff --git a/nipype/pipeline/plugins/base.py b/nipype/pipeline/plugins/base.py index bab2812903..5bb03ef3d9 100644 --- a/nipype/pipeline/plugins/base.py +++ b/nipype/pipeline/plugins/base.py @@ -339,7 +339,7 @@ def _local_hash_check(self, jobid, graph): logger.debug('Skipping cached node %s with ID %s.', self.procs[jobid]._id, jobid) try: - self._task_finished_cb(jobid) + self._task_finished_cb(jobid, cached=True) self._remove_node_dirs() except Exception: logger.debug('Error skipping cached node %s (%s).', @@ -349,13 +349,14 @@ def _local_hash_check(self, jobid, graph): return True return False - def _task_finished_cb(self, jobid): + def _task_finished_cb(self, jobid, cached=False): """ Extract outputs and assign to inputs of dependent tasks This is called when a job is completed. """ - logger.info('[Job finished] jobname: %s jobid: %d' % - (self.procs[jobid]._id, jobid)) + logger.info('[Job %d] %s (%s).', jobid, + 'Cached' if cached else 'Completed', + self.procs[jobid].fullname) if self._status_callback: self._status_callback(self.procs[jobid], 'end') # Update job and worker queues diff --git a/nipype/pipeline/plugins/multiproc.py b/nipype/pipeline/plugins/multiproc.py index 595b0e1947..7d091f24d2 100644 --- a/nipype/pipeline/plugins/multiproc.py +++ b/nipype/pipeline/plugins/multiproc.py @@ -12,10 +12,11 @@ from multiprocessing import Process, Pool, cpu_count, pool from traceback import format_exception import sys +from textwrap import indent +from logging import INFO from copy import deepcopy import numpy as np - from ... import logging from ...utils.profiler import get_system_total_memory_gb from ..engine import MapNode @@ -126,8 +127,8 @@ def __init__(self, plugin_args=None): self.raise_insufficient = self.plugin_args.get('raise_insufficient', True) # Instantiate different thread pools for non-daemon processes - logger.debug('MultiProcPlugin starting in "%sdaemon" mode (n_procs=%d, mem_gb=%0.2f)', - 'non' if non_daemon else '', self.processors, self.memory_gb) + logger.debug('[MultiProc] Starting in "%sdaemon" mode (n_procs=%d, mem_gb=%0.2f)', + 'non' * non_daemon, self.processors, self.memory_gb) NipypePool = NonDaemonPool if non_daemon else Pool try: @@ -158,7 +159,7 @@ def _submit_job(self, node, updatehash=False): run_node, (node, updatehash, self._taskid), callback=self._async_callback) - logger.debug('MultiProc submitted task %s (taskid=%d).', + logger.debug('[MultiProc] Submitted task %s (taskid=%d).', node.fullname, self._taskid) return self._taskid @@ -214,9 +215,17 @@ def _send_procs_to_workers(self, updatehash=False, graph=None): stats = (len(self.pending_tasks), len(jobids), free_memory_gb, self.memory_gb, free_processors, self.processors) if self._stats != stats: - logger.info('Currently running %d tasks, and %d jobs ready. Free ' - 'memory (GB): %0.2f/%0.2f, Free processors: %d/%d', - *stats) + tasks_list_msg = '' + if logger.level <= INFO: + running_tasks = [' * %s' % self.procs[jobid].fullname + for _, jobid in self.pending_tasks] + if running_tasks: + tasks_list_msg = '\nCurrently running:\n' + tasks_list_msg += '\n'.join(running_tasks) + tasks_list_msg = indent(tasks_list_msg, ' ' * 21) + logger.info('[MultiProc] Running %d tasks, and %d jobs ready. Free ' + 'memory (GB): %0.2f/%0.2f, Free processors: %d/%d.%s', + *stats, tasks_list_msg) self._stats = stats if free_memory_gb < 0.01 or free_processors == 0: diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 6a367ab4d7..4fe697d63a 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -699,16 +699,19 @@ def emptydirs(path): return True for el in pathconts: - try: - shutil.rmtree(el) - except OSError as ex: - elcont = os.listdir(el) - if ex.errno == errno.ENOTEMPTY and not elcont: - fmlogger.warning( - 'An exception was raised trying to remove old %s, but the path ' - 'seems empty. Is it an NFS mount?. Passing the exception.', el) - elif ex.errno == errno.ENOTEMPTY and elcont: - fmlogger.debug('Folder %s contents (%d items).', el, len(elcont)) - raise ex - else: - raise ex + if os.path.isfile(el): + os.remove(el) + else: + try: + shutil.rmtree(el) + except OSError as ex: + elcont = os.listdir(el) + if ex.errno == errno.ENOTEMPTY and not elcont: + fmlogger.warning( + 'An exception was raised trying to remove old %s, but the path ' + 'seems empty. Is it an NFS mount?. Passing the exception.', el) + elif ex.errno == errno.ENOTEMPTY and elcont: + fmlogger.debug('Folder %s contents (%d items).', el, len(elcont)) + raise ex + else: + raise ex From bb9f5b470defe5a029f40bb47239cde918aea8fd Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 22 Nov 2017 09:55:13 -0500 Subject: [PATCH 022/365] Extended MRtrix3 interface --- .zenodo.json | 4 + doc/users/config_file.rst | 8 +- doc/users/plugins.rst | 4 +- nipype/algorithms/tests/test_auto_CompCor.py | 53 +++++ nipype/algorithms/tests/test_auto_ErrorMap.py | 35 ++++ nipype/algorithms/tests/test_auto_Overlap.py | 47 +++++ nipype/algorithms/tests/test_auto_TSNR.py | 43 ++++ nipype/algorithms/tests/test_mesh_ops.py | 2 +- nipype/interfaces/afni/preprocess.py | 2 +- .../afni/tests/test_auto_TCatSubBrick.py | 48 +++++ nipype/interfaces/afni/utils.py | 2 +- nipype/interfaces/ants/resampling.py | 2 +- .../interfaces/ants/tests/test_resampling.py | 4 +- nipype/interfaces/cmtk/tests/test_nbs.py | 4 +- nipype/interfaces/mrtrix3/__init__.py | 8 +- nipype/interfaces/mrtrix3/preprocess.py | 58 +++++- nipype/interfaces/mrtrix3/reconst.py | 58 +++++- .../mrtrix3/tests/test_auto_DWI2FOD.py | 81 +++++++ .../mrtrix3/tests/test_auto_DWI2Response.py | 75 +++++++ .../mrtrix3/tests/test_auto_DWIExtract.py | 62 ++++++ .../mrtrix3/tests/test_auto_Generate5tt.py | 24 ++- .../mrtrix3/tests/test_auto_Generate5ttFSL.py | 45 ++++ .../mrtrix3/tests/test_auto_MRConvert.py | 66 ++++++ .../mrtrix3/tests/test_auto_MRMath.py | 59 ++++++ nipype/interfaces/mrtrix3/utils.py | 197 +++++++++++++++++- nipype/interfaces/niftyfit/asl.py | 2 +- .../niftyseg/tests/test_auto_PatchMatch.py | 60 ++++++ .../tests/test_auto_SimpleInterface.py | 16 ++ nipype/pipeline/engine/tests/test_utils.py | 2 +- 29 files changed, 1035 insertions(+), 36 deletions(-) create mode 100755 nipype/algorithms/tests/test_auto_CompCor.py create mode 100755 nipype/algorithms/tests/test_auto_ErrorMap.py create mode 100755 nipype/algorithms/tests/test_auto_Overlap.py create mode 100755 nipype/algorithms/tests/test_auto_TSNR.py create mode 100755 nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py create mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py create mode 100755 nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py create mode 100755 nipype/interfaces/tests/test_auto_SimpleInterface.py diff --git a/.zenodo.json b/.zenodo.json index 41497da6d8..852ff8f91f 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -538,6 +538,10 @@ "affiliation": "MIT", "name": "Kaczmarzyk, Jakub", "orcid": "0000-0002-5544-7577" + }, + { + "affiliation": "University College London" + "name": "Mancini, Matteo" } ], "keywords": [ diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index b196047e97..7c10a381c8 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index 501e7aa1d6..e655e5f6db 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: diff --git a/nipype/algorithms/tests/test_auto_CompCor.py b/nipype/algorithms/tests/test_auto_CompCor.py new file mode 100755 index 0000000000..34dacaf4d3 --- /dev/null +++ b/nipype/algorithms/tests/test_auto_CompCor.py @@ -0,0 +1,53 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..confounds import CompCor + + +def test_CompCor_inputs(): + input_map = dict(components_file=dict(usedefault=True, + ), + header_prefix=dict(), + high_pass_cutoff=dict(usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + ignore_initial_volumes=dict(usedefault=True, + ), + mask_files=dict(), + mask_index=dict(requires=['mask_files'], + xor=['merge_method'], + ), + merge_method=dict(requires=['mask_files'], + xor=['mask_index'], + ), + num_components=dict(usedefault=True, + ), + pre_filter=dict(usedefault=True, + ), + realigned_file=dict(mandatory=True, + ), + regress_poly_degree=dict(usedefault=True, + ), + repetition_time=dict(), + save_pre_filter=dict(), + use_regress_poly=dict(deprecated='0.15.0', + new_name='pre_filter', + ), + ) + inputs = CompCor.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_CompCor_outputs(): + output_map = dict(components_file=dict(), + pre_filter_file=dict(), + ) + outputs = CompCor.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_ErrorMap.py b/nipype/algorithms/tests/test_auto_ErrorMap.py new file mode 100755 index 0000000000..f3d19c5690 --- /dev/null +++ b/nipype/algorithms/tests/test_auto_ErrorMap.py @@ -0,0 +1,35 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..metrics import ErrorMap + + +def test_ErrorMap_inputs(): + input_map = dict(ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_ref=dict(mandatory=True, + ), + in_tst=dict(mandatory=True, + ), + mask=dict(), + metric=dict(mandatory=True, + usedefault=True, + ), + out_map=dict(), + ) + inputs = ErrorMap.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_ErrorMap_outputs(): + output_map = dict(distance=dict(), + out_map=dict(), + ) + outputs = ErrorMap.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_Overlap.py b/nipype/algorithms/tests/test_auto_Overlap.py new file mode 100755 index 0000000000..dcabbec296 --- /dev/null +++ b/nipype/algorithms/tests/test_auto_Overlap.py @@ -0,0 +1,47 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..misc import Overlap + + +def test_Overlap_inputs(): + input_map = dict(bg_overlap=dict(mandatory=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + mask_volume=dict(), + out_file=dict(usedefault=True, + ), + vol_units=dict(mandatory=True, + usedefault=True, + ), + volume1=dict(mandatory=True, + ), + volume2=dict(mandatory=True, + ), + weighting=dict(usedefault=True, + ), + ) + inputs = Overlap.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_Overlap_outputs(): + output_map = dict(dice=dict(), + diff_file=dict(), + jaccard=dict(), + labels=dict(), + roi_di=dict(), + roi_ji=dict(), + roi_voldiff=dict(), + volume_difference=dict(), + ) + outputs = Overlap.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_TSNR.py b/nipype/algorithms/tests/test_auto_TSNR.py new file mode 100755 index 0000000000..d906d39e3f --- /dev/null +++ b/nipype/algorithms/tests/test_auto_TSNR.py @@ -0,0 +1,43 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..misc import TSNR + + +def test_TSNR_inputs(): + input_map = dict(detrended_file=dict(hash_files=False, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(mandatory=True, + ), + mean_file=dict(hash_files=False, + usedefault=True, + ), + regress_poly=dict(), + stddev_file=dict(hash_files=False, + usedefault=True, + ), + tsnr_file=dict(hash_files=False, + usedefault=True, + ), + ) + inputs = TSNR.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TSNR_outputs(): + output_map = dict(detrended_file=dict(), + mean_file=dict(), + stddev_file=dict(), + tsnr_file=dict(), + ) + outputs = TSNR.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_mesh_ops.py b/nipype/algorithms/tests/test_mesh_ops.py index 9d510dee2b..d5fbc56825 100644 --- a/nipype/algorithms/tests/test_mesh_ops.py +++ b/nipype/algorithms/tests/test_mesh_ops.py @@ -15,7 +15,7 @@ @pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed") def test_ident_distances(tmpdir): - tmpdir.chdir() + tmpdir.chdir() in_surf = example_data('surf01.vtk') dist_ident = m.ComputeMeshWarp() diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index c96616273d..3d7d47c673 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -3490,7 +3490,7 @@ class Qwarp(AFNICommand): >>> qwarp3.inputs.base_file = 'mni.nii' >>> qwarp3.inputs.allineate = True >>> qwarp3.inputs.allineate_opts = '-cose lpa -verb' - >>> qwarp3.cmdline + >>> qwarp3.cmdline # doctest: +ALLOW_UNICODE "3dQwarp -allineate -allineate_opts '-cose lpa -verb' -base mni.nii -source structural.nii -prefix structural_QW" >>> res3 = qwarp3.run() # doctest: +SKIP """ _cmd = '3dQwarp' diff --git a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py new file mode 100755 index 0000000000..da3b0fb383 --- /dev/null +++ b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py @@ -0,0 +1,48 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import TCatSubBrick + + +def test_TCatSubBrick_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_files=dict(argstr='%s%s ...', + copyfile=False, + mandatory=True, + position=-1, + ), + num_threads=dict(nohash=True, + usedefault=True, + ), + out_file=dict(argstr='-prefix %s', + genfile=True, + ), + outputtype=dict(), + rlt=dict(argstr='-rlt%s', + position=1, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = TCatSubBrick.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_TCatSubBrick_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = TCatSubBrick.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 242b5077ee..e492b39d47 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -1674,7 +1674,7 @@ class NwarpCat(AFNICommand): >>> nwarpcat = afni.NwarpCat() >>> nwarpcat.inputs.in_files = ['Q25_warp+tlrc.HEAD', ('IDENT', 'structural.nii')] >>> nwarpcat.inputs.out_file = 'Fred_total_WARP' - >>> nwarpcat.cmdline + >>> nwarpcat.cmdline # doctest: +ALLOW_UNICODE "3dNwarpCat -prefix Fred_total_WARP Q25_warp+tlrc.HEAD 'IDENT(structural.nii)'" >>> res = nwarpcat.run() # doctest: +SKIP diff --git a/nipype/interfaces/ants/resampling.py b/nipype/interfaces/ants/resampling.py index 3ed60a51b1..e268cb43e2 100644 --- a/nipype/interfaces/ants/resampling.py +++ b/nipype/interfaces/ants/resampling.py @@ -75,7 +75,7 @@ class WarpTimeSeriesImageMultiTransform(ANTSCommand): >>> wtsimt.inputs.reference_image = 'ants_deformed.nii.gz' >>> wtsimt.inputs.transformation_series = ['ants_Warp.nii.gz','ants_Affine.txt'] >>> wtsimt.inputs.invert_affine = [1] # # this will invert the 1st Affine file: ants_Affine.txt - >>> wtsimt.cmdline + >>> wtsimt.cmdline # doctest: +ALLOW_UNICODE 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii -R ants_deformed.nii.gz ants_Warp.nii.gz \ -i ants_Affine.txt' """ diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index 22dc4446e9..509ebfe844 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -1,5 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- -# vi: set ft=python sts=4 ts=4 sw=4 et: +# vi: set ft=python sts=4 ts=4 sw=4 et: from nipype.interfaces.ants import WarpImageMultiTransform, WarpTimeSeriesImageMultiTransform import os @@ -66,7 +66,7 @@ def create_wtsimt(): def test_WarpTimeSeriesImageMultiTransform(change_dir, create_wtsimt): wtsimt = create_wtsimt assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ --R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' +-R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' def test_WarpTimeSeriesImageMultiTransform_invaffine(change_dir, create_wtsimt): diff --git a/nipype/interfaces/cmtk/tests/test_nbs.py b/nipype/interfaces/cmtk/tests/test_nbs.py index 0516390b02..03a7aa8619 100644 --- a/nipype/interfaces/cmtk/tests/test_nbs.py +++ b/nipype/interfaces/cmtk/tests/test_nbs.py @@ -31,12 +31,12 @@ def test_importerror(creating_graphs, tmpdir): graphlist = creating_graphs group1 = graphlist[:3] group2 = graphlist[3:] - + nbs = NetworkBasedStatistic() nbs.inputs.in_group1 = group1 nbs.inputs.in_group2 = group2 nbs.inputs.edge_key = "weight" - + with pytest.raises(ImportError) as e: nbs.run() assert "cviewer library is not available" == str(e.value) diff --git a/nipype/interfaces/mrtrix3/__init__.py b/nipype/interfaces/mrtrix3/__init__.py index 3ff5c8e2e7..81749386f5 100644 --- a/nipype/interfaces/mrtrix3/__init__.py +++ b/nipype/interfaces/mrtrix3/__init__.py @@ -3,9 +3,9 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -from .utils import (Mesh2PVE, Generate5tt, BrainMask, TensorMetrics, - ComputeTDI, TCK2VTK) -from .preprocess import ResponseSD, ACTPrepareFSL, ReplaceFSwithFIRST +from .utils import (Mesh2PVE, Generate5tt, Generate5ttFSL, BrainMask, TensorMetrics, + ComputeTDI, TCK2VTK, MRMath, MRConvert, DWIExtract) +from .preprocess import DWI2Response, ResponseSD, ACTPrepareFSL, ReplaceFSwithFIRST from .tracking import Tractography -from .reconst import FitTensor, EstimateFOD +from .reconst import DWI2FOD, FitTensor, EstimateFOD from .connectivity import LabelConfig, BuildConnectome diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 141325e25b..1159e89e7a 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -17,10 +17,64 @@ from ..traits_extension import isdefined from ..base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec, - File) + File, Undefined) from .base import MRTrix3BaseInputSpec, MRTrix3Base +class DWI2ResponseInputSpec(MRTrix3BaseInputSpec): + algorithm = traits.Enum('msmt_5tt','dhollander','tournier','tax', argstr='%s', position=-6, + mandatory=True, desc='response estimation algorithm (multi-tissue)') + dwi_file = File(exists=True, argstr='%s', position=-5, + mandatory=True, desc='input DWI image') + mtt_file = File(argstr='%s', position=-4, desc='input 5tt image') + wm_file = File('wm.txt', argstr='%s', position=-3, usedefault=True, + desc='output WM response text file') + gm_file = File(argstr='%s', position=-2, desc='output GM response text file') + csf_file = File(argstr='%s', position=-1, desc='output CSF response text file') + in_mask = File(exists=True, argstr='-mask %s', + desc='provide initial mask image') + max_sh = traits.Int(8, argstr='-lmax %d', + desc='maximum harmonic degree of response function') + + +class DWI2ResponseOutputSpec(TraitedSpec): + wm_file = File(argstr='%s', desc='output WM response text file') + gm_file = File(argstr='%s', desc='output GM response text file') + csf_file = File(argstr='%s', desc='output CSF response text file') + + +class DWI2Response(MRTrix3Base): + + """ + Estimate response function(s) for spherical deconvolution using the specified algorithm. + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> resp = mrt.DWI2Response() + >>> resp.inputs.dwi_file = 'dwi.mif' + >>> resp.inputs.algorithm = 'tournier' + >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') + >>> resp.cmdline # doctest: +ELLIPSIS + 'dwi2response -fslgrad bvecs bvals tournier dwi.mif wm.txt' + >>> resp.run() # doctest: +SKIP + """ + + _cmd = 'dwi2response' + input_spec = DWI2ResponseInputSpec + output_spec = DWI2ResponseOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['wm_file'] = op.abspath(self.inputs.wm_file) + if self.inputs.gm_file!=Undefined: + outputs['gm_file'] = op.abspath(self.inputs.gm_file) + if self.inputs.csf_file!=Undefined: + outputs['csf_file'] = op.abspath(self.inputs.csf_file) + return outputs + + class ResponseSDInputSpec(MRTrix3BaseInputSpec): in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, desc='input diffusion weighted images') @@ -80,7 +134,7 @@ class ResponseSD(MRTrix3Base): """ Generate an appropriate response function from the image data for - spherical deconvolution. + spherical deconvolution. (previous MRTrix releases) .. [1] Tax, C. M.; Jeurissen, B.; Vos, S. B.; Viergever, M. A. and Leemans, A., Recursive calibration of the fiber response function diff --git a/nipype/interfaces/mrtrix3/reconst.py b/nipype/interfaces/mrtrix3/reconst.py index b608c5514c..b8f2ffef63 100644 --- a/nipype/interfaces/mrtrix3/reconst.py +++ b/nipype/interfaces/mrtrix3/reconst.py @@ -15,7 +15,7 @@ import os.path as op -from ..base import traits, TraitedSpec, File +from ..base import traits, TraitedSpec, File, Undefined from .base import MRTrix3BaseInputSpec, MRTrix3Base @@ -73,6 +73,61 @@ def _list_outputs(self): return outputs +class DWI2FODInputSpec(MRTrix3BaseInputSpec): + algorithm = traits.Enum('csd','msmt_csd', argstr='%s', position=-8, + mandatory=True, desc='FOD algorithm') + dwi_file = File(exists=True, argstr='%s', position=-7, + mandatory=True, desc='input DWI image') + wm_txt = File(argstr='%s', position=-6, + mandatory=True, desc='WM response text file') + wm_odf = File('wm.mif', argstr='%s', position=-5, usedefault=True, + mandatory=True, desc='output WM ODF') + gm_txt = File(argstr='%s', position=-4, desc='GM response text file') + gm_odf = File('gm.mif', argstr='%s', position=-3, desc='output GM ODF') + csf_txt = File(argstr='%s', position=-2, desc='CSF response text file') + csf_odf = File('csf.mif', argstr='%s', position=-1, desc='output CSF ODF') + mask_file = File(exists=True, argstr='-mask %s', desc='mask image') + + +class DWI2FODOutputSpec(TraitedSpec): + wm_odf = File(argstr='%s', desc='output WM ODF') + gm_odf = File(argstr='%s', desc='output GM ODF') + csf_odf = File(argstr='%s', desc='output CSF ODF') + + +class DWI2FOD(MRTrix3Base): + + """ + Estimate fibre orientation distributions from diffusion data using spherical deconvolution + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> fod = mrt.DWI2FOD() + >>> fod.inputs.algorithm = 'csd' + >>> fod.inputs.dwi_file = 'dwi.mif' + >>> fod.inputs.wm_txt = 'wm.txt' + >>> fod.inputs.grad_fsl = ('bvecs', 'bvals') + >>> fod.cmdline # doctest: +ELLIPSIS + 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif' + >>> fod.run() # doctest: +SKIP + """ + + _cmd = 'dwi2fod' + input_spec = DWI2FODInputSpec + output_spec = DWI2FODOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['wm_odf'] = op.abspath(self.inputs.wm_odf) + if self.inputs.gm_odf!=Undefined: + outputs['gm_odf'] = op.abspath(self.inputs.gm_odf) + if self.inputs.csf_odf!=Undefined: + outputs['csf_odf'] = op.abspath(self.inputs.csf_odf) + return outputs + + class EstimateFODInputSpec(MRTrix3BaseInputSpec): in_file = File(exists=True, argstr='%s', mandatory=True, position=-3, desc='input diffusion weighted images') @@ -129,6 +184,7 @@ class EstimateFOD(MRTrix3Base): """ Convert diffusion-weighted images to tensor images + (previous MRTrix releases) Note that this program makes use of implied symmetries in the diffusion profile. First, the fact the signal attenuation profile is real implies diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py new file mode 100755 index 0000000000..9501fd656b --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py @@ -0,0 +1,81 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..reconst import DWI2FOD + + +def test_DWI2FOD_inputs(): + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-8, + ), + args=dict(argstr='%s', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + csf_odf=dict(argstr='%s', + position=-1, + ), + csf_txt=dict(argstr='%s', + position=-2, + ), + dwi_file=dict(argstr='%s', + mandatory=True, + position=-7, + ), + environ=dict(nohash=True, + usedefault=True, + ), + gm_odf=dict(argstr='%s', + position=-3, + ), + gm_txt=dict(argstr='%s', + position=-4, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + mask_file=dict(argstr='-mask %s', + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + wm_odf=dict(argstr='%s', + mandatory=True, + position=-5, + usedefault=True, + ), + wm_txt=dict(argstr='%s', + mandatory=True, + position=-6, + ), + ) + inputs = DWI2FOD.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_DWI2FOD_outputs(): + output_map = dict(csf_odf=dict(argstr='%s', + ), + gm_odf=dict(argstr='%s', + ), + wm_odf=dict(argstr='%s', + ), + ) + outputs = DWI2FOD.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py new file mode 100755 index 0000000000..5b0836f79b --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py @@ -0,0 +1,75 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..preprocess import DWI2Response + + +def test_DWI2Response_inputs(): + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-6, + ), + args=dict(argstr='%s', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + csf_file=dict(argstr='%s', + position=-1, + ), + dwi_file=dict(argstr='%s', + mandatory=True, + position=-5, + ), + environ=dict(nohash=True, + usedefault=True, + ), + gm_file=dict(argstr='%s', + position=-2, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + in_mask=dict(argstr='-mask %s', + ), + max_sh=dict(argstr='-lmax %d', + ), + mtt_file=dict(argstr='%s', + position=-4, + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + wm_file=dict(argstr='%s', + position=-3, + usedefault=True, + ), + ) + inputs = DWI2Response.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_DWI2Response_outputs(): + output_map = dict(csf_file=dict(argstr='%s', + ), + gm_file=dict(argstr='%s', + ), + wm_file=dict(argstr='%s', + ), + ) + outputs = DWI2Response.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py new file mode 100755 index 0000000000..22e0890d2f --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py @@ -0,0 +1,62 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import DWIExtract + + +def test_DWIExtract_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + bzero=dict(argstr='-bzero', + ), + environ=dict(nohash=True, + usedefault=True, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + in_file=dict(argstr='%s', + mandatory=True, + position=-2, + ), + nobzero=dict(argstr='-nobzero', + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + out_file=dict(argstr='%s', + mandatory=True, + position=-1, + ), + shell=dict(argstr='-shell %s', + sep=',', + ), + singleshell=dict(argstr='-singleshell', + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = DWIExtract.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_DWIExtract_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = DWIExtract.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py index 2afa4e46da..df1aadbe63 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py @@ -4,25 +4,37 @@ def test_Generate5tt_inputs(): - input_map = dict(args=dict(argstr='%s', + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-3, + ), + args=dict(argstr='%s', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', ), environ=dict(nohash=True, usedefault=True, ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), ignore_exception=dict(nohash=True, usedefault=True, ), - in_fast=dict(argstr='%s', - mandatory=True, - position=-3, + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', ), - in_first=dict(argstr='%s', + in_file=dict(argstr='%s', + mandatory=True, position=-2, ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), out_file=dict(argstr='%s', mandatory=True, position=-1, - usedefault=True, ), terminal_output=dict(deprecated='1.0.0', nohash=True, diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py new file mode 100755 index 0000000000..97617fa2cc --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py @@ -0,0 +1,45 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import Generate5ttFSL + + +def test_Generate5ttFSL_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_fast=dict(argstr='%s', + mandatory=True, + position=-3, + ), + in_first=dict(argstr='%s', + position=-2, + ), + out_file=dict(argstr='%s', + mandatory=True, + position=-1, + usedefault=True, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = Generate5ttFSL.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_Generate5ttFSL_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = Generate5ttFSL.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py new file mode 100755 index 0000000000..5dec38ed52 --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py @@ -0,0 +1,66 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import MRConvert + + +def test_MRConvert_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + axes=dict(argstr='-axes %s', + sep=',', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + coord=dict(argstr='-coord %s', + sep=' ', + ), + environ=dict(nohash=True, + usedefault=True, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + in_file=dict(argstr='%s', + mandatory=True, + position=-2, + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + out_file=dict(argstr='%s', + mandatory=True, + position=-1, + usedefault=True, + ), + scaling=dict(argstr='-scaling %s', + sep=',', + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + vox=dict(argstr='-vox %s', + sep=',', + ), + ) + inputs = MRConvert.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_MRConvert_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = MRConvert.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py b/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py new file mode 100755 index 0000000000..963ad07722 --- /dev/null +++ b/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py @@ -0,0 +1,59 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import MRMath + + +def test_MRMath_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + axis=dict(argstr='-axis %d', + ), + bval_scale=dict(argstr='-bvalue_scaling %s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + grad_file=dict(argstr='-grad %s', + ), + grad_fsl=dict(argstr='-fslgrad %s %s', + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_bval=dict(), + in_bvec=dict(argstr='-fslgrad %s %s', + ), + in_file=dict(argstr='%s', + mandatory=True, + position=-3, + ), + nthreads=dict(argstr='-nthreads %d', + nohash=True, + ), + operation=dict(argstr='%s', + mandatory=True, + position=-2, + ), + out_file=dict(argstr='%s', + mandatory=True, + position=-1, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = MRMath.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_MRMath_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = MRMath.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index 42f3d0c6fd..18397823a7 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -108,7 +108,49 @@ def _list_outputs(self): return outputs -class Generate5ttInputSpec(CommandLineInputSpec): +class Generate5ttInputSpec(MRTrix3BaseInputSpec): + algorithm = traits.Enum('fsl','gif','freesurfer', argstr='%s', position=-3, + mandatory=True, desc='tissue segmentation algorithm') + in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, + desc='input image') + out_file = File(argstr='%s', mandatory=True, position=-1, + desc='output image') + + +class Generate5ttOutputSpec(TraitedSpec): + out_file = File(exists=True, desc='output image') + + +class Generate5tt(MRTrix3Base): + + """ + Generate a 5TT image suitable for ACT using the selected algorithm + uhm + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> gen5tt = mrt.Generate5tt() + >>> gen5tt.inputs.in_file = 'T1.nii.gz' + >>> gen5tt.inputs.algorithm = 'fsl' + >>> gen5tt.inputs.out_file = '5tt.mif' + >>> gen5tt.cmdline # doctest: +ELLIPSIS + '5ttgen fsl T1.nii.gz 5tt.mif' + >>> gen5tt.run() # doctest: +SKIP + """ + + _cmd = '5ttgen' + input_spec = Generate5ttInputSpec + output_spec = Generate5ttOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = op.abspath(self.inputs.out_file) + return outputs + + +class Generate5ttFSLInputSpec(CommandLineInputSpec): in_fast = InputMultiPath( File(exists=True), argstr='%s', mandatory=True, position=-3, desc='list of PVE images from FAST') @@ -120,22 +162,22 @@ class Generate5ttInputSpec(CommandLineInputSpec): usedefault=True, desc='name of output file') -class Generate5ttOutputSpec(TraitedSpec): +class Generate5ttFSLOutputSpec(TraitedSpec): out_file = File(exists=True, desc='segmentation for ACT in 5tt format') -class Generate5tt(CommandLine): +class Generate5ttFSL(CommandLine): """ Concatenate segmentation results from FSL FAST and FIRST into the 5TT - format required for ACT + format required for ACT (previous MRTrix releases) Example ------- >>> import nipype.interfaces.mrtrix3 as mrt - >>> seg = mrt.Generate5tt() + >>> seg = mrt.Generate5ttFSL() >>> seg.inputs.in_fast = ['tpm_00.nii.gz', ... 'tpm_01.nii.gz', 'tpm_02.nii.gz'] >>> seg.inputs.in_first = 'first_merged.nii.gz' @@ -146,8 +188,8 @@ class Generate5tt(CommandLine): """ _cmd = '5ttgen' - input_spec = Generate5ttInputSpec - output_spec = Generate5ttOutputSpec + input_spec = Generate5ttFSLInputSpec + output_spec = Generate5ttFSLOutputSpec def _list_outputs(self): outputs = self.output_spec().get() @@ -401,3 +443,144 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs['out_file'] = op.abspath(self.inputs.out_file) return outputs + + +class DWIExtractInputSpec(MRTrix3BaseInputSpec): + in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, + desc='input image') + out_file = File(argstr='%s', mandatory=True, position=-1, + desc='output image') + bzero = traits.Bool(argstr='-bzero', desc='extract b=0 volumes') + nobzero = traits.Bool(argstr='-nobzero', desc='extract non b=0 volumes') + singleshell = traits.Bool(argstr='-singleshell', desc='extract volumes with a specific shell') + shell = traits.List(traits.Float, sep=',', argstr='-shell %s', + desc='specify one or more gradient shells') + + +class DWIExtractOutputSpec(TraitedSpec): + out_file = File(exists=True, desc='output image') + + +class DWIExtract(MRTrix3Base): + + """ + Extract diffusion-weighted volumes, b=0 volumes, or certain shells from a + DWI dataset + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> dwiextract = mrt.DWIExtract() + >>> dwiextract.inputs.in_file = 'dwi.mif' + >>> dwiextract.inputs.bzero = True + >>> dwiextract.inputs.out_file = 'b0vols.mif' + >>> dwiextract.inputs.grad_fsl = ('bvecs', 'bvals') + >>> dwiextract.cmdline # doctest: +ELLIPSIS + 'dwiextract -bzero -fslgrad bvecs bvals dwi.mif b0vols.mif' + >>> dwiextract.run() # doctest: +SKIP + """ + + _cmd = 'dwiextract' + input_spec = DWIExtractInputSpec + output_spec = DWIExtractOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = op.abspath(self.inputs.out_file) + return outputs + + +class MRConvertInputSpec(MRTrix3BaseInputSpec): + in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, + desc='input image') + out_file = File('dwi.mif', argstr='%s', mandatory=True, position=-1, + usedefault=True, desc='output image') + coord = traits.List(traits.Float, sep=' ', argstr='-coord %s', + desc='extract data at the specified coordinates') + vox = traits.List(traits.Float, sep=',', argstr='-vox %s', + desc='change the voxel dimensions') + axes = traits.List(traits.Int, sep=',', argstr='-axes %s', + desc='specify the axes that will be used') + scaling = traits.List(traits.Float, sep=',', argstr='-scaling %s', + desc='specify the data scaling parameter') + + +class MRConvertOutputSpec(TraitedSpec): + out_file = File(exists=True, desc='output image') + + +class MRConvert(MRTrix3Base): + + """ + Perform conversion between different file types and optionally extract a + subset of the input image + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> mrconvert = mrt.MRConvert() + >>> mrconvert.inputs.in_file = 'dwi.nii.gz' + >>> mrconvert.inputs.grad_fsl = ('bvecs', 'bvals') + >>> mrconvert.cmdline # doctest: +ELLIPSIS + 'mrconvert -fslgrad bvecs bvals dwi.nii.gz dwi.mif' + >>> mrconvert.run() # doctest: +SKIP + """ + + _cmd = 'mrconvert' + input_spec = MRConvertInputSpec + output_spec = MRConvertOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = op.abspath(self.inputs.out_file) + return outputs + + +class MRMathInputSpec(MRTrix3BaseInputSpec): + in_file = File(exists=True, argstr='%s', mandatory=True, position=-3, + desc='input image') + out_file = File(argstr='%s', mandatory=True, position=-1, + desc='output image') + operation = traits.Enum('mean','median','sum','product','rms','norm', + 'var','std','min','max','absmax','magmax', argstr='%s', position=-2, + mandatory=True, desc='operation to computer along a specified axis') + axis = traits.Int(0, argstr='-axis %d', + desc='specfied axis to perform the operation along') + + +class MRMathOutputSpec(TraitedSpec): + out_file = File(exists=True, desc='output image') + + +class MRMath(MRTrix3Base): + + """ + Compute summary statistic on image intensities + along a specified axis of a single image + + Example + ------- + + >>> import nipype.interfaces.mrtrix3 as mrt + >>> mrmath = mrt.MRMath() + >>> mrmath.inputs.in_file = 'dwi.mif' + >>> mrmath.inputs.operation = 'mean' + >>> mrmath.inputs.axis = 3 + >>> mrmath.inputs.out_file = 'dwi_mean.mif' + >>> mrmath.inputs.grad_fsl = ('bvecs', 'bvals') + >>> mrmath.cmdline # doctest: +ELLIPSIS + 'mrmath -axis 3 -fslgrad bvecs bvals dwi.mif mean dwi_mean.mif' + >>> mrmath.run() # doctest: +SKIP + """ + + _cmd = 'mrmath' + input_spec = MRMathInputSpec + output_spec = MRMathOutputSpec + + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = op.abspath(self.inputs.out_file) + return outputs + diff --git a/nipype/interfaces/niftyfit/asl.py b/nipype/interfaces/niftyfit/asl.py index 366f9a6eca..8f95a48192 100644 --- a/nipype/interfaces/niftyfit/asl.py +++ b/nipype/interfaces/niftyfit/asl.py @@ -147,7 +147,7 @@ class FitAsl(NiftyFitCommand): >>> from nipype.interfaces import niftyfit >>> node = niftyfit.FitAsl() >>> node.inputs.source_file = 'asl.nii.gz' - >>> node.cmdline + >>> node.cmdline 'fit_asl -source asl.nii.gz -cbf asl_cbf.nii.gz -error asl_error.nii.gz \ -syn asl_syn.nii.gz' diff --git a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py b/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py new file mode 100755 index 0000000000..635eff1c9b --- /dev/null +++ b/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py @@ -0,0 +1,60 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..patchmatch import PatchMatch + + +def test_PatchMatch_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + cs_size=dict(argstr='-cs %i', + ), + database_file=dict(argstr='-db %s', + mandatory=True, + position=3, + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-i %s', + mandatory=True, + position=1, + ), + it_num=dict(argstr='-it %i', + ), + mask_file=dict(argstr='-m %s', + mandatory=True, + position=2, + ), + match_num=dict(argstr='-match %i', + ), + out_file=dict(argstr='-o %s', + name_source=['in_file'], + name_template='%s_pm.nii.gz', + position=4, + ), + patch_size=dict(argstr='-size %i', + ), + pm_num=dict(argstr='-pm %i', + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = PatchMatch.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_PatchMatch_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = PatchMatch.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/tests/test_auto_SimpleInterface.py b/nipype/interfaces/tests/test_auto_SimpleInterface.py new file mode 100755 index 0000000000..b00d1f9a3c --- /dev/null +++ b/nipype/interfaces/tests/test_auto_SimpleInterface.py @@ -0,0 +1,16 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..base import SimpleInterface + + +def test_SimpleInterface_inputs(): + input_map = dict(ignore_exception=dict(nohash=True, + usedefault=True, + ), + ) + inputs = SimpleInterface.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + diff --git a/nipype/pipeline/engine/tests/test_utils.py b/nipype/pipeline/engine/tests/test_utils.py index 34ec45cfa8..23c7a16fc6 100644 --- a/nipype/pipeline/engine/tests/test_utils.py +++ b/nipype/pipeline/engine/tests/test_utils.py @@ -23,7 +23,7 @@ def test_identitynode_removal(tmpdir): def test_function(arg1, arg2, arg3): import numpy as np return (np.array(arg1) + arg2 + arg3).tolist() - + wf = pe.Workflow(name="testidentity", base_dir=tmpdir.strpath) From c15ba6b4cda4b1cc45a56a8dfb80d17545c1a1ed Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 29 Nov 2017 05:11:32 -0500 Subject: [PATCH 023/365] Revert "Extended MRtrix3 interface" This reverts commit bb9f5b470defe5a029f40bb47239cde918aea8fd. --- doc/users/config_file.rst | 8 +-- doc/users/plugins.rst | 4 +- nipype/algorithms/tests/test_auto_CompCor.py | 53 ---------------- nipype/algorithms/tests/test_auto_ErrorMap.py | 35 ----------- nipype/algorithms/tests/test_auto_Overlap.py | 47 --------------- nipype/algorithms/tests/test_auto_TSNR.py | 43 ------------- nipype/algorithms/tests/test_mesh_ops.py | 2 +- nipype/interfaces/afni/preprocess.py | 2 +- .../afni/tests/test_auto_TCatSubBrick.py | 48 --------------- nipype/interfaces/afni/utils.py | 2 +- nipype/interfaces/ants/resampling.py | 2 +- .../interfaces/ants/tests/test_resampling.py | 4 +- nipype/interfaces/cmtk/tests/test_nbs.py | 4 +- nipype/interfaces/niftyfit/asl.py | 2 +- .../niftyseg/tests/test_auto_PatchMatch.py | 60 ------------------- .../tests/test_auto_SimpleInterface.py | 16 ----- nipype/pipeline/engine/tests/test_utils.py | 2 +- 17 files changed, 16 insertions(+), 318 deletions(-) delete mode 100755 nipype/algorithms/tests/test_auto_CompCor.py delete mode 100755 nipype/algorithms/tests/test_auto_ErrorMap.py delete mode 100755 nipype/algorithms/tests/test_auto_Overlap.py delete mode 100755 nipype/algorithms/tests/test_auto_TSNR.py delete mode 100755 nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py delete mode 100755 nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py delete mode 100755 nipype/interfaces/tests/test_auto_SimpleInterface.py diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index 7c10a381c8..b196047e97 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index e655e5f6db..501e7aa1d6 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: diff --git a/nipype/algorithms/tests/test_auto_CompCor.py b/nipype/algorithms/tests/test_auto_CompCor.py deleted file mode 100755 index 34dacaf4d3..0000000000 --- a/nipype/algorithms/tests/test_auto_CompCor.py +++ /dev/null @@ -1,53 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..confounds import CompCor - - -def test_CompCor_inputs(): - input_map = dict(components_file=dict(usedefault=True, - ), - header_prefix=dict(), - high_pass_cutoff=dict(usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - ignore_initial_volumes=dict(usedefault=True, - ), - mask_files=dict(), - mask_index=dict(requires=['mask_files'], - xor=['merge_method'], - ), - merge_method=dict(requires=['mask_files'], - xor=['mask_index'], - ), - num_components=dict(usedefault=True, - ), - pre_filter=dict(usedefault=True, - ), - realigned_file=dict(mandatory=True, - ), - regress_poly_degree=dict(usedefault=True, - ), - repetition_time=dict(), - save_pre_filter=dict(), - use_regress_poly=dict(deprecated='0.15.0', - new_name='pre_filter', - ), - ) - inputs = CompCor.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_CompCor_outputs(): - output_map = dict(components_file=dict(), - pre_filter_file=dict(), - ) - outputs = CompCor.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_ErrorMap.py b/nipype/algorithms/tests/test_auto_ErrorMap.py deleted file mode 100755 index f3d19c5690..0000000000 --- a/nipype/algorithms/tests/test_auto_ErrorMap.py +++ /dev/null @@ -1,35 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..metrics import ErrorMap - - -def test_ErrorMap_inputs(): - input_map = dict(ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_ref=dict(mandatory=True, - ), - in_tst=dict(mandatory=True, - ), - mask=dict(), - metric=dict(mandatory=True, - usedefault=True, - ), - out_map=dict(), - ) - inputs = ErrorMap.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_ErrorMap_outputs(): - output_map = dict(distance=dict(), - out_map=dict(), - ) - outputs = ErrorMap.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_Overlap.py b/nipype/algorithms/tests/test_auto_Overlap.py deleted file mode 100755 index dcabbec296..0000000000 --- a/nipype/algorithms/tests/test_auto_Overlap.py +++ /dev/null @@ -1,47 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..misc import Overlap - - -def test_Overlap_inputs(): - input_map = dict(bg_overlap=dict(mandatory=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - mask_volume=dict(), - out_file=dict(usedefault=True, - ), - vol_units=dict(mandatory=True, - usedefault=True, - ), - volume1=dict(mandatory=True, - ), - volume2=dict(mandatory=True, - ), - weighting=dict(usedefault=True, - ), - ) - inputs = Overlap.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_Overlap_outputs(): - output_map = dict(dice=dict(), - diff_file=dict(), - jaccard=dict(), - labels=dict(), - roi_di=dict(), - roi_ji=dict(), - roi_voldiff=dict(), - volume_difference=dict(), - ) - outputs = Overlap.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_auto_TSNR.py b/nipype/algorithms/tests/test_auto_TSNR.py deleted file mode 100755 index d906d39e3f..0000000000 --- a/nipype/algorithms/tests/test_auto_TSNR.py +++ /dev/null @@ -1,43 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..misc import TSNR - - -def test_TSNR_inputs(): - input_map = dict(detrended_file=dict(hash_files=False, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(mandatory=True, - ), - mean_file=dict(hash_files=False, - usedefault=True, - ), - regress_poly=dict(), - stddev_file=dict(hash_files=False, - usedefault=True, - ), - tsnr_file=dict(hash_files=False, - usedefault=True, - ), - ) - inputs = TSNR.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_TSNR_outputs(): - output_map = dict(detrended_file=dict(), - mean_file=dict(), - stddev_file=dict(), - tsnr_file=dict(), - ) - outputs = TSNR.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/algorithms/tests/test_mesh_ops.py b/nipype/algorithms/tests/test_mesh_ops.py index d5fbc56825..9d510dee2b 100644 --- a/nipype/algorithms/tests/test_mesh_ops.py +++ b/nipype/algorithms/tests/test_mesh_ops.py @@ -15,7 +15,7 @@ @pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed") def test_ident_distances(tmpdir): - tmpdir.chdir() + tmpdir.chdir() in_surf = example_data('surf01.vtk') dist_ident = m.ComputeMeshWarp() diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 3d7d47c673..c96616273d 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -3490,7 +3490,7 @@ class Qwarp(AFNICommand): >>> qwarp3.inputs.base_file = 'mni.nii' >>> qwarp3.inputs.allineate = True >>> qwarp3.inputs.allineate_opts = '-cose lpa -verb' - >>> qwarp3.cmdline # doctest: +ALLOW_UNICODE + >>> qwarp3.cmdline "3dQwarp -allineate -allineate_opts '-cose lpa -verb' -base mni.nii -source structural.nii -prefix structural_QW" >>> res3 = qwarp3.run() # doctest: +SKIP """ _cmd = '3dQwarp' diff --git a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py deleted file mode 100755 index da3b0fb383..0000000000 --- a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py +++ /dev/null @@ -1,48 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..utils import TCatSubBrick - - -def test_TCatSubBrick_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_files=dict(argstr='%s%s ...', - copyfile=False, - mandatory=True, - position=-1, - ), - num_threads=dict(nohash=True, - usedefault=True, - ), - out_file=dict(argstr='-prefix %s', - genfile=True, - ), - outputtype=dict(), - rlt=dict(argstr='-rlt%s', - position=1, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - ) - inputs = TCatSubBrick.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_TCatSubBrick_outputs(): - output_map = dict(out_file=dict(), - ) - outputs = TCatSubBrick.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index e492b39d47..242b5077ee 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -1674,7 +1674,7 @@ class NwarpCat(AFNICommand): >>> nwarpcat = afni.NwarpCat() >>> nwarpcat.inputs.in_files = ['Q25_warp+tlrc.HEAD', ('IDENT', 'structural.nii')] >>> nwarpcat.inputs.out_file = 'Fred_total_WARP' - >>> nwarpcat.cmdline # doctest: +ALLOW_UNICODE + >>> nwarpcat.cmdline "3dNwarpCat -prefix Fred_total_WARP Q25_warp+tlrc.HEAD 'IDENT(structural.nii)'" >>> res = nwarpcat.run() # doctest: +SKIP diff --git a/nipype/interfaces/ants/resampling.py b/nipype/interfaces/ants/resampling.py index e268cb43e2..3ed60a51b1 100644 --- a/nipype/interfaces/ants/resampling.py +++ b/nipype/interfaces/ants/resampling.py @@ -75,7 +75,7 @@ class WarpTimeSeriesImageMultiTransform(ANTSCommand): >>> wtsimt.inputs.reference_image = 'ants_deformed.nii.gz' >>> wtsimt.inputs.transformation_series = ['ants_Warp.nii.gz','ants_Affine.txt'] >>> wtsimt.inputs.invert_affine = [1] # # this will invert the 1st Affine file: ants_Affine.txt - >>> wtsimt.cmdline # doctest: +ALLOW_UNICODE + >>> wtsimt.cmdline 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii -R ants_deformed.nii.gz ants_Warp.nii.gz \ -i ants_Affine.txt' """ diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index 509ebfe844..22dc4446e9 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -1,5 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- -# vi: set ft=python sts=4 ts=4 sw=4 et: +# vi: set ft=python sts=4 ts=4 sw=4 et: from nipype.interfaces.ants import WarpImageMultiTransform, WarpTimeSeriesImageMultiTransform import os @@ -66,7 +66,7 @@ def create_wtsimt(): def test_WarpTimeSeriesImageMultiTransform(change_dir, create_wtsimt): wtsimt = create_wtsimt assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ --R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' +-R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' def test_WarpTimeSeriesImageMultiTransform_invaffine(change_dir, create_wtsimt): diff --git a/nipype/interfaces/cmtk/tests/test_nbs.py b/nipype/interfaces/cmtk/tests/test_nbs.py index 03a7aa8619..0516390b02 100644 --- a/nipype/interfaces/cmtk/tests/test_nbs.py +++ b/nipype/interfaces/cmtk/tests/test_nbs.py @@ -31,12 +31,12 @@ def test_importerror(creating_graphs, tmpdir): graphlist = creating_graphs group1 = graphlist[:3] group2 = graphlist[3:] - + nbs = NetworkBasedStatistic() nbs.inputs.in_group1 = group1 nbs.inputs.in_group2 = group2 nbs.inputs.edge_key = "weight" - + with pytest.raises(ImportError) as e: nbs.run() assert "cviewer library is not available" == str(e.value) diff --git a/nipype/interfaces/niftyfit/asl.py b/nipype/interfaces/niftyfit/asl.py index 8f95a48192..366f9a6eca 100644 --- a/nipype/interfaces/niftyfit/asl.py +++ b/nipype/interfaces/niftyfit/asl.py @@ -147,7 +147,7 @@ class FitAsl(NiftyFitCommand): >>> from nipype.interfaces import niftyfit >>> node = niftyfit.FitAsl() >>> node.inputs.source_file = 'asl.nii.gz' - >>> node.cmdline + >>> node.cmdline 'fit_asl -source asl.nii.gz -cbf asl_cbf.nii.gz -error asl_error.nii.gz \ -syn asl_syn.nii.gz' diff --git a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py b/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py deleted file mode 100755 index 635eff1c9b..0000000000 --- a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py +++ /dev/null @@ -1,60 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..patchmatch import PatchMatch - - -def test_PatchMatch_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - cs_size=dict(argstr='-cs %i', - ), - database_file=dict(argstr='-db %s', - mandatory=True, - position=3, - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_file=dict(argstr='-i %s', - mandatory=True, - position=1, - ), - it_num=dict(argstr='-it %i', - ), - mask_file=dict(argstr='-m %s', - mandatory=True, - position=2, - ), - match_num=dict(argstr='-match %i', - ), - out_file=dict(argstr='-o %s', - name_source=['in_file'], - name_template='%s_pm.nii.gz', - position=4, - ), - patch_size=dict(argstr='-size %i', - ), - pm_num=dict(argstr='-pm %i', - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - ) - inputs = PatchMatch.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_PatchMatch_outputs(): - output_map = dict(out_file=dict(), - ) - outputs = PatchMatch.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/tests/test_auto_SimpleInterface.py b/nipype/interfaces/tests/test_auto_SimpleInterface.py deleted file mode 100755 index b00d1f9a3c..0000000000 --- a/nipype/interfaces/tests/test_auto_SimpleInterface.py +++ /dev/null @@ -1,16 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..base import SimpleInterface - - -def test_SimpleInterface_inputs(): - input_map = dict(ignore_exception=dict(nohash=True, - usedefault=True, - ), - ) - inputs = SimpleInterface.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - diff --git a/nipype/pipeline/engine/tests/test_utils.py b/nipype/pipeline/engine/tests/test_utils.py index 23c7a16fc6..34ec45cfa8 100644 --- a/nipype/pipeline/engine/tests/test_utils.py +++ b/nipype/pipeline/engine/tests/test_utils.py @@ -23,7 +23,7 @@ def test_identitynode_removal(tmpdir): def test_function(arg1, arg2, arg3): import numpy as np return (np.array(arg1) + arg2 + arg3).tolist() - + wf = pe.Workflow(name="testidentity", base_dir=tmpdir.strpath) From 248e589ec04f476c8e5c1fbc1878f828aa011601 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 29 Nov 2017 08:12:59 -0500 Subject: [PATCH 024/365] Updated MRtrix3 interfaces --- nipype/interfaces/mrtrix3/__init__.py | 6 +- nipype/interfaces/mrtrix3/preprocess.py | 105 +------------- nipype/interfaces/mrtrix3/reconst.py | 136 +++--------------- .../mrtrix3/tests/test_auto_DWI2FOD.py | 81 ----------- .../mrtrix3/tests/test_auto_DWI2Response.py | 75 ---------- .../mrtrix3/tests/test_auto_EstimateFOD.py | 59 +++++--- .../mrtrix3/tests/test_auto_Generate5ttFSL.py | 45 ------ .../mrtrix3/tests/test_auto_ResponseSD.py | 53 ++++--- nipype/interfaces/mrtrix3/utils.py | 49 +------ 9 files changed, 89 insertions(+), 520 deletions(-) delete mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py delete mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py delete mode 100755 nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py diff --git a/nipype/interfaces/mrtrix3/__init__.py b/nipype/interfaces/mrtrix3/__init__.py index 81749386f5..53bc8f5f53 100644 --- a/nipype/interfaces/mrtrix3/__init__.py +++ b/nipype/interfaces/mrtrix3/__init__.py @@ -3,9 +3,9 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: # -*- coding: utf-8 -*- -from .utils import (Mesh2PVE, Generate5tt, Generate5ttFSL, BrainMask, TensorMetrics, +from .utils import (Mesh2PVE, Generate5tt, BrainMask, TensorMetrics, ComputeTDI, TCK2VTK, MRMath, MRConvert, DWIExtract) -from .preprocess import DWI2Response, ResponseSD, ACTPrepareFSL, ReplaceFSwithFIRST +from .preprocess import ResponseSD, ACTPrepareFSL, ReplaceFSwithFIRST from .tracking import Tractography -from .reconst import DWI2FOD, FitTensor, EstimateFOD +from .reconst import FitTensor, EstimateFOD from .connectivity import LabelConfig, BuildConnectome diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 1159e89e7a..68be18a42c 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -21,7 +21,7 @@ from .base import MRTrix3BaseInputSpec, MRTrix3Base -class DWI2ResponseInputSpec(MRTrix3BaseInputSpec): +class ResponseSDInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum('msmt_5tt','dhollander','tournier','tax', argstr='%s', position=-6, mandatory=True, desc='response estimation algorithm (multi-tissue)') dwi_file = File(exists=True, argstr='%s', position=-5, @@ -37,13 +37,13 @@ class DWI2ResponseInputSpec(MRTrix3BaseInputSpec): desc='maximum harmonic degree of response function') -class DWI2ResponseOutputSpec(TraitedSpec): +class ResponseSDOutputSpec(TraitedSpec): wm_file = File(argstr='%s', desc='output WM response text file') gm_file = File(argstr='%s', desc='output GM response text file') csf_file = File(argstr='%s', desc='output CSF response text file') -class DWI2Response(MRTrix3Base): +class ResponseSD(MRTrix3Base): """ Estimate response function(s) for spherical deconvolution using the specified algorithm. @@ -52,7 +52,7 @@ class DWI2Response(MRTrix3Base): ------- >>> import nipype.interfaces.mrtrix3 as mrt - >>> resp = mrt.DWI2Response() + >>> resp = mrt.ResponseSD() >>> resp.inputs.dwi_file = 'dwi.mif' >>> resp.inputs.algorithm = 'tournier' >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') @@ -62,8 +62,8 @@ class DWI2Response(MRTrix3Base): """ _cmd = 'dwi2response' - input_spec = DWI2ResponseInputSpec - output_spec = DWI2ResponseOutputSpec + input_spec = ResponseSDInputSpec + output_spec = ResponseSDOutputSpec def _list_outputs(self): outputs = self.output_spec().get() @@ -75,99 +75,6 @@ def _list_outputs(self): return outputs -class ResponseSDInputSpec(MRTrix3BaseInputSpec): - in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, - desc='input diffusion weighted images') - - out_file = File( - 'response.txt', argstr='%s', mandatory=True, position=-1, - usedefault=True, desc='output file containing SH coefficients') - - # DW Shell selection options - shell = traits.List(traits.Float, sep=',', argstr='-shell %s', - desc='specify one or more dw gradient shells') - in_mask = File(exists=True, argstr='-mask %s', - desc='provide initial mask image') - max_sh = traits.Int(8, argstr='-lmax %d', - desc='maximum harmonic degree of response function') - out_sf = File('sf_mask.nii.gz', argstr='-sf %s', - desc='write a mask containing single-fibre voxels') - test_all = traits.Bool(False, argstr='-test_all', - desc='re-test all voxels at every iteration') - - # Optimization - iterations = traits.Int(0, argstr='-max_iters %d', - desc='maximum number of iterations per pass') - max_change = traits.Float( - argstr='-max_change %f', - desc=('maximum percentile change in any response function coefficient;' - ' if no individual coefficient changes by more than this ' - 'fraction, the algorithm is terminated.')) - - # Thresholds - vol_ratio = traits.Float( - .15, argstr='-volume_ratio %f', - desc=('maximal volume ratio between the sum of all other positive' - ' lobes in the voxel and the largest FOD lobe')) - disp_mult = traits.Float( - 1., argstr='-dispersion_multiplier %f', - desc=('dispersion of FOD lobe must not exceed some threshold as ' - 'determined by this multiplier and the FOD dispersion in other ' - 'single-fibre voxels. The threshold is: (mean + (multiplier * ' - '(mean - min))); default = 1.0. Criterion is only applied in ' - 'second pass of RF estimation.')) - int_mult = traits.Float( - 2., argstr='-integral_multiplier %f', - desc=('integral of FOD lobe must not be outside some range as ' - 'determined by this multiplier and FOD lobe integral in other' - ' single-fibre voxels. The range is: (mean +- (multiplier * ' - 'stdev)); default = 2.0. Criterion is only applied in second ' - 'pass of RF estimation.')) - - -class ResponseSDOutputSpec(TraitedSpec): - out_file = File(exists=True, desc='the output response file') - out_sf = File(desc=('mask containing single-fibre voxels')) - - -class ResponseSD(MRTrix3Base): - - """ - Generate an appropriate response function from the image data for - spherical deconvolution. (previous MRTrix releases) - - .. [1] Tax, C. M.; Jeurissen, B.; Vos, S. B.; Viergever, M. A. and - Leemans, A., Recursive calibration of the fiber response function - for spherical deconvolution of diffusion MRI data. NeuroImage, - 2014, 86, 67-80 - - - Example - ------- - - >>> import nipype.interfaces.mrtrix3 as mrt - >>> resp = mrt.ResponseSD() - >>> resp.inputs.in_file = 'dwi.mif' - >>> resp.inputs.in_mask = 'mask.nii.gz' - >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') - >>> resp.cmdline # doctest: +ELLIPSIS - 'dwi2response -fslgrad bvecs bvals -mask mask.nii.gz dwi.mif response.txt' - >>> resp.run() # doctest: +SKIP - """ - - _cmd = 'dwi2response' - input_spec = ResponseSDInputSpec - output_spec = ResponseSDOutputSpec - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = op.abspath(self.inputs.out_file) - - if isdefined(self.inputs.out_sf): - outputs['out_sf'] = op.abspath(self.inputs.out_sf) - return outputs - - class ACTPrepareFSLInputSpec(CommandLineInputSpec): in_file = File(exists=True, argstr='%s', mandatory=True, position=-2, desc='input anatomical image') diff --git a/nipype/interfaces/mrtrix3/reconst.py b/nipype/interfaces/mrtrix3/reconst.py index b8f2ffef63..a5ce55b506 100644 --- a/nipype/interfaces/mrtrix3/reconst.py +++ b/nipype/interfaces/mrtrix3/reconst.py @@ -73,7 +73,7 @@ def _list_outputs(self): return outputs -class DWI2FODInputSpec(MRTrix3BaseInputSpec): +class EstimateFODInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum('csd','msmt_csd', argstr='%s', position=-8, mandatory=True, desc='FOD algorithm') dwi_file = File(exists=True, argstr='%s', position=-7, @@ -88,150 +88,41 @@ class DWI2FODInputSpec(MRTrix3BaseInputSpec): csf_odf = File('csf.mif', argstr='%s', position=-1, desc='output CSF ODF') mask_file = File(exists=True, argstr='-mask %s', desc='mask image') - -class DWI2FODOutputSpec(TraitedSpec): - wm_odf = File(argstr='%s', desc='output WM ODF') - gm_odf = File(argstr='%s', desc='output GM ODF') - csf_odf = File(argstr='%s', desc='output CSF ODF') - - -class DWI2FOD(MRTrix3Base): - - """ - Estimate fibre orientation distributions from diffusion data using spherical deconvolution - - Example - ------- - - >>> import nipype.interfaces.mrtrix3 as mrt - >>> fod = mrt.DWI2FOD() - >>> fod.inputs.algorithm = 'csd' - >>> fod.inputs.dwi_file = 'dwi.mif' - >>> fod.inputs.wm_txt = 'wm.txt' - >>> fod.inputs.grad_fsl = ('bvecs', 'bvals') - >>> fod.cmdline # doctest: +ELLIPSIS - 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif' - >>> fod.run() # doctest: +SKIP - """ - - _cmd = 'dwi2fod' - input_spec = DWI2FODInputSpec - output_spec = DWI2FODOutputSpec - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['wm_odf'] = op.abspath(self.inputs.wm_odf) - if self.inputs.gm_odf!=Undefined: - outputs['gm_odf'] = op.abspath(self.inputs.gm_odf) - if self.inputs.csf_odf!=Undefined: - outputs['csf_odf'] = op.abspath(self.inputs.csf_odf) - return outputs - - -class EstimateFODInputSpec(MRTrix3BaseInputSpec): - in_file = File(exists=True, argstr='%s', mandatory=True, position=-3, - desc='input diffusion weighted images') - response = File( - exists=True, argstr='%s', mandatory=True, position=-2, - desc=('a text file containing the diffusion-weighted signal response ' - 'function coefficients for a single fibre population')) - out_file = File( - 'fods.mif', argstr='%s', mandatory=True, position=-1, - usedefault=True, desc=('the output spherical harmonics coefficients' - ' image')) - # DW Shell selection options shell = traits.List(traits.Float, sep=',', argstr='-shell %s', desc='specify one or more dw gradient shells') - - # Spherical deconvolution options max_sh = traits.Int(8, argstr='-lmax %d', desc='maximum harmonic degree of response function') - in_mask = File(exists=True, argstr='-mask %s', - desc='provide initial mask image') in_dirs = File( exists=True, argstr='-directions %s', desc=('specify the directions over which to apply the non-negativity ' 'constraint (by default, the built-in 300 direction set is ' 'used). These should be supplied as a text file containing the ' '[ az el ] pairs for the directions.')) - sh_filter = File( - exists=True, argstr='-filter %s', - desc=('the linear frequency filtering parameters used for the initial ' - 'linear spherical deconvolution step (default = [ 1 1 1 0 0 ]). ' - 'These should be supplied as a text file containing the ' - 'filtering coefficients for each even harmonic order.')) - - neg_lambda = traits.Float( - 1.0, argstr='-neg_lambda %f', - desc=('the regularisation parameter lambda that controls the strength' - ' of the non-negativity constraint')) - thres = traits.Float( - 0.0, argstr='-threshold %f', - desc=('the threshold below which the amplitude of the FOD is assumed ' - 'to be zero, expressed as an absolute amplitude')) - - n_iter = traits.Int( - 50, argstr='-niter %d', desc=('the maximum number of iterations ' - 'to perform for each voxel')) class EstimateFODOutputSpec(TraitedSpec): - out_file = File(exists=True, desc='the output response file') + wm_odf = File(argstr='%s', desc='output WM ODF') + gm_odf = File(argstr='%s', desc='output GM ODF') + csf_odf = File(argstr='%s', desc='output CSF ODF') class EstimateFOD(MRTrix3Base): """ - Convert diffusion-weighted images to tensor images - (previous MRTrix releases) - - Note that this program makes use of implied symmetries in the diffusion - profile. First, the fact the signal attenuation profile is real implies - that it has conjugate symmetry, i.e. Y(l,-m) = Y(l,m)* (where * denotes - the complex conjugate). Second, the diffusion profile should be - antipodally symmetric (i.e. S(x) = S(-x)), implying that all odd l - components should be zero. Therefore, this program only computes the even - elements. - - Note that the spherical harmonics equations used here differ slightly from - those conventionally used, in that the (-1)^m factor has been omitted. - This should be taken into account in all subsequent calculations. - The spherical harmonic coefficients are stored as follows. First, since - the signal attenuation profile is real, it has conjugate symmetry, i.e. - Y(l,-m) = Y(l,m)* (where * denotes the complex conjugate). Second, the - diffusion profile should be antipodally symmetric (i.e. S(x) = S(-x)), - implying that all odd l components should be zero. Therefore, only the - even elements are computed. - - Note that the spherical harmonics equations used here differ slightly from - those conventionally used, in that the (-1)^m factor has been omitted. - This should be taken into account in all subsequent calculations. - Each volume in the output image corresponds to a different spherical - harmonic component. Each volume will correspond to the following: - - volume 0: l = 0, m = 0 - volume 1: l = 2, m = -2 (imaginary part of m=2 SH) - volume 2: l = 2, m = -1 (imaginary part of m=1 SH) - volume 3: l = 2, m = 0 - volume 4: l = 2, m = 1 (real part of m=1 SH) - volume 5: l = 2, m = 2 (real part of m=2 SH) - etc... - - + Estimate fibre orientation distributions from diffusion data using spherical deconvolution Example ------- >>> import nipype.interfaces.mrtrix3 as mrt >>> fod = mrt.EstimateFOD() - >>> fod.inputs.in_file = 'dwi.mif' - >>> fod.inputs.response = 'response.txt' - >>> fod.inputs.in_mask = 'mask.nii.gz' + >>> fod.inputs.algorithm = 'csd' + >>> fod.inputs.dwi_file = 'dwi.mif' + >>> fod.inputs.wm_txt = 'wm.txt' >>> fod.inputs.grad_fsl = ('bvecs', 'bvals') >>> fod.cmdline # doctest: +ELLIPSIS - 'dwi2fod -fslgrad bvecs bvals -mask mask.nii.gz dwi.mif response.txt\ - fods.mif' + 'dwi2fod -fslgrad bvecs bvals csd dwi.mif wm.txt wm.mif' >>> fod.run() # doctest: +SKIP """ @@ -241,5 +132,12 @@ class EstimateFOD(MRTrix3Base): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = op.abspath(self.inputs.out_file) + outputs['wm_odf'] = op.abspath(self.inputs.wm_odf) + if self.inputs.gm_odf!=Undefined: + outputs['gm_odf'] = op.abspath(self.inputs.gm_odf) + if self.inputs.csf_odf!=Undefined: + outputs['csf_odf'] = op.abspath(self.inputs.csf_odf) return outputs + + + diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py deleted file mode 100755 index 9501fd656b..0000000000 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2FOD.py +++ /dev/null @@ -1,81 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..reconst import DWI2FOD - - -def test_DWI2FOD_inputs(): - input_map = dict(algorithm=dict(argstr='%s', - mandatory=True, - position=-8, - ), - args=dict(argstr='%s', - ), - bval_scale=dict(argstr='-bvalue_scaling %s', - ), - csf_odf=dict(argstr='%s', - position=-1, - ), - csf_txt=dict(argstr='%s', - position=-2, - ), - dwi_file=dict(argstr='%s', - mandatory=True, - position=-7, - ), - environ=dict(nohash=True, - usedefault=True, - ), - gm_odf=dict(argstr='%s', - position=-3, - ), - gm_txt=dict(argstr='%s', - position=-4, - ), - grad_file=dict(argstr='-grad %s', - ), - grad_fsl=dict(argstr='-fslgrad %s %s', - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_bval=dict(), - in_bvec=dict(argstr='-fslgrad %s %s', - ), - mask_file=dict(argstr='-mask %s', - ), - nthreads=dict(argstr='-nthreads %d', - nohash=True, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - wm_odf=dict(argstr='%s', - mandatory=True, - position=-5, - usedefault=True, - ), - wm_txt=dict(argstr='%s', - mandatory=True, - position=-6, - ), - ) - inputs = DWI2FOD.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_DWI2FOD_outputs(): - output_map = dict(csf_odf=dict(argstr='%s', - ), - gm_odf=dict(argstr='%s', - ), - wm_odf=dict(argstr='%s', - ), - ) - outputs = DWI2FOD.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py deleted file mode 100755 index 5b0836f79b..0000000000 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWI2Response.py +++ /dev/null @@ -1,75 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..preprocess import DWI2Response - - -def test_DWI2Response_inputs(): - input_map = dict(algorithm=dict(argstr='%s', - mandatory=True, - position=-6, - ), - args=dict(argstr='%s', - ), - bval_scale=dict(argstr='-bvalue_scaling %s', - ), - csf_file=dict(argstr='%s', - position=-1, - ), - dwi_file=dict(argstr='%s', - mandatory=True, - position=-5, - ), - environ=dict(nohash=True, - usedefault=True, - ), - gm_file=dict(argstr='%s', - position=-2, - ), - grad_file=dict(argstr='-grad %s', - ), - grad_fsl=dict(argstr='-fslgrad %s %s', - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_bval=dict(), - in_bvec=dict(argstr='-fslgrad %s %s', - ), - in_mask=dict(argstr='-mask %s', - ), - max_sh=dict(argstr='-lmax %d', - ), - mtt_file=dict(argstr='%s', - position=-4, - ), - nthreads=dict(argstr='-nthreads %d', - nohash=True, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - wm_file=dict(argstr='%s', - position=-3, - usedefault=True, - ), - ) - inputs = DWI2Response.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_DWI2Response_outputs(): - output_map = dict(csf_file=dict(argstr='%s', - ), - gm_file=dict(argstr='%s', - ), - wm_file=dict(argstr='%s', - ), - ) - outputs = DWI2Response.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py b/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py index f645703bba..98f59fbc7a 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py @@ -4,13 +4,33 @@ def test_EstimateFOD_inputs(): - input_map = dict(args=dict(argstr='%s', + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-8, + ), + args=dict(argstr='%s', ), bval_scale=dict(argstr='-bvalue_scaling %s', ), + csf_odf=dict(argstr='%s', + position=-1, + ), + csf_txt=dict(argstr='%s', + position=-2, + ), + dwi_file=dict(argstr='%s', + mandatory=True, + position=-7, + ), environ=dict(nohash=True, usedefault=True, ), + gm_odf=dict(argstr='%s', + position=-3, + ), + gm_txt=dict(argstr='%s', + position=-4, + ), grad_file=dict(argstr='-grad %s', ), grad_fsl=dict(argstr='-fslgrad %s %s', @@ -23,39 +43,27 @@ def test_EstimateFOD_inputs(): ), in_dirs=dict(argstr='-directions %s', ), - in_file=dict(argstr='%s', - mandatory=True, - position=-3, - ), - in_mask=dict(argstr='-mask %s', + mask_file=dict(argstr='-mask %s', ), max_sh=dict(argstr='-lmax %d', ), - n_iter=dict(argstr='-niter %d', - ), - neg_lambda=dict(argstr='-neg_lambda %f', - ), nthreads=dict(argstr='-nthreads %d', nohash=True, ), - out_file=dict(argstr='%s', - mandatory=True, - position=-1, - usedefault=True, - ), - response=dict(argstr='%s', - mandatory=True, - position=-2, - ), - sh_filter=dict(argstr='-filter %s', - ), shell=dict(argstr='-shell %s', sep=',', ), terminal_output=dict(deprecated='1.0.0', nohash=True, ), - thres=dict(argstr='-threshold %f', + wm_odf=dict(argstr='%s', + mandatory=True, + position=-5, + usedefault=True, + ), + wm_txt=dict(argstr='%s', + mandatory=True, + position=-6, ), ) inputs = EstimateFOD.input_spec() @@ -66,7 +74,12 @@ def test_EstimateFOD_inputs(): def test_EstimateFOD_outputs(): - output_map = dict(out_file=dict(), + output_map = dict(csf_odf=dict(argstr='%s', + ), + gm_odf=dict(argstr='%s', + ), + wm_odf=dict(argstr='%s', + ), ) outputs = EstimateFOD.output_spec() diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py deleted file mode 100755 index 97617fa2cc..0000000000 --- a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5ttFSL.py +++ /dev/null @@ -1,45 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..utils import Generate5ttFSL - - -def test_Generate5ttFSL_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_fast=dict(argstr='%s', - mandatory=True, - position=-3, - ), - in_first=dict(argstr='%s', - position=-2, - ), - out_file=dict(argstr='%s', - mandatory=True, - position=-1, - usedefault=True, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - ) - inputs = Generate5ttFSL.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_Generate5ttFSL_outputs(): - output_map = dict(out_file=dict(), - ) - outputs = Generate5ttFSL.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py index 4a4aeb153e..7bd633fe29 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py @@ -4,15 +4,27 @@ def test_ResponseSD_inputs(): - input_map = dict(args=dict(argstr='%s', + input_map = dict(algorithm=dict(argstr='%s', + mandatory=True, + position=-6, + ), + args=dict(argstr='%s', ), bval_scale=dict(argstr='-bvalue_scaling %s', ), - disp_mult=dict(argstr='-dispersion_multiplier %f', + csf_file=dict(argstr='%s', + position=-1, + ), + dwi_file=dict(argstr='%s', + mandatory=True, + position=-5, ), environ=dict(nohash=True, usedefault=True, ), + gm_file=dict(argstr='%s', + position=-2, + ), grad_file=dict(argstr='-grad %s', ), grad_fsl=dict(argstr='-fslgrad %s %s', @@ -23,39 +35,22 @@ def test_ResponseSD_inputs(): in_bval=dict(), in_bvec=dict(argstr='-fslgrad %s %s', ), - in_file=dict(argstr='%s', - mandatory=True, - position=-2, - ), in_mask=dict(argstr='-mask %s', ), - int_mult=dict(argstr='-integral_multiplier %f', - ), - iterations=dict(argstr='-max_iters %d', - ), - max_change=dict(argstr='-max_change %f', - ), max_sh=dict(argstr='-lmax %d', ), + mtt_file=dict(argstr='%s', + position=-4, + ), nthreads=dict(argstr='-nthreads %d', nohash=True, ), - out_file=dict(argstr='%s', - mandatory=True, - position=-1, - usedefault=True, - ), - out_sf=dict(argstr='-sf %s', - ), - shell=dict(argstr='-shell %s', - sep=',', - ), terminal_output=dict(deprecated='1.0.0', nohash=True, ), - test_all=dict(argstr='-test_all', - ), - vol_ratio=dict(argstr='-volume_ratio %f', + wm_file=dict(argstr='%s', + position=-3, + usedefault=True, ), ) inputs = ResponseSD.input_spec() @@ -66,8 +61,12 @@ def test_ResponseSD_inputs(): def test_ResponseSD_outputs(): - output_map = dict(out_file=dict(), - out_sf=dict(), + output_map = dict(csf_file=dict(argstr='%s', + ), + gm_file=dict(argstr='%s', + ), + wm_file=dict(argstr='%s', + ), ) outputs = ResponseSD.output_spec() diff --git a/nipype/interfaces/mrtrix3/utils.py b/nipype/interfaces/mrtrix3/utils.py index 18397823a7..b8bac5dadb 100644 --- a/nipype/interfaces/mrtrix3/utils.py +++ b/nipype/interfaces/mrtrix3/utils.py @@ -125,7 +125,7 @@ class Generate5tt(MRTrix3Base): """ Generate a 5TT image suitable for ACT using the selected algorithm - uhm + Example ------- @@ -150,53 +150,6 @@ def _list_outputs(self): return outputs -class Generate5ttFSLInputSpec(CommandLineInputSpec): - in_fast = InputMultiPath( - File(exists=True), argstr='%s', mandatory=True, position=-3, - desc='list of PVE images from FAST') - in_first = File( - exists=True, argstr='%s', position=-2, - desc='combined segmentation file from FIRST') - out_file = File( - 'act-5tt.mif', argstr='%s', mandatory=True, position=-1, - usedefault=True, desc='name of output file') - - -class Generate5ttFSLOutputSpec(TraitedSpec): - out_file = File(exists=True, desc='segmentation for ACT in 5tt format') - - -class Generate5ttFSL(CommandLine): - - """ - Concatenate segmentation results from FSL FAST and FIRST into the 5TT - format required for ACT (previous MRTrix releases) - - - Example - ------- - - >>> import nipype.interfaces.mrtrix3 as mrt - >>> seg = mrt.Generate5ttFSL() - >>> seg.inputs.in_fast = ['tpm_00.nii.gz', - ... 'tpm_01.nii.gz', 'tpm_02.nii.gz'] - >>> seg.inputs.in_first = 'first_merged.nii.gz' - >>> seg.cmdline # doctest: +ELLIPSIS - '5ttgen tpm_00.nii.gz tpm_01.nii.gz tpm_02.nii.gz first_merged.nii.gz\ - act-5tt.mif' - >>> seg.run() # doctest: +SKIP - """ - - _cmd = '5ttgen' - input_spec = Generate5ttFSLInputSpec - output_spec = Generate5ttFSLOutputSpec - - def _list_outputs(self): - outputs = self.output_spec().get() - outputs['out_file'] = op.abspath(self.inputs.out_file) - return outputs - - class TensorMetricsInputSpec(CommandLineInputSpec): in_file = File(exists=True, argstr='%s', mandatory=True, position=-1, desc='input DTI image') From 5cb476ebde884da78dd67ecd0fcb611e6819a6c5 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 1 Dec 2017 13:55:32 -0800 Subject: [PATCH 025/365] revert changes to plugin base - make in different PR --- nipype/pipeline/plugins/base.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nipype/pipeline/plugins/base.py b/nipype/pipeline/plugins/base.py index 5bb03ef3d9..bab2812903 100644 --- a/nipype/pipeline/plugins/base.py +++ b/nipype/pipeline/plugins/base.py @@ -339,7 +339,7 @@ def _local_hash_check(self, jobid, graph): logger.debug('Skipping cached node %s with ID %s.', self.procs[jobid]._id, jobid) try: - self._task_finished_cb(jobid, cached=True) + self._task_finished_cb(jobid) self._remove_node_dirs() except Exception: logger.debug('Error skipping cached node %s (%s).', @@ -349,14 +349,13 @@ def _local_hash_check(self, jobid, graph): return True return False - def _task_finished_cb(self, jobid, cached=False): + def _task_finished_cb(self, jobid): """ Extract outputs and assign to inputs of dependent tasks This is called when a job is completed. """ - logger.info('[Job %d] %s (%s).', jobid, - 'Cached' if cached else 'Completed', - self.procs[jobid].fullname) + logger.info('[Job finished] jobname: %s jobid: %d' % + (self.procs[jobid]._id, jobid)) if self._status_callback: self._status_callback(self.procs[jobid], 'end') # Update job and worker queues From 5f875269dc80bc70fb8d4df6c94291d83b1ee264 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 1 Dec 2017 14:02:52 -0800 Subject: [PATCH 026/365] revert changes to multiproc - to another PR --- nipype/pipeline/plugins/multiproc.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/nipype/pipeline/plugins/multiproc.py b/nipype/pipeline/plugins/multiproc.py index 8201a2548f..b26d029518 100644 --- a/nipype/pipeline/plugins/multiproc.py +++ b/nipype/pipeline/plugins/multiproc.py @@ -12,11 +12,10 @@ from multiprocessing import Process, Pool, cpu_count, pool from traceback import format_exception import sys -from textwrap import indent -from logging import INFO from copy import deepcopy import numpy as np + from ... import logging from ...utils.profiler import get_system_total_memory_gb from ..engine import MapNode @@ -127,7 +126,7 @@ def __init__(self, plugin_args=None): self.raise_insufficient = self.plugin_args.get('raise_insufficient', True) # Instantiate different thread pools for non-daemon processes - logger.debug('[MultiProc] Starting in "%sdaemon" mode (n_procs=%d, mem_gb=%0.2f)', + logger.debug('MultiProcPlugin starting in "%sdaemon" mode (n_procs=%d, mem_gb=%0.2f)', 'non' * int(non_daemon), self.processors, self.memory_gb) NipypePool = NonDaemonPool if non_daemon else Pool @@ -159,7 +158,7 @@ def _submit_job(self, node, updatehash=False): run_node, (node, updatehash, self._taskid), callback=self._async_callback) - logger.debug('[MultiProc] Submitted task %s (taskid=%d).', + logger.debug('MultiProc submitted task %s (taskid=%d).', node.fullname, self._taskid) return self._taskid @@ -215,17 +214,9 @@ def _send_procs_to_workers(self, updatehash=False, graph=None): stats = (len(self.pending_tasks), len(jobids), free_memory_gb, self.memory_gb, free_processors, self.processors) if self._stats != stats: - tasks_list_msg = '' - if logger.level <= INFO: - running_tasks = [' * %s' % self.procs[jobid].fullname - for _, jobid in self.pending_tasks] - if running_tasks: - tasks_list_msg = '\nCurrently running:\n' - tasks_list_msg += '\n'.join(running_tasks) - tasks_list_msg = indent(tasks_list_msg, ' ' * 21) - logger.info('[MultiProc] Running %d tasks, and %d jobs ready. Free ' - 'memory (GB): %0.2f/%0.2f, Free processors: %d/%d.%s', - *stats, tasks_list_msg) + logger.info('Currently running %d tasks, and %d jobs ready. Free ' + 'memory (GB): %0.2f/%0.2f, Free processors: %d/%d', + *stats) self._stats = stats if free_memory_gb < 0.01 or free_processors == 0: From 7e66b0463a8fda696efff5d2ff30324bbbd33668 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 1 Dec 2017 14:07:56 -0800 Subject: [PATCH 027/365] take switch and loggin outside try except --- nipype/utils/filemanip.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 4fe697d63a..aa59b47a0d 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -680,14 +680,14 @@ def makedirs(path, exist_ok=False): return path # this odd approach deals with concurrent directory cureation - try: - if not os.path.exists(os.path.abspath(path)): - fmlogger.debug("Creating directory %s", path) + if not os.path.exists(os.path.abspath(path)): + fmlogger.debug("Creating directory %s", path) + try: os.makedirs(path) - except OSError: - fmlogger.debug("Problem creating directory %s", path) - if not os.path.exists(path): - raise OSError('Could not create directory %s' % path) + except OSError: + fmlogger.debug("Problem creating directory %s", path) + if not os.path.exists(path): + raise OSError('Could not create directory %s' % path) return path From 15b13ea3d23f398185ff3a51589dd68a6561da83 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 1 Dec 2017 14:53:44 -0800 Subject: [PATCH 028/365] pep8 fixups --- nipype/pipeline/engine/utils.py | 50 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index 0c9c53afa9..67c9aaa607 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -4,27 +4,24 @@ """Utility routines for workflow graphs """ from __future__ import print_function, division, unicode_literals, absolute_import -from builtins import str, open, map, next, zip, range +from builtins import str, open, next, zip, range +import os import sys -from future import standard_library -standard_library.install_aliases() +import pickle from collections import defaultdict - +import re from copy import deepcopy from glob import glob +from distutils.version import LooseVersion + try: from inspect import signature except ImportError: from funcsigs import signature -import os -import re -import pickle from functools import reduce import numpy as np -from distutils.version import LooseVersion - import networkx as nx from ...utils.filemanip import (fname_presuffix, FileNotFoundError, to_str, @@ -37,6 +34,9 @@ from ...utils.provenance import ProvStore, pm, nipype_ns, get_id from ... import logging, config +from future import standard_library + +standard_library.install_aliases() logger = logging.getLogger('workflow') PY3 = sys.version_info[0] > 2 @@ -262,8 +262,6 @@ def _write_detailed_dot(graph, dotfilename): text = ['digraph structs {', 'node [shape=record];'] # write nodes edges = [] - replacefunk = lambda x: x.replace('_', '').replace('.', ''). \ - replace('@', '').replace('-', '') for n in nx.topological_sort(graph): nodename = str(n) inports = [] @@ -274,18 +272,16 @@ def _write_detailed_dot(graph, dotfilename): else: outport = cd[0][0] inport = cd[1] - ipstrip = 'in' + replacefunk(inport) - opstrip = 'out' + replacefunk(outport) + ipstrip = 'in%s' % _replacefunk(inport) + opstrip = 'out%s' % _replacefunk(outport) edges.append('%s:%s:e -> %s:%s:w;' % (str(u).replace('.', ''), opstrip, str(v).replace('.', ''), ipstrip)) if inport not in inports: inports.append(inport) - inputstr = '{IN' - for ip in sorted(inports): - inputstr += '| %s' % (replacefunk(ip), ip) - inputstr += '}' + inputstr = ['{IN'] + ['| %s' % (_replacefunk(ip), ip) + for ip in sorted(inports)] + ['}'] outports = [] for u, v, d in graph.out_edges(nbunch=n, data=True): for cd in d['connect']: @@ -295,10 +291,8 @@ def _write_detailed_dot(graph, dotfilename): outport = cd[0][0] if outport not in outports: outports.append(outport) - outputstr = '{OUT' - for op in sorted(outports): - outputstr += '| %s' % (replacefunk(op), op) - outputstr += '}' + outputstr = ['{OUT'] + ['| %s' % (_replacefunk(oport), oport) + for oport in sorted(outports)] + ['}'] srcpackage = '' if hasattr(n, '_interface'): pkglist = n._interface.__class__.__module__.split('.') @@ -309,19 +303,23 @@ def _write_detailed_dot(graph, dotfilename): srcpackage, srchierarchy) text += ['%s [label="%s|%s|%s"];' % (nodename.replace('.', ''), - inputstr, + ''.join(inputstr), nodenamestr, - outputstr)] + ''.join(outputstr))] # write edges for edge in sorted(edges): text.append(edge) text.append('}') - filep = open(dotfilename, 'wt') - filep.write('\n'.join(text)) - filep.close() + with open(dotfilename, 'wt') as filep: + filep.write('\n'.join(text)) return text +def _replacefunk(x): + return x.replace('_', '').replace( + '.', '').replace('@', '').replace('-', '') + + # Graph manipulations for iterable expansion def _get_valid_pathstr(pathstr): """Remove disallowed characters from path From 02dba98341334b97fdc9fbcd26b64083158eabfa Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 1 Dec 2017 15:01:54 -0800 Subject: [PATCH 029/365] tidy up imports, fix pep8 issues --- nipype/pipeline/engine/workflows.py | 72 ++++++++++++----------------- 1 file changed, 30 insertions(+), 42 deletions(-) diff --git a/nipype/pipeline/engine/workflows.py b/nipype/pipeline/engine/workflows.py index 35869e214f..fe7b0e38ce 100644 --- a/nipype/pipeline/engine/workflows.py +++ b/nipype/pipeline/engine/workflows.py @@ -15,50 +15,38 @@ """ from __future__ import print_function, division, unicode_literals, absolute_import -from builtins import range, object, str, bytes, open - -# Py2 compat: http://python-future.org/compatible_idioms.html#collections-counter-and-ordereddict -from future import standard_library -standard_library.install_aliases() +from builtins import str, bytes, open +import os +import os.path as op +import sys from datetime import datetime - from copy import deepcopy import pickle -import os -import os.path as op import shutil -import sys from warnings import warn import numpy as np import networkx as nx - from ... import config, logging - -from ...utils.misc import (unflatten, str2bool) +from ...utils.misc import str2bool from ...utils.functions import (getsource, create_function_from_source) -from ...interfaces.base import (traits, InputMultiPath, CommandLine, - Undefined, TraitedSpec, DynamicTraitedSpec, - Bunch, InterfaceResult, md5, Interface, - TraitDictObject, TraitListObject, isdefined) - -from ...utils.filemanip import (save_json, FileNotFoundError, - filename_to_list, list_to_filename, - copyfiles, fnames_presuffix, loadpkl, - split_filename, load_json, makedirs, savepkl, - write_rst_header, write_rst_dict, - write_rst_list, to_str) -from .utils import (generate_expanded_graph, modify_paths, - export_graph, write_workflow_prov, - write_workflow_resources, - clean_working_directory, format_dot, topological_sort, - get_print_name, merge_dict, evaluate_connect_function, - _write_inputs, format_node) +from ...interfaces.base import ( + traits, TraitedSpec, TraitDictObject, TraitListObject) +from ...utils.filemanip import save_json, makedirs, to_str +from .utils import ( + generate_expanded_graph, export_graph, write_workflow_prov, + write_workflow_resources, format_dot, topological_sort, + get_print_name, merge_dict, format_node +) from .base import EngineBase -from .nodes import Node, MapNode +from .nodes import MapNode + +# Py2 compat: http://python-future.org/compatible_idioms.html#collections-counter-and-ordereddict +from future import standard_library +standard_library.install_aliases() logger = logging.getLogger('workflow') @@ -202,16 +190,16 @@ def connect(self, *args, **kwargs): connected. """ % (srcnode, source, destnode, dest, dest, destnode)) if not (hasattr(destnode, '_interface') and - ('.io' in str(destnode._interface.__class__) or - any(['.io' in str(val) for val in - destnode._interface.__class__.__bases__])) + ('.io' in str(destnode._interface.__class__) or + any(['.io' in str(val) for val in + destnode._interface.__class__.__bases__])) ): if not destnode._check_inputs(dest): not_found.append(['in', destnode.name, dest]) if not (hasattr(srcnode, '_interface') and - ('.io' in str(srcnode._interface.__class__) - or any(['.io' in str(val) for val in - srcnode._interface.__class__.__bases__]))): + ('.io' in str(srcnode._interface.__class__) or + any(['.io' in str(val) + for val in srcnode._interface.__class__.__bases__]))): if isinstance(source, tuple): # handles the case that source is specified # with a function @@ -930,13 +918,13 @@ def _get_dot(self, prefix=None, hierarchy=None, colored=False, prefix = ' ' if hierarchy is None: hierarchy = [] - colorset = ['#FFFFC8', # Y - '#0000FF', '#B4B4FF', '#E6E6FF', # B - '#FF0000', '#FFB4B4', '#FFE6E6', # R - '#00A300', '#B4FFB4', '#E6FFE6', # G - '#0000FF', '#B4B4FF'] # loop B + colorset = ['#FFFFC8', # Y + '#0000FF', '#B4B4FF', '#E6E6FF', # B + '#FF0000', '#FFB4B4', '#FFE6E6', # R + '#00A300', '#B4FFB4', '#E6FFE6', # G + '#0000FF', '#B4B4FF'] # loop B if level > len(colorset) - 2: - level = 3 # Loop back to blue + level = 3 # Loop back to blue dotlist = ['%slabel="%s";' % (prefix, self.name)] for node in nx.topological_sort(self._graph): From 54673763df550045437655906b6b65f83e474d8d Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 1 Dec 2017 15:09:35 -0800 Subject: [PATCH 030/365] add some comments [skip ci] --- nipype/pipeline/engine/nodes.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 527e592c10..84f632dc1f 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -307,7 +307,7 @@ def run(self, updatehash=False): updatehash: boolean Update the hash stored in the output directory """ - cwd = os.getcwd() + cwd = os.getcwd() # First thing, keep track of where we are if self.config is None: self.config = {} @@ -327,6 +327,7 @@ def run(self, updatehash=False): makedirs(outdir, exist_ok=True) os.chdir(outdir) + # Check hash, check whether run should be enforced logger.info('[Node] Setting-up "%s" in "%s".', self.fullname, outdir) hash_info = self.hash_exists(updatehash=updatehash) hash_exists, hashvalue, hashfile, hashed_inputs = hash_info @@ -359,7 +360,7 @@ def run(self, updatehash=False): if need_rerun: log_debug = config.get('logging', 'workflow_level') == 'DEBUG' logger.debug('[Node] Rerunning "%s"', self.fullname) - if log_debug and not hash_exists: + if log_debug and not hash_exists: # Lazy logging - only debug exp_hash_paths = glob(json_pat) if len(exp_hash_paths) == 1: split_out = split_filename(exp_hash_paths[0]) @@ -375,9 +376,10 @@ def run(self, updatehash=False): hashed_inputs) if not force_run and str2bool(self.config['execution']['stop_on_first_rerun']): raise Exception('Cannot rerun when "stop_on_first_rerun" is set to True') - hashfile_unfinished = op.join(outdir, - '_0x%s_unfinished.json' % - hashvalue) + + # Hashfile while running, remove if exists already + hashfile_unfinished = op.join( + outdir, '_0x%s_unfinished.json' % hashvalue) if op.exists(hashfile): os.remove(hashfile) @@ -396,6 +398,7 @@ def run(self, updatehash=False): for filename in glob(op.join(outdir, '_0x*.json')): os.remove(filename) + # Store runtime-hashfile, pre-execution report, the node and the inputs set. self._save_hashfile(hashfile_unfinished, hashed_inputs) self.write_report(report_type='preexec', cwd=outdir) savepkl(op.join(outdir, '_node.pklz'), self) @@ -405,11 +408,12 @@ def run(self, updatehash=False): self._run_interface(execute=True) except: logger.warning('[Node] Exception "%s" (%s)', self.fullname, outdir) + # Tear-up after error os.remove(hashfile_unfinished) os.chdir(cwd) raise - # Tear-up + # Tear-up after success shutil.move(hashfile_unfinished, hashfile) self.write_report(report_type='postexec', cwd=outdir) logger.info('[Node] Finished "%s".', self.fullname) From 78821e465002ba34e5df63b73693512708b6fa15 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Fri, 1 Dec 2017 18:04:47 -0800 Subject: [PATCH 031/365] returned to .nii.gz; will deal with .nii later --- nipype/interfaces/dtitk/registration.py | 51 +++++++++++++++---------- nipype/interfaces/dtitk/utils.py | 10 ++--- stderr.nipype | 3 ++ stdout.nipype | 3 ++ 4 files changed, 41 insertions(+), 26 deletions(-) create mode 100644 stderr.nipype create mode 100644 stdout.nipype diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 7c8608cf0a..6bea8d31b2 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -44,7 +44,7 @@ class RigidTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.RigidTask() >>> node.inputs.fixed_file = 'diffusion.nii.gz' - >>> node.inputs.moving_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion2.nii.gz' >>> node.inputs.similarity_metric = 'EDS' >>> node.inputs.samplingX = 4 >>> node.inputs.samplingY = 4 @@ -106,7 +106,7 @@ class AffineTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.AffineTask() >>> node.inputs.fixed_file = 'diffusion.nii.gz' - >>> node.inputs.moving_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion2.nii.gz' >>> node.inputs.similarity_metric = 'EDS' >>> node.inputs.samplingX = 4 >>> node.inputs.samplingY = 4 @@ -129,16 +129,23 @@ def _list_outputs(self): class DiffeoInputSpec(CommandLineInputSpec): - in_fixed_tensor = traits.Str(desc="fixed diffusion tensor image", - exists=True, mandatory=False, position=0, - argstr="%s") - in_moving_txt = traits.Str(desc="moving list of diffusion tensor image " - "paths", exists=True, mandatory=False, - position=1, argstr="%s") - in_mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, - argstr="%s") - in_numbers = traits.Str(desc='#iters ftol', exists=True, mandatory=False, - position=3, argstr="%s") + fixed_file = traits.Str(desc="fixed diffusion tensor image", + exists=True, mandatory=False, position=0, + argstr="%s") + moving_file = traits.Str(desc="moving diffusion tensor image", + exists=True, mandatory=False, + position=1, argstr="%s") + mask = traits.Str(desc="mask", exists=True, mandatory=False, position=2, + argstr="%s") + legacy = traits.Float(desc="legacy parameter; always set to 1", + exists=True, mandatory=True, + position=3, default_value=1, argstr="%s") + n_iters = traits.Float(desc="number of iterations", + exists=True, mandatory=True, + position=4, default_value=6, argstr="%s") + ftol = traits.Float(desc="iteration for the optimization to stop", + exists=True, mandatory=True, + position=5, default_value=0.002, argstr="%s") class DiffeoOutputSpec(TraitedSpec): @@ -155,22 +162,24 @@ class DiffeoTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.DiffeoTask() - >>> node.inputs.in_fixed_tensor = 'diffusion.nii' - >>> node.inputs.in_moving_txt = 'dirs.txt' - >>> node.inputs.in_mask = 'mask.nii' - >>> node.inputs.in_numbers = '6 0.002' + >>> node.inputs.fixed_file = 'diffusion.nii.gz' + >>> node.inputs.moving_file = 'diffusion2.nii.gz' + >>> node.inputs.mask = 'mask.nii.gz' + >>> node.inputs.legacy = 1 + >>> node.inputs.n_iters = 6 + >>> node.inputs.ftol = 0.002 >>> node.run() # doctest: +SKIP """ input_spec = DiffeoInputSpec output_spec = DiffeoOutputSpec - _cmd = 'dti_diffeomorphic_sn' + _cmd = 'dti_diffeomorphic_reg' def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file_xfm'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz', '_aff_diffeo.df.nii.gz') - outputs['out_file'] = self.inputs.in_fixed_tensor.replace( - '.nii.gz', '_aff_diffeo.nii.gz') + outputs['out_file_xfm'] = self.inputs.moving_file.replace( + '.nii.gz', '_diffeo.df.nii.gz') + outputs['out_file'] = self.inputs.moving_file.replace( + '.nii.gz', '_diffeo.nii.gz') return outputs diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 9e036597e7..354ca165db 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -138,7 +138,7 @@ class SVAdjustVoxSpTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.SVAdjustVoxSpTask() - >>> node.inputs.in_file = 'diffusion.nii' + >>> node.inputs.in_file = 'diffusion.nii.gz' >>> node.run() # doctest: +SKIP """ input_spec = SVAdjustVoxSpInputSpec @@ -156,8 +156,8 @@ def _list_outputs(self): outputs['out_file'] = self.inputs.out_file if not isdefined(self.inputs.out_file): outputs["out_file"] = self._gen_filename(self.inputs.in_file, - suffix=self._suffix, - ext='.' + '.'.join( + suffix=self._suffix, + ext='.' + '.'.join( self.inputs.in_file. split(".")[1:])) outputs["out_file"] = os.path.abspath(outputs["out_file"]) @@ -171,7 +171,7 @@ class TVResampleInputSpec(CommandLineInputSpec): mandatory=False, position=1, argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, + out_file = traits.Str(desc='output path', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_file", name_template="%s_resampled.nii.gz") @@ -190,7 +190,7 @@ class TVResampleTask(CommandLineDtitk): >>> import nipype.interfaces.dtitk as dtitk >>> node = dtitk.TVResampleTask() - >>> node.inputs.in_file = 'diffusion.nii' + >>> node.inputs.in_file = 'diffusion.nii.gz' >>> node.run() # doctest: +SKIP """ input_spec = TVResampleInputSpec diff --git a/stderr.nipype b/stderr.nipype new file mode 100644 index 0000000000..5de72f2f86 --- /dev/null +++ b/stderr.nipype @@ -0,0 +1,3 @@ +/Users/kesshijordan/repos/dtitk-2.3.3-Darwin-x86_64/scripts/dti_diffeomorphic_reg: line 191: [: 1.0: integer expression expected +/Users/kesshijordan/repos/dtitk-2.3.3-Darwin-x86_64/scripts/dti_diffeomorphic_reg: line 197: [: 6.0: integer expression expected +/Users/kesshijordan/repos/dtitk-2.3.3-Darwin-x86_64/scripts/dti_diffeomorphic_reg: line 205: [: 6.0: integer expression expected diff --git a/stdout.nipype b/stdout.nipype new file mode 100644 index 0000000000..a9c6c87468 --- /dev/null +++ b/stdout.nipype @@ -0,0 +1,3 @@ +registering /Users/kesshijordan/ref_data/interscan_dys/Trio/IC004-1_dti_b2000_EC_tensorx1000_aff.nii.gz to /Users/kesshijordan/ref_data/interscan_dys/Prisma/IC004-4_dti_b2500_SC_EC_tensorx1000.nii.gz ... +starting at Mon Oct 30 18:05:41 PDT 2017 +ending at Mon Oct 30 18:05:41 PDT 2017 From e049918796beb2cc2032aaf6753ac6a057921fb6 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Sat, 2 Dec 2017 18:39:08 -0800 Subject: [PATCH 032/365] use new makedirs --- nipype/pipeline/engine/nodes.py | 6 +++--- nipype/pipeline/engine/utils.py | 11 ++++++----- nipype/pipeline/engine/workflows.py | 5 ++--- nipype/pipeline/plugins/tools.py | 5 ++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 84f632dc1f..b64801f8c7 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -684,7 +684,7 @@ def _copyfiles_to_wd(self, outdir, execute, linksonly=False): if execute and linksonly: olddir = outdir outdir = op.join(outdir, '_tempinput') - os.makedirs(outdir) + makedirs(outdir, exist_ok=True) for info in self._interface._get_filecopy_info(): files = self.inputs.get().get(info['key']) if not isdefined(files): @@ -725,8 +725,8 @@ def write_report(self, report_type=None, cwd=None): return report_dir = op.join(cwd, '_report') report_file = op.join(report_dir, 'report.rst') - if not op.exists(report_dir): - os.makedirs(report_dir) + makedirs(report_dir, exist_ok=True) + if report_type == 'preexec': logger.debug('writing pre-exec report to %s', report_file) fp = open(report_file, 'wt') diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index 67c9aaa607..5c223329ff 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -24,8 +24,9 @@ import numpy as np import networkx as nx -from ...utils.filemanip import (fname_presuffix, FileNotFoundError, to_str, - filename_to_list, get_related_files) +from ...utils.filemanip import ( + makedirs, fname_presuffix, to_str, + filename_to_list, get_related_files) from ...utils.misc import str2bool from ...utils.functions import create_function_from_source from ...interfaces.base import (CommandLine, isdefined, Undefined, @@ -195,7 +196,7 @@ def modify_paths(object, relative=True, basedir=None): else: out = os.path.abspath(os.path.join(basedir, object)) if not os.path.exists(out): - raise FileNotFoundError('File %s not found' % out) + raise IOError('File %s not found' % out) else: out = object return out @@ -1013,8 +1014,8 @@ def export_graph(graph_in, base_dir=None, show=False, use_execgraph=False, logger.debug('using input graph') if base_dir is None: base_dir = os.getcwd() - if not os.path.exists(base_dir): - os.makedirs(base_dir) + + makedirs(base_dir, exist_ok=True) outfname = fname_presuffix(dotfilename, suffix='_detailed.dot', use_ext=False, diff --git a/nipype/pipeline/engine/workflows.py b/nipype/pipeline/engine/workflows.py index fe7b0e38ce..f460a0e156 100644 --- a/nipype/pipeline/engine/workflows.py +++ b/nipype/pipeline/engine/workflows.py @@ -413,7 +413,7 @@ def write_graph(self, dotfilename='graph.dot', graph2use='hierarchical', base_dir = op.join(base_dir, self.name) else: base_dir = os.getcwd() - base_dir = makedirs(base_dir) + base_dir = makedirs(base_dir, exist_ok=True) if graph2use in ['hierarchical', 'colored']: if self.name[:1].isdigit(): # these graphs break if int raise ValueError('{} graph failed, workflow name cannot begin ' @@ -599,8 +599,7 @@ def _write_report_info(self, workingdir, name, graph): if workingdir is None: workingdir = os.getcwd() report_dir = op.join(workingdir, name) - if not op.exists(report_dir): - os.makedirs(report_dir) + makedirs(report_dir, exist_ok=True) shutil.copyfile(op.join(op.dirname(__file__), 'report_template.html'), op.join(report_dir, 'index.html')) diff --git a/nipype/pipeline/plugins/tools.py b/nipype/pipeline/plugins/tools.py index 499a1db2d7..c07a8966b6 100644 --- a/nipype/pipeline/plugins/tools.py +++ b/nipype/pipeline/plugins/tools.py @@ -15,7 +15,7 @@ from traceback import format_exception from ... import logging -from ...utils.filemanip import savepkl, crash2txt +from ...utils.filemanip import savepkl, crash2txt, makedirs logger = logging.getLogger('workflow') @@ -42,8 +42,7 @@ def report_crash(node, traceback=None, hostname=None): timeofcrash, login_name, name, str(uuid.uuid4())) crashdir = node.config['execution'].get('crashdump_dir', os.getcwd()) - if not os.path.exists(crashdir): - os.makedirs(crashdir) + makedirs(crashdir, exist_ok=True) crashfile = os.path.join(crashdir, crashfile) if node.config['execution']['crashfile_format'].lower() in ['text', 'txt']: From 948811f62fa96af89b7a295d021927dfaf986983 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Sun, 3 Dec 2017 11:41:30 -0800 Subject: [PATCH 033/365] changed output var names --- nipype/interfaces/dtitk/registration.py | 22 +++++++++++----------- nipype/interfaces/dtitk/utils.py | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 6bea8d31b2..2a6baf1343 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -188,7 +188,7 @@ class ComposeXfmInputSpec(CommandLineInputSpec): mandatory=False, position=1, argstr="-df %s") in_aff = traits.Str(desc='affine file.aff', exists=True, mandatory=False, position=0, argstr="-aff %s") - out_path = traits.Str(desc='output_path', exists=True, mandatory=False, + out_file = traits.Str(desc='output_path', exists=True, mandatory=False, position=2, argstr="-out %s", name_source="in_df", name_template="%s_comboaff.nii.gz") @@ -229,7 +229,7 @@ class diffeoSymTensor3DVolInputSpec(CommandLineInputSpec): position=1, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, + out_file = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_tensor", name_template="%s_diffeoxfmd.nii.gz") @@ -258,7 +258,7 @@ class diffeoSymTensor3DVolTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = self.inputs.out_path + outputs['out_file'] = self.inputs.out_file return outputs @@ -269,7 +269,7 @@ class affSymTensor3DVolInputSpec(CommandLineInputSpec): mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=2, argstr="-target %s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=3, + out_file = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_tensor", name_template="%s_affxfmd.nii.gz") @@ -297,7 +297,7 @@ class affSymTensor3DVolTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = os.path.abspath(self.inputs.out_file) return outputs @@ -308,7 +308,7 @@ class affScalarVolInputSpec(CommandLineInputSpec): mandatory=False, position=1, argstr="-trans %s") in_target = traits.Str(desc='', position=2, argstr="-target %s") - out_path = traits.Str(desc='', mandatory=False, position=3, + out_file = traits.Str(desc='', mandatory=False, position=3, argstr="-out %s", name_source="in_volume", name_template="%s_affxfmd.nii.gz") @@ -336,7 +336,7 @@ class affScalarVolTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = os.path.abspath(self.inputs.out_file) return outputs @@ -348,7 +348,7 @@ class diffeoScalarVolInputSpec(CommandLineInputSpec): position=2, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") - out_path = traits.Str(desc='', position=1, argstr="-out %s", + = traits.Str(desc='', position=1, argstr="-out %s", name_source="in_volume", name_template="%s_diffeoxfmd.nii.gz") in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, @@ -385,10 +385,10 @@ class diffeoScalarVolTask(CommandLineDtitk): def _list_outputs(self): outputs = self.output_spec().get() - if not isdefined(self.inputs.out_path): - self.inputs.out_path = fname_presuffix(self.inputs.in_volume, + if not isdefined(self.inputs.out_file): + self.inputs.out_file = fname_presuffix(self.inputs.in_volume, suffix="_diffeoxfmd", newpath=os.path.abspath( ".")) - outputs['out_file'] = os.path.abspath(self.inputs.out_path) + outputs['out_file'] = os.path.abspath(self.inputs.out_file) return outputs diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 354ca165db..1eb8b6f715 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -224,7 +224,7 @@ class SVResampleInputSpec(CommandLineInputSpec): argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") - out_path = traits.Str(desc='output path', exists=True, mandatory=False, + = traits.Str(desc='output path', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_file", name_template="%s_resampled.nii.gz") @@ -319,7 +319,7 @@ def _gen_filename(self, name): class BinThreshInputSpec(CommandLineInputSpec): in_file = traits.Str(desc='', exists=True, mandatory=False, position=0, argstr="%s") - out_path = traits.Str(desc='', exists=True, mandatory=False, position=1, + out_file = traits.Str(desc='', exists=True, mandatory=False, position=1, argstr="%s") in_numbers = traits.Str(desc='LB UB inside_value outside_value', exists=True, mandatory=False, position=2, From 89628d0b48890b8e7f2d287a843f6f70b85d2228 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 4 Dec 2017 14:47:42 -0800 Subject: [PATCH 034/365] fixed typo --- nipype/interfaces/dtitk/registration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/dtitk/registration.py b/nipype/interfaces/dtitk/registration.py index 2a6baf1343..3dd1c068c8 100644 --- a/nipype/interfaces/dtitk/registration.py +++ b/nipype/interfaces/dtitk/registration.py @@ -348,7 +348,7 @@ class diffeoScalarVolInputSpec(CommandLineInputSpec): position=2, argstr="-trans %s") in_target = traits.Str(desc='', exists=True, mandatory=False, position=3, argstr="-target %s") - = traits.Str(desc='', position=1, argstr="-out %s", + out_file = traits.Str(desc='', position=1, argstr="-out %s", name_source="in_volume", name_template="%s_diffeoxfmd.nii.gz") in_vsize = traits.Str(desc='', exists=True, mandatory=False, position=4, From 3070378667b45a10a8b66d4a9a86ed127e676569 Mon Sep 17 00:00:00 2001 From: oesteban Date: Mon, 4 Dec 2017 16:31:28 -0800 Subject: [PATCH 035/365] add docstring to emptydirs --- nipype/utils/filemanip.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 23adc64e8b..adc2752f56 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -700,6 +700,14 @@ def makedirs(path, exist_ok=False): def emptydirs(path): + """ + Empty an existing directory, without deleting it + + Parameters + ---------- + path : directory that should be empty + + """ fmlogger.debug("Removing contents of %s", path) pathconts = os.listdir(path) From de11e796b9e970444b7523a24cb03ae672c2663a Mon Sep 17 00:00:00 2001 From: oesteban Date: Mon, 4 Dec 2017 16:31:43 -0800 Subject: [PATCH 036/365] remove self._results from Node --- nipype/pipeline/engine/nodes.py | 57 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index b8ca88927c..ed7da540f0 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -163,7 +163,6 @@ def __init__(self, interface, name, iterables=None, itersource=None, self.name = name self._output_dir = None - self._result = None self.iterables = iterables self.synchronize = synchronize self.itersource = itersource @@ -190,11 +189,7 @@ def interface(self): @property def result(self): - # Cache first - if not self._result: - self._result = self._load_resultfile(self.output_dir())[0] - - return self._result + return self._load_resultfile(self.output_dir())[0] @property def inputs(self): @@ -420,7 +415,7 @@ def run(self, updatehash=False): self.write_report(report_type='postexec', cwd=outdir) logger.info('[Node] Finished "%s".', self.fullname) os.chdir(cwd) - return self._result + return self.result # Private functions def _parameterization_dir(self, param): @@ -511,7 +506,7 @@ def _get_inputs(self): def _run_interface(self, execute=True, updatehash=False): if updatehash: return - self._result = self._run_command(execute) + return self._run_command(execute) def _save_results(self, result, cwd): resultsfile = op.join(cwd, 'result_%s.pklz' % self.name) @@ -609,8 +604,7 @@ def _load_results(self, cwd): self._save_results(result, cwd) else: logger.debug('aggregating mapnode results') - self._run_interface() - result = self._result + result = self._run_interface() return result def _run_command(self, execute, copyfiles=True): @@ -625,7 +619,7 @@ def _run_command(self, execute, copyfiles=True): interface=self._interface.__class__, runtime=runtime, inputs=self._interface.inputs.get_traitsfree()) - self._result = result + if copyfiles: self._copyfiles_to_wd(cwd, execute) @@ -634,7 +628,7 @@ def _run_command(self, execute, copyfiles=True): try: cmd = self._interface.cmdline except Exception as msg: - self._result.runtime.stderr = msg + result.runtime.stderr = msg raise cmdfile = op.join(cwd, 'command.txt') with open(cmdfile, 'wt') as fd: @@ -646,7 +640,7 @@ def _run_command(self, execute, copyfiles=True): result = self._interface.run() except Exception as msg: self._save_results(result, cwd) - self._result.runtime.stderr = msg + result.runtime.stderr = msg raise dirs2keep = None @@ -1182,19 +1176,19 @@ def _node_runner(self, nodes, updatehash=False): yield i, node, err def _collate_results(self, nodes): - self._result = InterfaceResult(interface=[], runtime=[], - provenance=[], inputs=[], - outputs=self.outputs) + result = InterfaceResult( + interface=[], runtime=[], provenance=[], inputs=[], + outputs=self.outputs) returncode = [] for i, node, err in nodes: - self._result.runtime.insert(i, None) + result.runtime.insert(i, None) if node.result: if hasattr(node.result, 'runtime'): - self._result.interface.insert(i, node.result.interface) - self._result.inputs.insert(i, node.result.inputs) - self._result.runtime[i] = node.result.runtime + result.interface.insert(i, node.result.interface) + result.inputs.insert(i, node.result.inputs) + result.runtime[i] = node.result.runtime if hasattr(node.result, 'provenance'): - self._result.provenance.insert(i, node.result.provenance) + result.provenance.insert(i, node.result.provenance) returncode.insert(i, err) if self.outputs: for key, _ in list(self.outputs.items()): @@ -1203,7 +1197,7 @@ def _collate_results(self, nodes): if str2bool(rm_extra) and self.needed_outputs: if key not in self.needed_outputs: continue - values = getattr(self._result.outputs, key) + values = getattr(result.outputs, key) if not isdefined(values): values = [] if node.result.outputs: @@ -1211,16 +1205,16 @@ def _collate_results(self, nodes): else: values.insert(i, None) defined_vals = [isdefined(val) for val in values] - if any(defined_vals) and self._result.outputs: - setattr(self._result.outputs, key, values) + if any(defined_vals) and result.outputs: + setattr(result.outputs, key, values) if self.nested: for key, _ in list(self.outputs.items()): - values = getattr(self._result.outputs, key) + values = getattr(result.outputs, key) if isdefined(values): values = unflatten(values, filename_to_list( getattr(self.inputs, self.iterfield[0]))) - setattr(self._result.outputs, key, values) + setattr(result.outputs, key, values) if returncode and any([code is not None for code in returncode]): msg = [] @@ -1231,6 +1225,8 @@ def _collate_results(self, nodes): raise Exception('Subnodes of node: %s failed:\n%s' % (self.name, '\n'.join(msg))) + return result + def write_report(self, report_type=None, cwd=None): if not str2bool(self.config['execution']['create_report']): return @@ -1322,9 +1318,10 @@ def _run_interface(self, execute=True, updatehash=False): nitems = len(filename_to_list(getattr(self.inputs, self.iterfield[0]))) nodenames = ['_' + self.name + str(i) for i in range(nitems)] - self._collate_results(self._node_runner(self._make_nodes(cwd), - updatehash=updatehash)) - self._save_results(self._result, cwd) + result = self._collate_results( + self._node_runner(self._make_nodes(cwd), + updatehash=updatehash)) + self._save_results(result, cwd) # remove any node directories no longer required dirs2remove = [] for path in glob(op.join(cwd, 'mapflow', '*')): @@ -1334,5 +1331,5 @@ def _run_interface(self, execute=True, updatehash=False): for path in dirs2remove: shutil.rmtree(path) else: - self._result = self._load_results(cwd) + result = self._load_results(cwd) os.chdir(old_cwd) From a1c0fbde2c3745a848e70529c052cf5d5aa4724a Mon Sep 17 00:00:00 2001 From: oesteban Date: Mon, 4 Dec 2017 16:33:54 -0800 Subject: [PATCH 037/365] hashfiles is True --- nipype/pipeline/engine/nodes.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index ed7da540f0..dee88f522e 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -283,9 +283,8 @@ def hash_exists(self, updatehash=False): for hf in hashfiles: os.remove(hf) - if updatehash and len(hashfiles) == 1: + if updatehash: logger.debug("Updating hash: %s", hashvalue) - os.remove(hashfiles[0]) self._save_hashfile(hashfile, hashed_inputs) hash_exists = op.exists(hashfile) From 9c8440505bc39458e3c374daec05dc5ae4360a3b Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Mon, 4 Dec 2017 18:03:03 -0800 Subject: [PATCH 038/365] fix typo --- nipype/interfaces/dtitk/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/dtitk/utils.py b/nipype/interfaces/dtitk/utils.py index 1eb8b6f715..86e0c08b8c 100644 --- a/nipype/interfaces/dtitk/utils.py +++ b/nipype/interfaces/dtitk/utils.py @@ -224,7 +224,7 @@ class SVResampleInputSpec(CommandLineInputSpec): argstr="-size %s") in_voxsz = traits.Str(desc='resampled voxel size', exists=True, mandatory=False, position=2, argstr="-vsize %s") - = traits.Str(desc='output path', exists=True, mandatory=False, + out_file = traits.Str(desc='output path', exists=True, mandatory=False, position=3, argstr="-out %s", name_source="in_file", name_template="%s_resampled.nii.gz") From 43537aa508108c8d6a60a60309bff56d7e717bd2 Mon Sep 17 00:00:00 2001 From: oesteban Date: Mon, 4 Dec 2017 19:18:38 -0800 Subject: [PATCH 039/365] fix import of md5 --- nipype/pipeline/engine/nodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index dee88f522e..3564e8c7b7 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -35,14 +35,14 @@ from ... import config, logging from ...utils.misc import (flatten, unflatten, str2bool) from ...utils.filemanip import ( - save_json, FileNotFoundError, filename_to_list, list_to_filename, + md5, save_json, FileNotFoundError, filename_to_list, list_to_filename, copyfiles, fnames_presuffix, loadpkl, split_filename, load_json, makedirs, emptydirs, savepkl, write_rst_header, write_rst_dict, write_rst_list, to_str ) from ...interfaces.base import ( traits, InputMultiPath, CommandLine, Undefined, DynamicTraitedSpec, - Bunch, InterfaceResult, md5, Interface, isdefined + Bunch, InterfaceResult, Interface, isdefined ) from .utils import ( modify_paths, clean_working_directory, get_print_name, From 7ad09b8c961f65a81febbd6e5825a29de4ebfc38 Mon Sep 17 00:00:00 2001 From: kesshijordan Date: Tue, 5 Dec 2017 17:54:03 -0800 Subject: [PATCH 040/365] regenerated tests so var names are updated --- .../afni/tests/test_auto_TCatSubBrick.py | 6 ++- .../dtitk/tests/test_auto_AffineTask.py | 44 +++++++++++++------ .../dtitk/tests/test_auto_BinThreshTask.py | 5 ++- .../dtitk/tests/test_auto_CommandLineDtitk.py | 3 +- .../dtitk/tests/test_auto_ComposeXfmTask.py | 5 ++- .../dtitk/tests/test_auto_DiffeoTask.py | 29 ++++++++---- .../dtitk/tests/test_auto_RigidTask.py | 23 +++++++++- .../tests/test_auto_SVAdjustVoxSpTask.py | 5 ++- .../dtitk/tests/test_auto_SVResampleTask.py | 5 ++- .../tests/test_auto_TVAdjustOriginTask.py | 3 +- .../tests/test_auto_TVAdjustVoxSpTask.py | 3 +- .../dtitk/tests/test_auto_TVResampleTask.py | 5 ++- .../dtitk/tests/test_auto_TVtoolTask.py | 3 +- .../dtitk/tests/test_auto_affScalarVolTask.py | 5 ++- .../tests/test_auto_affSymTensor3DVolTask.py | 5 ++- .../tests/test_auto_diffeoScalarVolTask.py | 5 ++- .../test_auto_diffeoSymTensor3DVolTask.py | 5 ++- .../tests/test_auto_SimpleInterface.py | 16 +++++++ 18 files changed, 128 insertions(+), 47 deletions(-) create mode 100644 nipype/interfaces/tests/test_auto_SimpleInterface.py diff --git a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py index a32e594298..da3b0fb383 100644 --- a/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py +++ b/nipype/interfaces/afni/tests/test_auto_TCatSubBrick.py @@ -17,6 +17,9 @@ def test_TCatSubBrick_inputs(): mandatory=True, position=-1, ), + num_threads=dict(nohash=True, + usedefault=True, + ), out_file=dict(argstr='-prefix %s', genfile=True, ), @@ -24,7 +27,8 @@ def test_TCatSubBrick_inputs(): rlt=dict(argstr='-rlt%s', position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = TCatSubBrick.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py index 865619366a..6e74049c5a 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_AffineTask.py @@ -9,30 +9,46 @@ def test_AffineTask_inputs(): environ=dict(nohash=True, usedefault=True, ), - ignore_exception=dict(nohash=True, - usedefault=True, - ), - in_fixed_tensor=dict(argstr='%s', + fixed_file=dict(argstr='%s', exists=True, - mandatory=False, + mandatory=True, position=0, ), - in_moving_txt=dict(argstr='%s', + ftol=dict(argstr='%s', + mandatory=True, + position=6, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + moving_file=dict(argstr='%s', exists=True, - mandatory=False, + mandatory=True, position=1, ), - in_similarity_metric=dict(argstr='%s', - exists=True, - mandatory=False, + samplingX=dict(argstr='%s', + mandatory=True, position=3, ), - in_usetrans_flag=dict(argstr='%s', - exists=True, - mandatory=False, + samplingY=dict(argstr='%s', + mandatory=True, position=4, ), - terminal_output=dict(nohash=True, + samplingZ=dict(argstr='%s', + mandatory=True, + position=5, + ), + similarity_metric=dict(argstr='%s', + exists=True, + mandatory=True, + position=2, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + useInTrans=dict(argstr='%s', + mandatory=False, + position=7, ), ) inputs = AffineTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py index b294953b4d..65d97cf574 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_BinThreshTask.py @@ -22,12 +22,13 @@ def test_BinThreshTask_inputs(): mandatory=False, position=2, ), - out_path=dict(argstr='%s', + out_file=dict(argstr='%s', exists=True, mandatory=False, position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = BinThreshTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py index e0934c9b76..b6b55b809a 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py +++ b/nipype/interfaces/dtitk/tests/test_auto_CommandLineDtitk.py @@ -12,7 +12,8 @@ def test_CommandLineDtitk_inputs(): ignore_exception=dict(nohash=True, usedefault=True, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = CommandLineDtitk.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py index 9b98fc48e4..e0fed353c9 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_ComposeXfmTask.py @@ -22,14 +22,15 @@ def test_ComposeXfmTask_inputs(): mandatory=False, position=1, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_df', name_template='%s_comboaff.nii.gz', position=2, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = ComposeXfmTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py index ad3b8b7366..0363ce3203 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py @@ -9,30 +9,41 @@ def test_DiffeoTask_inputs(): environ=dict(nohash=True, usedefault=True, ), + fixed_file=dict(argstr='%s', + exists=True, + mandatory=False, + position=0, + ), + ftol=dict(argstr='%s', + exists=True, + mandatory=True, + position=5, + ), ignore_exception=dict(nohash=True, usedefault=True, ), - in_fixed_tensor=dict(argstr='%s', + legacy=dict(argstr='%s', exists=True, - mandatory=False, - position=0, + mandatory=True, + position=3, ), - in_mask=dict(argstr='%s', + mask=dict(argstr='%s', exists=True, mandatory=False, position=2, ), - in_moving_txt=dict(argstr='%s', + moving_file=dict(argstr='%s', exists=True, mandatory=False, position=1, ), - in_numbers=dict(argstr='%s', + n_iters=dict(argstr='%s', exists=True, - mandatory=False, - position=3, + mandatory=True, + position=4, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = DiffeoTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py index e099d4c6a0..0abd84091d 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_RigidTask.py @@ -14,6 +14,10 @@ def test_RigidTask_inputs(): mandatory=True, position=0, ), + ftol=dict(argstr='%s', + mandatory=True, + position=6, + ), ignore_exception=dict(nohash=True, usedefault=True, ), @@ -22,12 +26,29 @@ def test_RigidTask_inputs(): mandatory=True, position=1, ), + samplingX=dict(argstr='%s', + mandatory=True, + position=3, + ), + samplingY=dict(argstr='%s', + mandatory=True, + position=4, + ), + samplingZ=dict(argstr='%s', + mandatory=True, + position=5, + ), similarity_metric=dict(argstr='%s', exists=True, mandatory=True, position=2, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + useInTrans=dict(argstr='%s', + mandatory=False, + position=7, ), ) inputs = RigidTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py index 48464fdc0b..1660485f1b 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVAdjustVoxSpTask.py @@ -32,14 +32,15 @@ def test_SVAdjustVoxSpTask_inputs(): mandatory=False, position=4, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_file', name_template='%s_origmvd.nii.gz', position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = SVAdjustVoxSpTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py index 28dd918e79..a6528fb696 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_SVResampleTask.py @@ -27,14 +27,15 @@ def test_SVResampleTask_inputs(): mandatory=False, position=2, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_file', name_template='%s_resampled.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = SVResampleTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py index 55947095a9..09477662a2 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustOriginTask.py @@ -25,7 +25,8 @@ def test_TVAdjustOriginTask_inputs(): genfile=True, position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = TVAdjustOriginTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py index 1512ff67a4..8bca0161cf 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVAdjustVoxSpTask.py @@ -30,7 +30,8 @@ def test_TVAdjustVoxSpTask_inputs(): mandatory=False, position=2, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), vsize=dict(argstr='-vsize %s', exists=True, diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py index a591a20634..6168a67682 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVResampleTask.py @@ -27,14 +27,15 @@ def test_TVResampleTask_inputs(): mandatory=False, position=2, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_file', name_template='%s_resampled.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = TVResampleTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py index 8452af91ff..75e8681685 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_TVtoolTask.py @@ -22,7 +22,8 @@ def test_TVtoolTask_inputs(): mandatory=False, position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = TVtoolTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py index 55dc779e9a..0cfb8a820d 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_affScalarVolTask.py @@ -25,13 +25,14 @@ def test_affScalarVolTask_inputs(): mandatory=False, position=1, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', mandatory=False, name_source='in_volume', name_template='%s_affxfmd.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = affScalarVolTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py index c0da08cb55..9b86a7457d 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_affSymTensor3DVolTask.py @@ -27,14 +27,15 @@ def test_affSymTensor3DVolTask_inputs(): mandatory=False, position=1, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_tensor', name_template='%s_affxfmd.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = affSymTensor3DVolTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py index c396ec6e4a..483dc1254c 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoScalarVolTask.py @@ -47,12 +47,13 @@ def test_diffeoScalarVolTask_inputs(): mandatory=False, position=2, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', name_source='in_volume', name_template='%s_diffeoxfmd.nii.gz', position=1, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = diffeoScalarVolTask.input_spec() diff --git a/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py index af2069fe4f..8d12125421 100644 --- a/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py +++ b/nipype/interfaces/dtitk/tests/test_auto_diffeoSymTensor3DVolTask.py @@ -27,14 +27,15 @@ def test_diffeoSymTensor3DVolTask_inputs(): mandatory=False, position=1, ), - out_path=dict(argstr='-out %s', + out_file=dict(argstr='-out %s', exists=True, mandatory=False, name_source='in_tensor', name_template='%s_diffeoxfmd.nii.gz', position=3, ), - terminal_output=dict(nohash=True, + terminal_output=dict(deprecated='1.0.0', + nohash=True, ), ) inputs = diffeoSymTensor3DVolTask.input_spec() diff --git a/nipype/interfaces/tests/test_auto_SimpleInterface.py b/nipype/interfaces/tests/test_auto_SimpleInterface.py new file mode 100644 index 0000000000..b00d1f9a3c --- /dev/null +++ b/nipype/interfaces/tests/test_auto_SimpleInterface.py @@ -0,0 +1,16 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..base import SimpleInterface + + +def test_SimpleInterface_inputs(): + input_map = dict(ignore_exception=dict(nohash=True, + usedefault=True, + ), + ) + inputs = SimpleInterface.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + From b46704f0961b1a88c61205e6be59ce846a8fb7b1 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Thu, 7 Dec 2017 07:55:52 -0800 Subject: [PATCH 041/365] improved hashfiles checks --- nipype/pipeline/engine/nodes.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 3564e8c7b7..e0caaa194a 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -275,9 +275,18 @@ def hash_exists(self, updatehash=False): logger.debug('Node hash value: %s', hashvalue) if op.exists(outdir): + # Find unfinished hashfiles and error if any + unfinished = glob(op.join(outdir, '_0x*_unfinished.json')) + if unfinished: + raise RuntimeError( + '[Caching Node Error] Found unfinished hashfiles (%d) that indicate ' + 'that the ``base_dir`` for this node went stale. Please re-run the ' + 'workflow.' % len(unfinished)) + # Find previous hashfiles hashfiles = glob(op.join(outdir, '_0x*.json')) - if len(hashfiles) > 1: # Remove hashfiles if more than one found + # Remove hashfiles if more than one found or the one found is outdated + if hashfiles and (len(hashfiles) > 1 or hashfiles[0] != hashfile): logger.info('Removing hashfiles (%s) and forcing node to rerun', ', '.join(['"%s"' % op.basename(h) for h in hashfiles])) for hf in hashfiles: From d001a2829ae818767732e4b0f595ab5ce86767aa Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sun, 10 Dec 2017 14:24:21 +0100 Subject: [PATCH 042/365] BF: if --x1D_stop, do not assume out_file exists --- nipype/interfaces/afni/model.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index d5730d15f9..311072b7e6 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -290,6 +290,10 @@ def _parse_inputs(self, skip=None): return super(Deconvolve, self)._parse_inputs(skip) def _list_outputs(self): + if isdefined(self.inputs.x1D_stop): + # we are stopping early, so out_file doesn't exist + self.output_spec.out_file.exists = False + outputs = self.output_spec().get() _gen_fname_opts = {} From 66343ae88e04e3bfedb0166fc26e9d668200052e Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sun, 10 Dec 2017 14:25:49 +0100 Subject: [PATCH 043/365] Check that x1d_stop is true --- nipype/interfaces/afni/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index 311072b7e6..68a7053065 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -290,7 +290,7 @@ def _parse_inputs(self, skip=None): return super(Deconvolve, self)._parse_inputs(skip) def _list_outputs(self): - if isdefined(self.inputs.x1D_stop): + if isdefined(self.inputs.x1D_stop) and self.inputs.x1D_stop: # we are stopping early, so out_file doesn't exist self.output_spec.out_file.exists = False From dde61d3172dd066d22ba49a0cfaf748030b1e5f9 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sun, 10 Dec 2017 14:43:27 +0100 Subject: [PATCH 044/365] Update zenodo.json --- .zenodo.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.zenodo.json b/.zenodo.json index fb7ccfc0b8..dc0d4522e5 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -516,6 +516,11 @@ { "name": "Flandin, Guillaume" }, + { + "affiliation": "Dartmouth College", + "name": "Visconti di Oleggio Castello, Matteo", + "orcid": "0000-0001-7931-5272" + }, { "affiliation": "CEA", "name": "Papadopoulos Orfanos, Dimitri", From d79f2cc7bd0ad070ef2d9efe770a131c66991889 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sun, 10 Dec 2017 15:31:00 +0100 Subject: [PATCH 045/365] FIX: force_TR is float not int --- nipype/interfaces/afni/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index 68a7053065..54ed3ce0f7 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -57,7 +57,7 @@ class DeconvolveInputSpec(AFNICommandInputSpec): '* If the auto-catenation feature isn\'t used, then this option ' 'has no effect, no how, no way.', argstr='-noblock') - force_TR = traits.Int( + force_TR = traits.Float( desc='use this value instead of the TR in the \'input\' ' 'dataset. (It\'s better to fix the input using Refit.)', argstr='-force_TR %d') From ca18a389c24e92bdc1fbeb9ea1e6d7a8479d715d Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sun, 10 Dec 2017 16:10:16 +0100 Subject: [PATCH 046/365] Format as float, force_tr must precede input --- nipype/interfaces/afni/model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index 54ed3ce0f7..b530e7491a 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -36,7 +36,7 @@ class DeconvolveInputSpec(AFNICommandInputSpec): argstr='-input %s', copyfile=False, sep=" ", - position=0) + position=1) sat = traits.Bool( desc='check the dataset time series for initial saturation transients,' ' which should normally have been excised before data analysis.', @@ -60,7 +60,8 @@ class DeconvolveInputSpec(AFNICommandInputSpec): force_TR = traits.Float( desc='use this value instead of the TR in the \'input\' ' 'dataset. (It\'s better to fix the input using Refit.)', - argstr='-force_TR %d') + argstr='-force_TR %f', + position=0) input1D = File( desc='filename of single (fMRI) .1D time series where time runs down ' 'the column.', From e5f36a89afacb39a37c1d0aebab74ef10d7d3a4a Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sun, 10 Dec 2017 22:56:19 +0100 Subject: [PATCH 047/365] Update autotest deconvolve --- nipype/interfaces/afni/tests/test_auto_Deconvolve.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py index 972b9a0128..f688897889 100644 --- a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py +++ b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py @@ -25,7 +25,8 @@ def test_Deconvolve_inputs(): environ=dict(nohash=True, usedefault=True, ), - force_TR=dict(argstr='-force_TR %d', + force_TR=dict(argstr='-force_TR %f', + position=0, ), fout=dict(argstr='-fout', ), @@ -47,7 +48,7 @@ def test_Deconvolve_inputs(): ), in_files=dict(argstr='-input %s', copyfile=False, - position=0, + position=1, sep=' ', ), input1D=dict(argstr='-input1D %s', From 14ab0a8c64332b9e23d39e1ea913e1669d4ba155 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Mon, 11 Dec 2017 08:46:55 +0100 Subject: [PATCH 048/365] Fix by setting exists to False --- nipype/interfaces/afni/model.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index b530e7491a..dff7f672bb 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -233,7 +233,7 @@ class DeconvolveInputSpec(AFNICommandInputSpec): class DeconvolveOutputSpec(TraitedSpec): out_file = File( - desc='output statistics file', exists=True) + desc='output statistics file', exists=False) reml_script = File( desc='automatical generated script to run 3dREMLfit', exists=True) x1D = File( @@ -291,10 +291,6 @@ def _parse_inputs(self, skip=None): return super(Deconvolve, self)._parse_inputs(skip) def _list_outputs(self): - if isdefined(self.inputs.x1D_stop) and self.inputs.x1D_stop: - # we are stopping early, so out_file doesn't exist - self.output_spec.out_file.exists = False - outputs = self.output_spec().get() _gen_fname_opts = {} From 5b88f2f39956f08cca4ef15e89266658d95f5470 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Mon, 11 Dec 2017 10:03:12 +0100 Subject: [PATCH 049/365] Fix parsing of ortvec --- nipype/interfaces/afni/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index dff7f672bb..c16de0ed28 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -148,7 +148,7 @@ class DeconvolveInputSpec(AFNICommandInputSpec): desc='this option lets you input a rectangular array of 1 or more ' 'baseline vectors from a file. This method is a fast way to ' 'include a lot of baseline regressors in one step. ', - argstr='ortvec %s') + argstr='-ortvec %s %s') x1D = File( desc='specify name for saved X matrix', argstr='-x1D %s') From e95c0a0ca8ef84f4fea1eb77ce731861b9527e9d Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Mon, 11 Dec 2017 19:26:10 +0100 Subject: [PATCH 050/365] Update auto test Deconvolve --- nipype/interfaces/afni/tests/test_auto_Deconvolve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py index f688897889..3505f42eac 100644 --- a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py +++ b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py @@ -81,7 +81,7 @@ def test_Deconvolve_inputs(): num_threads=dict(nohash=True, usedefault=True, ), - ortvec=dict(argstr='ortvec %s', + ortvec=dict(argstr='-ortvec %s %s', ), out_file=dict(argstr='-bucket %s', ), From d2cc92f943a96c91a55495d4e71a80fae5b244c4 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Tue, 12 Dec 2017 14:58:24 +0100 Subject: [PATCH 051/365] NF: add afni.ConvertDset --- nipype/interfaces/afni/__init__.py | 3 +- nipype/interfaces/afni/utils.py | 47 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/__init__.py b/nipype/interfaces/afni/__init__.py index 6a1e7df767..3239230a2d 100644 --- a/nipype/interfaces/afni/__init__.py +++ b/nipype/interfaces/afni/__init__.py @@ -20,7 +20,8 @@ TShift, Volreg, Warp, QwarpPlusMinus, Qwarp) from .svm import (SVMTest, SVMTrain) from .utils import (ABoverlap, AFNItoNIFTI, Autobox, Axialize, BrickStat, - Bucket, Calc, Cat, CatMatvec, CenterMass, Copy, Dot, + Bucket, Calc, Cat, CatMatvec, CenterMass, ConvertDset, + Copy, Dot, Edge3, Eval, FWHMx, MaskTool, Merge, Notes, NwarpApply, NwarpCat, OneDToolPy, Refit, Resample, TCat, TCatSubBrick, TStat, To3D, Unifize, diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 3e03adda92..94b48f62f8 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -737,6 +737,53 @@ def _list_outputs(self): return outputs +class ConvertDsetInputSpec(CommandLineInputSpec): + in_file = File( + desc='input file to ConvertDset', + argstr='-input %s', + position=-2, + mandatory=True, + exists=True) + + out_file = File( + desc='output file for ConvertDset', + argstr='-prefix %s', + position=-1) + + out_type = traits.Enum( + ('niml', 'niml_asc', 'niml_bi', + '1D', '1Dp', '1Dpt', + 'gii', 'gii_asc', 'gii_b64', 'gii_b64gz'), + desc='output type', + argstr='-o_%s', + mandatory=True, + position=0) + + +class ConvertDset(AFNICommandBase): + """Converts a surface dataset from one format to another. + + For complete details, see the `ConvertDset Documentation. + `_ + + Examples + ======== + + >>> from nipype.interfaces import afni + >>> convertdset = afni.ConvertDset() + >>> convertdset.inputs.in_file = 'lh.pial_converted.gii' + >>> convertdset.inputs.out_type = 'niml_asc' + >>> convertdset.inputs.out_file = 'lh.pial_converted.niml.dset' + >>> convertdset.cmdline + 'ConvertDset -o_niml_asc -input nipype/testing/data/lh.pial_converted.gii -prefix lh.pial_converted.niml.dset' + >>> res = convertdset.run() # doctest: +SKIP + """ + + _cmd = 'ConvertDset' + input_spec = ConvertDsetInputSpec + output_spec = AFNICommandOutputSpec + + class CopyInputSpec(AFNICommandInputSpec): in_file = File( desc='input file to 3dcopy', From c5d55b310396e94ff576d217b337a96840a1d728 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Tue, 12 Dec 2017 15:37:49 +0100 Subject: [PATCH 052/365] Fix docstring test, add auto test --- .../afni/tests/test_auto_ConvertDset.py | 45 +++++++++++++++++++ nipype/interfaces/afni/utils.py | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 nipype/interfaces/afni/tests/test_auto_ConvertDset.py diff --git a/nipype/interfaces/afni/tests/test_auto_ConvertDset.py b/nipype/interfaces/afni/tests/test_auto_ConvertDset.py new file mode 100644 index 0000000000..c6e73f4ecf --- /dev/null +++ b/nipype/interfaces/afni/tests/test_auto_ConvertDset.py @@ -0,0 +1,45 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..utils import ConvertDset + + +def test_ConvertDset_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + environ=dict(nohash=True, + usedefault=True, + ), + ignore_exception=dict(deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_file=dict(argstr='-input %s', + mandatory=True, + position=-2, + ), + out_file=dict(argstr='-prefix %s', + position=-1, + ), + out_type=dict(argstr='-o_%s', + mandatory=True, + position=0, + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + ) + inputs = ConvertDset.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_ConvertDset_outputs(): + output_map = dict(out_file=dict(), + ) + outputs = ConvertDset.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 94b48f62f8..2ef03971ed 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -775,7 +775,7 @@ class ConvertDset(AFNICommandBase): >>> convertdset.inputs.out_type = 'niml_asc' >>> convertdset.inputs.out_file = 'lh.pial_converted.niml.dset' >>> convertdset.cmdline - 'ConvertDset -o_niml_asc -input nipype/testing/data/lh.pial_converted.gii -prefix lh.pial_converted.niml.dset' + 'ConvertDset -o_niml_asc -input lh.pial_converted.gii -prefix lh.pial_converted.niml.dset' >>> res = convertdset.run() # doctest: +SKIP """ From a07d9ea5dd5cab78751da8f573d5d55d47c2e92b Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Tue, 12 Dec 2017 16:31:29 +0100 Subject: [PATCH 053/365] Fix output --- nipype/interfaces/afni/utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 2ef03971ed..f5338ad472 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -748,7 +748,8 @@ class ConvertDsetInputSpec(CommandLineInputSpec): out_file = File( desc='output file for ConvertDset', argstr='-prefix %s', - position=-1) + position=-1, + mandatory=True) out_type = traits.Enum( ('niml', 'niml_asc', 'niml_bi', @@ -783,6 +784,11 @@ class ConvertDset(AFNICommandBase): input_spec = ConvertDsetInputSpec output_spec = AFNICommandOutputSpec + def _list_outputs(self): + outputs = self.output_spec().get() + outputs['out_file'] = op.abspath(self.inputs.out_file) + return outputs + class CopyInputSpec(AFNICommandInputSpec): in_file = File( From b1355065be96bec2882e2972f5151be5eba50c92 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Tue, 12 Dec 2017 11:00:32 -0500 Subject: [PATCH 054/365] Fixed tests --- nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py | 3 ++- nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py | 7 ++----- nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py | 3 ++- nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py | 7 ++----- 4 files changed, 8 insertions(+), 12 deletions(-) mode change 100755 => 100644 nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py mode change 100755 => 100644 nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py mode change 100755 => 100644 nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py b/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py old mode 100755 new mode 100644 index 22e0890d2f..805b5b86b0 --- a/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_DWIExtract.py @@ -17,7 +17,8 @@ def test_DWIExtract_inputs(): ), grad_fsl=dict(argstr='-fslgrad %s %s', ), - ignore_exception=dict(nohash=True, + ignore_exception=dict(deprecated='1.0.0', + nohash=True, usedefault=True, ), in_bval=dict(), diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py index 3cb2568bf2..cc98ff316e 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_Generate5tt.py @@ -15,15 +15,12 @@ def test_Generate5tt_inputs(): environ=dict(nohash=True, usedefault=True, ), - ignore_exception=dict(deprecated='1.0.0', - nohash=True, - usedefault=True, - ), grad_file=dict(argstr='-grad %s', ), grad_fsl=dict(argstr='-fslgrad %s %s', ), - ignore_exception=dict(nohash=True, + ignore_exception=dict(deprecated='1.0.0', + nohash=True, usedefault=True, ), in_bval=dict(), diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py old mode 100755 new mode 100644 index 5dec38ed52..c1778a9ef6 --- a/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_MRConvert.py @@ -21,7 +21,8 @@ def test_MRConvert_inputs(): ), grad_fsl=dict(argstr='-fslgrad %s %s', ), - ignore_exception=dict(nohash=True, + ignore_exception=dict(deprecated='1.0.0', + nohash=True, usedefault=True, ), in_bval=dict(), diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py b/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py old mode 100755 new mode 100644 index ca871ce690..6b13903f0f --- a/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_MRMath.py @@ -13,15 +13,12 @@ def test_MRMath_inputs(): environ=dict(nohash=True, usedefault=True, ), - ignore_exception=dict(deprecated='1.0.0', - nohash=True, - usedefault=True, - ), grad_file=dict(argstr='-grad %s', ), grad_fsl=dict(argstr='-fslgrad %s %s', ), - ignore_exception=dict(nohash=True, + ignore_exception=dict(deprecated='1.0.0', + nohash=True, usedefault=True, ), in_bval=dict(), From bdb340d78aba55393c44200e0f1cb32299860d14 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 13 Dec 2017 03:52:43 -0500 Subject: [PATCH 055/365] Removed trailing spaces --- doc/users/config_file.rst | 10 +++++----- doc/users/plugins.rst | 4 ++-- nipype/algorithms/tests/test_mesh_ops.py | 2 +- nipype/interfaces/ants/tests/test_resampling.py | 4 ++-- nipype/interfaces/cmtk/tests/test_nbs.py | 4 ++-- nipype/interfaces/niftyfit/asl.py | 2 +- nipype/pipeline/engine/tests/test_utils.py | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index 060549b01e..279dc1aadd 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. @@ -170,7 +170,7 @@ Resource Monitor Indicates where the summary file collecting all profiling information from the resource monitor should be stored after execution of a workflow. The ``summary_file`` does not apply to interfaces run independently. - (unset by default, in which case the summary file will be written out to + (unset by default, in which case the summary file will be written out to ``/resource_monitor.json`` of the top-level workflow). *summary_append* diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index 501e7aa1d6..e655e5f6db 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: diff --git a/nipype/algorithms/tests/test_mesh_ops.py b/nipype/algorithms/tests/test_mesh_ops.py index 9d510dee2b..d5fbc56825 100644 --- a/nipype/algorithms/tests/test_mesh_ops.py +++ b/nipype/algorithms/tests/test_mesh_ops.py @@ -15,7 +15,7 @@ @pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed") def test_ident_distances(tmpdir): - tmpdir.chdir() + tmpdir.chdir() in_surf = example_data('surf01.vtk') dist_ident = m.ComputeMeshWarp() diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index 22dc4446e9..509ebfe844 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -1,5 +1,5 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- -# vi: set ft=python sts=4 ts=4 sw=4 et: +# vi: set ft=python sts=4 ts=4 sw=4 et: from nipype.interfaces.ants import WarpImageMultiTransform, WarpTimeSeriesImageMultiTransform import os @@ -66,7 +66,7 @@ def create_wtsimt(): def test_WarpTimeSeriesImageMultiTransform(change_dir, create_wtsimt): wtsimt = create_wtsimt assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ --R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' +-R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' def test_WarpTimeSeriesImageMultiTransform_invaffine(change_dir, create_wtsimt): diff --git a/nipype/interfaces/cmtk/tests/test_nbs.py b/nipype/interfaces/cmtk/tests/test_nbs.py index 0516390b02..03a7aa8619 100644 --- a/nipype/interfaces/cmtk/tests/test_nbs.py +++ b/nipype/interfaces/cmtk/tests/test_nbs.py @@ -31,12 +31,12 @@ def test_importerror(creating_graphs, tmpdir): graphlist = creating_graphs group1 = graphlist[:3] group2 = graphlist[3:] - + nbs = NetworkBasedStatistic() nbs.inputs.in_group1 = group1 nbs.inputs.in_group2 = group2 nbs.inputs.edge_key = "weight" - + with pytest.raises(ImportError) as e: nbs.run() assert "cviewer library is not available" == str(e.value) diff --git a/nipype/interfaces/niftyfit/asl.py b/nipype/interfaces/niftyfit/asl.py index 366f9a6eca..8f95a48192 100644 --- a/nipype/interfaces/niftyfit/asl.py +++ b/nipype/interfaces/niftyfit/asl.py @@ -147,7 +147,7 @@ class FitAsl(NiftyFitCommand): >>> from nipype.interfaces import niftyfit >>> node = niftyfit.FitAsl() >>> node.inputs.source_file = 'asl.nii.gz' - >>> node.cmdline + >>> node.cmdline 'fit_asl -source asl.nii.gz -cbf asl_cbf.nii.gz -error asl_error.nii.gz \ -syn asl_syn.nii.gz' diff --git a/nipype/pipeline/engine/tests/test_utils.py b/nipype/pipeline/engine/tests/test_utils.py index 34ec45cfa8..23c7a16fc6 100644 --- a/nipype/pipeline/engine/tests/test_utils.py +++ b/nipype/pipeline/engine/tests/test_utils.py @@ -23,7 +23,7 @@ def test_identitynode_removal(tmpdir): def test_function(arg1, arg2, arg3): import numpy as np return (np.array(arg1) + arg2 + arg3).tolist() - + wf = pe.Workflow(name="testidentity", base_dir=tmpdir.strpath) From 1e1dcc0c10b58e14f9a9c4d8e8f66546ddae8c6b Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 13 Dec 2017 04:01:49 -0500 Subject: [PATCH 056/365] Removed last trailing spaces --- doc/users/config_file.rst | 10 +++++----- doc/users/plugins.rst | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index 279dc1aadd..060549b01e 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. @@ -170,7 +170,7 @@ Resource Monitor Indicates where the summary file collecting all profiling information from the resource monitor should be stored after execution of a workflow. The ``summary_file`` does not apply to interfaces run independently. - (unset by default, in which case the summary file will be written out to + (unset by default, in which case the summary file will be written out to ``/resource_monitor.json`` of the top-level workflow). *summary_append* diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index e655e5f6db..501e7aa1d6 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: From e92e11296ccd4e1894ef835d431977bc67834955 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Wed, 13 Dec 2017 04:04:58 -0500 Subject: [PATCH 057/365] Removed last trailing spaces --- doc/users/config_file.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index 060549b01e..f53a2900db 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -74,11 +74,11 @@ Execution *display_variable* Override the ``$DISPLAY`` environment variable for interfaces that require - an X server. This option is useful if there is a running X server, but - ``$DISPLAY`` was not defined in nipype's environment. For example, if an X + an X server. This option is useful if there is a running X server, but + ``$DISPLAY`` was not defined in nipype's environment. For example, if an X server is listening on the default port of 6000, set ``display_variable = :0`` - to enable nipype interfaces to use it. It may also point to displays provided - by VNC, `xnest `_ + to enable nipype interfaces to use it. It may also point to displays provided + by VNC, `xnest `_ or `Xvfb `_. If neither ``display_variable`` nor the ``$DISPLAY`` environment variable are set, nipype will try to configure a new virtual server using Xvfb. From 4ac916217b6cd0bdc7cb5e00cfcbe74cee9bae40 Mon Sep 17 00:00:00 2001 From: salma1601 Date: Wed, 13 Dec 2017 11:25:36 +0100 Subject: [PATCH 058/365] quiet clfrac and t2_up parameters --- .../interfaces/afni/tests/test_auto_Unifize.py | 6 ++++++ nipype/interfaces/afni/utils.py | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/nipype/interfaces/afni/tests/test_auto_Unifize.py b/nipype/interfaces/afni/tests/test_auto_Unifize.py index e9f5095619..e1b67ee285 100644 --- a/nipype/interfaces/afni/tests/test_auto_Unifize.py +++ b/nipype/interfaces/afni/tests/test_auto_Unifize.py @@ -6,6 +6,8 @@ def test_Unifize_inputs(): input_map = dict(args=dict(argstr='%s', ), + cl_frac=dict(argstr='-clfrac %f', + ), environ=dict(nohash=True, usedefault=True, ), @@ -33,12 +35,16 @@ def test_Unifize_inputs(): name_source='in_file', ), outputtype=dict(), + quiet=dict(argstr='-quiet', + ), rbt=dict(argstr='-rbt %f %f %f', ), scale_file=dict(argstr='-ssave %s', ), t2=dict(argstr='-T2', ), + t2_up=dict(argstr='-T2up %f', + ), terminal_output=dict(deprecated='1.0.0', nohash=True, ), diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 3e03adda92..64f59040f5 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -2337,6 +2337,22 @@ class UnifizeInputSpec(AFNICommandInputSpec): 'b = bottom percentile of normalizing data range, [default=70.0]\n' 'r = top percentile of normalizing data range, [default=80.0]\n', argstr='-rbt %f %f %f') + t2_up = traits.Float( + desc='Option for AFNI experts only.' + 'Set the upper percentile point used for T2-T1 inversion. ' + 'Allowed to be anything between 90 and 100 (inclusive), with ' + 'default to 98.5 (for no good reason).', + argstr='-T2up %f') + cl_frac = traits.Float( + desc='Option for AFNI experts only.' + 'Set the automask \'clip level fraction\'. Must be between ' + '0.1 and 0.9. A small fraction means to make the initial ' + 'threshold for clipping (a la 3dClipLevel) smaller, which ' + 'will tend to make the mask larger. [default=0.1]', + argstr='-clfrac %f') + quiet = traits.Bool( + desc='Don\'t print the progress messages.', + argstr='-quiet') class UnifizeOutputSpec(TraitedSpec): From cbc904d1ef8c54a2924fa53ef1d38c26902486ee Mon Sep 17 00:00:00 2001 From: salma1601 Date: Wed, 13 Dec 2017 14:50:19 +0100 Subject: [PATCH 059/365] use '_unifized' as template for out_file --- nipype/interfaces/afni/tests/test_auto_Unifize.py | 1 + nipype/interfaces/afni/utils.py | 1 + 2 files changed, 2 insertions(+) diff --git a/nipype/interfaces/afni/tests/test_auto_Unifize.py b/nipype/interfaces/afni/tests/test_auto_Unifize.py index e1b67ee285..1d82e5aed5 100644 --- a/nipype/interfaces/afni/tests/test_auto_Unifize.py +++ b/nipype/interfaces/afni/tests/test_auto_Unifize.py @@ -33,6 +33,7 @@ def test_Unifize_inputs(): ), out_file=dict(argstr='-prefix %s', name_source='in_file', + name_template='%s_unifized', ), outputtype=dict(), quiet=dict(argstr='-quiet', diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 64f59040f5..6ffe3d6ffa 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -2291,6 +2291,7 @@ class UnifizeInputSpec(AFNICommandInputSpec): exists=True, copyfile=False) out_file = File( + name_template='%s_unifized', desc='output image file name', argstr='-prefix %s', name_source='in_file') From ccf2b41d01b336c3ca7ff83a68ee78f23c764a65 Mon Sep 17 00:00:00 2001 From: achetverikov Date: Fri, 15 Dec 2017 22:35:10 +0100 Subject: [PATCH 060/365] Fixed PBS plugin to work with the Donders Torque cluster --- nipype/pipeline/plugins/pbs.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nipype/pipeline/plugins/pbs.py b/nipype/pipeline/plugins/pbs.py index 6154abad74..160e927176 100644 --- a/nipype/pipeline/plugins/pbs.py +++ b/nipype/pipeline/plugins/pbs.py @@ -47,18 +47,20 @@ def __init__(self, **kwargs): super(PBSPlugin, self).__init__(template, **kwargs) def _is_pending(self, taskid): - result = CommandLine('qstat {}'.format(taskid), + result = CommandLine('qstat -f {}'.format(taskid), environ=dict(os.environ), terminal_output='allatonce', resource_monitor=False, ignore_exception=True).run() + + stdout = result.runtime.stdout stderr = result.runtime.stderr - errmsg = 'Unknown Job Id' # %s' % taskid + errmsg = 'Unknown Job Id' success = 'Job has finished' - if success in e: # Fix for my PBS + if (success in stderr) or ('job_state = C' in stdout): return False else: - return errmsg not in e + return errmsg not in stderr def _submit_batchtask(self, scriptfile, node): cmd = CommandLine('qsub', environ=dict(os.environ), From b10062f1c4c6b3770f313135d21537d6ec1fe08c Mon Sep 17 00:00:00 2001 From: achetverikov Date: Fri, 15 Dec 2017 22:47:20 +0100 Subject: [PATCH 061/365] Fixed small bug in plugins/base.py: string inf was supposed to be a number in debug logger --- nipype/pipeline/plugins/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/pipeline/plugins/base.py b/nipype/pipeline/plugins/base.py index e27733ab77..67f7328d13 100644 --- a/nipype/pipeline/plugins/base.py +++ b/nipype/pipeline/plugins/base.py @@ -281,7 +281,7 @@ def _send_procs_to_workers(self, updatehash=False, graph=None): if len(jobids) > 0: # send all available jobs - logger.info('Pending[%d] Submitting[%d] jobs Slots[%d]', + logger.info('Pending[%d] Submitting[%d] jobs Slots[%s]', num_jobs, len(jobids[:slots]), slots or 'inf') for jobid in jobids[:slots]: From 03a67a96f68e06b0f862a20f0a32e5e95eea10c4 Mon Sep 17 00:00:00 2001 From: salma1601 Date: Sun, 17 Dec 2017 13:42:50 +0100 Subject: [PATCH 062/365] add verbosity options --- nipype/interfaces/afni/preprocess.py | 6 ++++++ nipype/interfaces/afni/tests/test_auto_Allineate.py | 4 ++++ nipype/interfaces/afni/tests/test_auto_Copy.py | 2 ++ nipype/interfaces/afni/tests/test_auto_TCat.py | 2 ++ nipype/interfaces/afni/tests/test_auto_TStat.py | 2 ++ nipype/interfaces/afni/utils.py | 9 +++++++++ 6 files changed, 25 insertions(+) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index c96616273d..7c3b3359f4 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -438,6 +438,12 @@ class AllineateInputSpec(AFNICommandInputSpec): traits.Enum(*_dirs), argstr='-nwarp_fixdep%s', desc='To fix non-linear warp dependency along directions.') + verb = traits.Bool( + argstr='-verb', + desc='Print out verbose progress reports.') + quiet = traits.Bool( + argstr='-quiet', + desc='Don\'t print out verbose progress reports.') class AllineateOutputSpec(TraitedSpec): diff --git a/nipype/interfaces/afni/tests/test_auto_Allineate.py b/nipype/interfaces/afni/tests/test_auto_Allineate.py index b8b79df004..0fd29f1479 100644 --- a/nipype/interfaces/afni/tests/test_auto_Allineate.py +++ b/nipype/interfaces/afni/tests/test_auto_Allineate.py @@ -95,6 +95,8 @@ def test_Allineate_inputs(): outputtype=dict(), overwrite=dict(argstr='-overwrite', ), + quiet=dict(argstr='-quiet', + ), reference=dict(argstr='-base %s', ), replacebase=dict(argstr='-replacebase', @@ -118,6 +120,8 @@ def test_Allineate_inputs(): ), usetemp=dict(argstr='-usetemp', ), + verb=dict(argstr='-verb', + ), warp_type=dict(argstr='-warp %s', ), warpfreeze=dict(argstr='-warpfreeze', diff --git a/nipype/interfaces/afni/tests/test_auto_Copy.py b/nipype/interfaces/afni/tests/test_auto_Copy.py index 0917a0628e..273cb9bbb6 100644 --- a/nipype/interfaces/afni/tests/test_auto_Copy.py +++ b/nipype/interfaces/afni/tests/test_auto_Copy.py @@ -30,6 +30,8 @@ def test_Copy_inputs(): terminal_output=dict(deprecated='1.0.0', nohash=True, ), + verb=dict(argstr='-verb', + ), ) inputs = Copy.input_spec() diff --git a/nipype/interfaces/afni/tests/test_auto_TCat.py b/nipype/interfaces/afni/tests/test_auto_TCat.py index 597ead13cb..b28f983fa7 100644 --- a/nipype/interfaces/afni/tests/test_auto_TCat.py +++ b/nipype/interfaces/afni/tests/test_auto_TCat.py @@ -32,6 +32,8 @@ def test_TCat_inputs(): terminal_output=dict(deprecated='1.0.0', nohash=True, ), + verb=dict(argstr='-verb', + ), ) inputs = TCat.input_spec() diff --git a/nipype/interfaces/afni/tests/test_auto_TStat.py b/nipype/interfaces/afni/tests/test_auto_TStat.py index 2315d81512..f2a0bc561b 100644 --- a/nipype/interfaces/afni/tests/test_auto_TStat.py +++ b/nipype/interfaces/afni/tests/test_auto_TStat.py @@ -33,6 +33,8 @@ def test_TStat_inputs(): terminal_output=dict(deprecated='1.0.0', nohash=True, ), + verbose=dict(argstr='-verb %s', + ), ) inputs = TStat.input_spec() diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 3e03adda92..0a71ea340a 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -751,6 +751,9 @@ class CopyInputSpec(AFNICommandInputSpec): argstr='%s', position=-1, name_source='in_file') + verb = traits.Bool( + desc='print progress reports', + argstr='-verb') class Copy(AFNICommand): @@ -1377,6 +1380,9 @@ class MaskToolInputSpec(AFNICommandInputSpec): 'or using the labels in {R,L,A,P,I,S}.', argstr='-fill_dirs %s', requires=['fill_holes']) + verbose = traits.Int( + desc='specify verbosity level, for 0 to 3', + argstr='-verb %s') class MaskToolOutputSpec(TraitedSpec): @@ -1985,6 +1991,9 @@ class TCatInputSpec(AFNICommandInputSpec): 'dataset mean back in. Option -rlt++ adds overall mean of all ' 'dataset timeseries back in.', position=1) + verb = traits.Bool( + desc='Print out some verbose output as the program', + argstr='-verb') class TCat(AFNICommand): From a9099ed219d8aa9171f527db6bcdb553bf6a4c6e Mon Sep 17 00:00:00 2001 From: salma1601 Date: Sun, 17 Dec 2017 13:47:29 +0100 Subject: [PATCH 063/365] update MaskTool test --- nipype/interfaces/afni/tests/test_auto_MaskTool.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nipype/interfaces/afni/tests/test_auto_MaskTool.py b/nipype/interfaces/afni/tests/test_auto_MaskTool.py index 775b34adab..eeaef55562 100644 --- a/nipype/interfaces/afni/tests/test_auto_MaskTool.py +++ b/nipype/interfaces/afni/tests/test_auto_MaskTool.py @@ -49,6 +49,8 @@ def test_MaskTool_inputs(): ), union=dict(argstr='-union', ), + verbose=dict(argstr='-verb %s', + ), ) inputs = MaskTool.input_spec() From 6e487b76968b0b177c7efd7a8c3c3945c22d51db Mon Sep 17 00:00:00 2001 From: salma1601 Date: Sun, 17 Dec 2017 13:47:52 +0100 Subject: [PATCH 064/365] update Tstat test --- nipype/interfaces/afni/tests/test_auto_TStat.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/nipype/interfaces/afni/tests/test_auto_TStat.py b/nipype/interfaces/afni/tests/test_auto_TStat.py index f2a0bc561b..2315d81512 100644 --- a/nipype/interfaces/afni/tests/test_auto_TStat.py +++ b/nipype/interfaces/afni/tests/test_auto_TStat.py @@ -33,8 +33,6 @@ def test_TStat_inputs(): terminal_output=dict(deprecated='1.0.0', nohash=True, ), - verbose=dict(argstr='-verb %s', - ), ) inputs = TStat.input_spec() From 6829757e45360fec94c0d7aefe80f02d8f2c444a Mon Sep 17 00:00:00 2001 From: salma1601 Date: Mon, 18 Dec 2017 16:56:17 +0100 Subject: [PATCH 065/365] rather use verbose than verb --- nipype/interfaces/afni/preprocess.py | 4 ++-- nipype/interfaces/afni/tests/test_auto_Allineate.py | 2 +- nipype/interfaces/afni/tests/test_auto_Copy.py | 2 +- nipype/interfaces/afni/tests/test_auto_TCat.py | 2 +- nipype/interfaces/afni/utils.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 7c3b3359f4..5d90591953 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -438,12 +438,12 @@ class AllineateInputSpec(AFNICommandInputSpec): traits.Enum(*_dirs), argstr='-nwarp_fixdep%s', desc='To fix non-linear warp dependency along directions.') - verb = traits.Bool( + verbose = traits.Bool( argstr='-verb', desc='Print out verbose progress reports.') quiet = traits.Bool( argstr='-quiet', - desc='Don\'t print out verbose progress reports.') + desc="Don't print out verbose progress reports.") class AllineateOutputSpec(TraitedSpec): diff --git a/nipype/interfaces/afni/tests/test_auto_Allineate.py b/nipype/interfaces/afni/tests/test_auto_Allineate.py index 0fd29f1479..73ecc66414 100644 --- a/nipype/interfaces/afni/tests/test_auto_Allineate.py +++ b/nipype/interfaces/afni/tests/test_auto_Allineate.py @@ -120,7 +120,7 @@ def test_Allineate_inputs(): ), usetemp=dict(argstr='-usetemp', ), - verb=dict(argstr='-verb', + verbose=dict(argstr='-verb', ), warp_type=dict(argstr='-warp %s', ), diff --git a/nipype/interfaces/afni/tests/test_auto_Copy.py b/nipype/interfaces/afni/tests/test_auto_Copy.py index 273cb9bbb6..43fa537eb4 100644 --- a/nipype/interfaces/afni/tests/test_auto_Copy.py +++ b/nipype/interfaces/afni/tests/test_auto_Copy.py @@ -30,7 +30,7 @@ def test_Copy_inputs(): terminal_output=dict(deprecated='1.0.0', nohash=True, ), - verb=dict(argstr='-verb', + verbose=dict(argstr='-verb', ), ) inputs = Copy.input_spec() diff --git a/nipype/interfaces/afni/tests/test_auto_TCat.py b/nipype/interfaces/afni/tests/test_auto_TCat.py index b28f983fa7..f74a122828 100644 --- a/nipype/interfaces/afni/tests/test_auto_TCat.py +++ b/nipype/interfaces/afni/tests/test_auto_TCat.py @@ -32,7 +32,7 @@ def test_TCat_inputs(): terminal_output=dict(deprecated='1.0.0', nohash=True, ), - verb=dict(argstr='-verb', + verbose=dict(argstr='-verb', ), ) inputs = TCat.input_spec() diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 0a71ea340a..bce63c61e0 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -751,7 +751,7 @@ class CopyInputSpec(AFNICommandInputSpec): argstr='%s', position=-1, name_source='in_file') - verb = traits.Bool( + verbose = traits.Bool( desc='print progress reports', argstr='-verb') @@ -1991,7 +1991,7 @@ class TCatInputSpec(AFNICommandInputSpec): 'dataset mean back in. Option -rlt++ adds overall mean of all ' 'dataset timeseries back in.', position=1) - verb = traits.Bool( + verbose = traits.Bool( desc='Print out some verbose output as the program', argstr='-verb') From c3ccafe47abad8cf8974e11b387f448e507752c8 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Tue, 19 Dec 2017 11:54:26 -0500 Subject: [PATCH 066/365] Minor fixes (style) --- nipype/interfaces/mrtrix3/preprocess.py | 8 ++++---- nipype/interfaces/mrtrix3/reconst.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 0ef19d763b..0eedc3f449 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -23,7 +23,7 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum('msmt_5tt','dhollander','tournier','tax', argstr='%s', position=-6, mandatory=True, desc='response estimation algorithm (multi-tissue)') - dwi_file = File(exists=True, argstr='%s', position=-5, + in_file = File(exists=True, argstr='%s', position=-5, mandatory=True, desc='input DWI image') mtt_file = File(argstr='%s', position=-4, desc='input 5tt image') wm_file = File('wm.txt', argstr='%s', position=-3, usedefault=True, @@ -52,7 +52,7 @@ class ResponseSD(MRTrix3Base): >>> import nipype.interfaces.mrtrix3 as mrt >>> resp = mrt.ResponseSD() - >>> resp.inputs.dwi_file = 'dwi.mif' + >>> resp.inputs.in_file = 'dwi.mif' >>> resp.inputs.algorithm = 'tournier' >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') >>> resp.cmdline # doctest: +ELLIPSIS @@ -67,9 +67,9 @@ class ResponseSD(MRTrix3Base): def _list_outputs(self): outputs = self.output_spec().get() outputs['wm_file'] = op.abspath(self.inputs.wm_file) - if self.inputs.gm_file!=Undefined: + if self.inputs.gm_file != Undefined: outputs['gm_file'] = op.abspath(self.inputs.gm_file) - if self.inputs.csf_file!=Undefined: + if self.inputs.csf_file != Undefined: outputs['csf_file'] = op.abspath(self.inputs.csf_file) return outputs diff --git a/nipype/interfaces/mrtrix3/reconst.py b/nipype/interfaces/mrtrix3/reconst.py index a5ce55b506..f7ea4f01e4 100644 --- a/nipype/interfaces/mrtrix3/reconst.py +++ b/nipype/interfaces/mrtrix3/reconst.py @@ -76,7 +76,7 @@ def _list_outputs(self): class EstimateFODInputSpec(MRTrix3BaseInputSpec): algorithm = traits.Enum('csd','msmt_csd', argstr='%s', position=-8, mandatory=True, desc='FOD algorithm') - dwi_file = File(exists=True, argstr='%s', position=-7, + in_file = File(exists=True, argstr='%s', position=-7, mandatory=True, desc='input DWI image') wm_txt = File(argstr='%s', position=-6, mandatory=True, desc='WM response text file') @@ -118,7 +118,7 @@ class EstimateFOD(MRTrix3Base): >>> import nipype.interfaces.mrtrix3 as mrt >>> fod = mrt.EstimateFOD() >>> fod.inputs.algorithm = 'csd' - >>> fod.inputs.dwi_file = 'dwi.mif' + >>> fod.inputs.in_file = 'dwi.mif' >>> fod.inputs.wm_txt = 'wm.txt' >>> fod.inputs.grad_fsl = ('bvecs', 'bvals') >>> fod.cmdline # doctest: +ELLIPSIS @@ -133,9 +133,9 @@ class EstimateFOD(MRTrix3Base): def _list_outputs(self): outputs = self.output_spec().get() outputs['wm_odf'] = op.abspath(self.inputs.wm_odf) - if self.inputs.gm_odf!=Undefined: + if self.inputs.gm_odf != Undefined: outputs['gm_odf'] = op.abspath(self.inputs.gm_odf) - if self.inputs.csf_odf!=Undefined: + if self.inputs.csf_odf != Undefined: outputs['csf_odf'] = op.abspath(self.inputs.csf_odf) return outputs From 119730769173e4a97aa13cfddfea2daad3b06017 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Tue, 19 Dec 2017 12:01:44 -0500 Subject: [PATCH 067/365] Minor fixes (tests) --- nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py | 8 ++++---- nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py b/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py index b1836bd6d9..a62c21d989 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_EstimateFOD.py @@ -18,10 +18,6 @@ def test_EstimateFOD_inputs(): csf_txt=dict(argstr='%s', position=-2, ), - dwi_file=dict(argstr='%s', - mandatory=True, - position=-7, - ), environ=dict(nohash=True, usedefault=True, ), @@ -44,6 +40,10 @@ def test_EstimateFOD_inputs(): ), in_dirs=dict(argstr='-directions %s', ), + in_file=dict(argstr='%s', + mandatory=True, + position=-7, + ), mask_file=dict(argstr='-mask %s', ), max_sh=dict(argstr='-lmax %d', diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py index 0917f5d6a3..ff93d1a8a9 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py @@ -15,10 +15,6 @@ def test_ResponseSD_inputs(): csf_file=dict(argstr='%s', position=-1, ), - dwi_file=dict(argstr='%s', - mandatory=True, - position=-5, - ), environ=dict(nohash=True, usedefault=True, ), @@ -36,6 +32,10 @@ def test_ResponseSD_inputs(): in_bval=dict(), in_bvec=dict(argstr='-fslgrad %s %s', ), + in_file=dict(argstr='%s', + mandatory=True, + position=-5, + ), in_mask=dict(argstr='-mask %s', ), max_sh=dict(argstr='-lmax %d', From 7af657a6f641beba85412eaa22efb0cd82bad042 Mon Sep 17 00:00:00 2001 From: Dorota Jarecka Date: Thu, 21 Dec 2017 13:23:07 -0500 Subject: [PATCH 068/365] applying suggestions from Oscar --- nipype/interfaces/ants/registration.py | 35 +++++++++++--------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/nipype/interfaces/ants/registration.py b/nipype/interfaces/ants/registration.py index 3c746cafda..3e44158dff 100644 --- a/nipype/interfaces/ants/registration.py +++ b/nipype/interfaces/ants/registration.py @@ -1352,9 +1352,6 @@ def aggregate_outputs(self, runtime=None, needed_outputs=None): return outputs - - - class RegistrationSynQuickInputSpec(ANTSCommandInputSpec): dimension = traits.Enum(3, 2, argstr='-d %d', usedefault=True, desc='image dimension (2 or 3)') @@ -1362,24 +1359,25 @@ class RegistrationSynQuickInputSpec(ANTSCommandInputSpec): desc='Fixed image or source image or reference image') moving_image = InputMultiPath(File(exists=True), mandatory=True, argstr='-m %s', desc='Moving image or target image') - output_prefix = traits.Str("transform", usedefault=True, argstr='-o %s', - desc="A prefix that is prepended to all output files") + output_prefix = Str("transform", usedefault=True, argstr='-o %s', + desc="A prefix that is prepended to all output files") # todo ANTSCommandInputSpec already has this, but I can't figure out how to set it without defining it again num_threads = traits.Int(default_value=1, desc='Number of threads (default = 1)', argstr='-n %d') transform_type = traits.Enum('s', 't', 'r', 'a', 'sr', 'b', 'br', argstr='-t %s', - desc='transform type\n\ - t: translation\ - r: rigid \n\ - a: rigid + affine\n\ - s: rigid + affine + deformable syn (default)\ - sr: rigid + deformable syn\ - b: rigid + affine + deformable b-spline syn\n\ - br: rigid + deformable b-spline syn', + desc=""" + transform type + t: translation + r: rigid + a: rigid + affine + s: rigid + affine + deformable syn (default) + sr: rigid + deformable syn + b: rigid + affine + deformable b-spline syn + br: rigid + deformable b-spline syn""", usedefault=True) - use_histogram_matching = traits.Bool(default=False, argstr='-j %s', + use_histogram_matching = traits.Bool(False, argstr='-j %d', desc='use histogram matching') histogram_bins = traits.Int(default_value=32, argstr='-r %d', desc='histogram bins for mutual information in SyN stage \ @@ -1412,13 +1410,8 @@ class RegistrationSynQuick(ANTSCommand): output_spec = RegistrationSynQuickOutputSpec def _format_arg(self, name, spec, value): - if name == 'use_histogram_matching': - if isdefined(self.inputs.use_histogram_matching): - return spec.argstr % {False: '0', True: '1'}[value] - - elif name == 'precision_type': - if isdefined(self.inputs.precision_type): - return spec.argstr % {'float': 'f', 'double': 'd'}[value] + if name == 'precision_type': + return spec.argstr % value[0] return super(RegistrationSynQuick, self)._format_arg(name, spec, value) def _list_outputs(self): From a98420289882924b3aed8f9c5dda63ac2e0fe703 Mon Sep 17 00:00:00 2001 From: oesteban Date: Thu, 21 Dec 2017 15:53:40 -0800 Subject: [PATCH 069/365] wip - refactoring --- nipype/pipeline/engine/nodes.py | 882 +++++++++++++++++--------------- 1 file changed, 473 insertions(+), 409 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index e0caaa194a..900b9db0fd 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -149,38 +149,41 @@ def __init__(self, interface, name, iterables=None, itersource=None, multiprocessing pool """ - base_dir = None - if 'base_dir' in kwargs: - base_dir = kwargs['base_dir'] - super(Node, self).__init__(name, base_dir) - # Make sure an interface is set, and that it is an Interface if interface is None: raise IOError('Interface must be provided') if not isinstance(interface, Interface): raise IOError('interface must be an instance of an Interface') + + base_dir = None + if 'base_dir' in kwargs: + base_dir = kwargs['base_dir'] + super(Node, self).__init__(name, base_dir) + self._interface = interface self.name = name - + self._got_inputs = False self._output_dir = None self.iterables = iterables self.synchronize = synchronize self.itersource = itersource self.overwrite = overwrite self.parameterization = None - self.run_without_submitting = run_without_submitting self.input_source = {} - self.needed_outputs = [] self.plugin_args = {} + self.run_without_submitting = run_without_submitting self._mem_gb = mem_gb self._n_procs = n_procs + + # Downstream n_procs if hasattr(self._interface.inputs, 'num_threads') and self._n_procs is not None: self._interface.inputs.num_threads = self._n_procs + # Initialize needed_outputs + self.needed_outputs = [] if needed_outputs: self.needed_outputs = sorted(needed_outputs) - self._got_inputs = False @property def interface(self): @@ -189,7 +192,7 @@ def interface(self): @property def result(self): - return self._load_resultfile(self.output_dir())[0] + return _load_resultfile(self.output_dir(), self.name)[0] @property def inputs(self): @@ -246,7 +249,7 @@ def output_dir(self): if self.parameterization: params_str = ['{}'.format(p) for p in self.parameterization] if not str2bool(self.config['execution']['parameterize_dirs']): - params_str = [self._parameterization_dir(p) for p in params_str] + params_str = [_parameterization_dir(p) for p in params_str] outputdir = op.join(outputdir, *params_str) self._output_dir = op.abspath(op.join(outputdir, self.name)) @@ -254,7 +257,7 @@ def output_dir(self): def set_input(self, parameter, val): """ Set interface input value""" - logger.debug('setting nodelevel(%s) input %s = %s', + logger.debug('[Node] %s - setting input %s = %s', self.name, parameter, to_str(val)) setattr(self.inputs, parameter, deepcopy(val)) @@ -267,36 +270,63 @@ def help(self): self._interface.help() def hash_exists(self, updatehash=False): + """ + Check if the interface has been run previously, and whether + cached results are viable for reuse + """ + # Get a dictionary with hashed filenames and a hashvalue # of the dictionary itself. hashed_inputs, hashvalue = self._get_hashval() outdir = self.output_dir() hashfile = op.join(outdir, '_0x%s.json' % hashvalue) - logger.debug('Node hash value: %s', hashvalue) + hash_exists = op.exists(hashfile) + + logger.debug('[Node] hash value=%s, exists=%s', hashvalue, hash_exists) if op.exists(outdir): + # Find previous hashfiles + hashfiles = glob(op.join(outdir, '_0x*.json')) + if len(hashfiles) > 1: + raise RuntimeError( + '[Node] Cache ERROR - Found %d previous hashfiles that indicate ' + 'that the ``base_dir`` for this node went stale. Please re-run the ' + 'workflow.' % len(hashfiles)) + # Find unfinished hashfiles and error if any unfinished = glob(op.join(outdir, '_0x*_unfinished.json')) if unfinished: raise RuntimeError( - '[Caching Node Error] Found unfinished hashfiles (%d) that indicate ' + '[Node] Cache ERROR - Found unfinished hashfiles (%d) that indicate ' 'that the ``base_dir`` for this node went stale. Please re-run the ' 'workflow.' % len(unfinished)) - # Find previous hashfiles - hashfiles = glob(op.join(outdir, '_0x*.json')) - # Remove hashfiles if more than one found or the one found is outdated - if hashfiles and (len(hashfiles) > 1 or hashfiles[0] != hashfile): - logger.info('Removing hashfiles (%s) and forcing node to rerun', - ', '.join(['"%s"' % op.basename(h) for h in hashfiles])) - for hf in hashfiles: - os.remove(hf) + # Remove outdated hashfile + if hashfiles and hashfiles[0] != hashfile: + logger.info('[Node] Removing outdated hashfile (%s) and forcing node to rerun', + op.basename(hashfiles[0])) - if updatehash: - logger.debug("Updating hash: %s", hashvalue) - self._save_hashfile(hashfile, hashed_inputs) + # In DEBUG, print diff between hashes + log_debug = config.get('logging', 'workflow_level') == 'DEBUG' + if log_debug and hash_exists: # Lazy logging - only debug + split_out = split_filename(hashfiles[0]) + exp_hash_file_base = split_out[1] + exp_hash = exp_hash_file_base[len('_0x'):] + logger.debug("Previous node hash = %s", exp_hash) + try: + prev_inputs = load_json(hashfiles[0]) + except Exception: + pass + else: + logging.logdebug_dict_differences( + prev_inputs, hashed_inputs) + os.remove(hashfiles[0]) + + # Update only possible if it exists + if hash_exists and updatehash: + logger.debug("[Node] Updating hash: %s", hashvalue) + _save_hashfile(hashfile, hashed_inputs) - hash_exists = op.exists(hashfile) logger.debug( 'updatehash=%s, overwrite=%s, always_run=%s, hash_exists=%s, ' 'hash_method=%s', updatehash, self.overwrite, self._interface.always_run, @@ -312,15 +342,11 @@ def run(self, updatehash=False): updatehash: boolean Update the hash stored in the output directory """ - cwd = os.getcwd() # First thing, keep track of where we are if self.config is None: self.config = {} self.config = merge_dict(deepcopy(config._sections), self.config) - - if not self._got_inputs: - self._get_inputs() - self._got_inputs = True + self._get_inputs() # Check if output directory exists outdir = self.output_dir() @@ -328,18 +354,14 @@ def run(self, updatehash=False): logger.debug('Output directory (%s) exists and is %sempty,', outdir, 'not ' * bool(os.listdir(outdir))) - # Make sure outdir is created - makedirs(outdir, exist_ok=True) - os.chdir(outdir) - # Check hash, check whether run should be enforced logger.info('[Node] Setting-up "%s" in "%s".', self.fullname, outdir) hash_info = self.hash_exists(updatehash=updatehash) hash_exists, hashvalue, hashfile, hashed_inputs = hash_info force_run = self.overwrite or (self.overwrite is None and self._interface.always_run) - # If the node is cached, set-up pklz files and exit - if updatehash or (hash_exists and not force_run): + # If the node is cached, check on pklz files and finish + if hash_exists and (updatehash or not force_run): logger.debug("Only updating node hashes or skipping execution") inputs_file = op.join(outdir, '_inputs.pklz') if not op.exists(inputs_file): @@ -351,34 +373,14 @@ def run(self, updatehash=False): logger.debug('Creating node file %s', node_file) savepkl(node_file, self) - self._run_interface(execute=False, updatehash=updatehash) - logger.info('[Node] Cached "%s".', self.fullname) - os.chdir(cwd) - return self.result + result = self._run_interface(execute=False, updatehash=updatehash) + logger.info('[Node] "%s" found cached%s.', self.fullname, + ' (and hash updated)' * updatehash) + return result # by rerunning we mean only nodes that did finish to run previously - json_pat = op.join(outdir, '_0x*.json') - json_unfinished_pat = op.join(outdir, '_0x*_unfinished.json') - is_mapnode = isinstance(self, MapNode) - need_rerun = (not is_mapnode and - glob(json_pat) and not glob(json_unfinished_pat)) - if need_rerun: - log_debug = config.get('logging', 'workflow_level') == 'DEBUG' + if hash_exists and not isinstance(self, MapNode): logger.debug('[Node] Rerunning "%s"', self.fullname) - if log_debug and not hash_exists: # Lazy logging - only debug - exp_hash_paths = glob(json_pat) - if len(exp_hash_paths) == 1: - split_out = split_filename(exp_hash_paths[0]) - exp_hash_file_base = split_out[1] - exp_hash = exp_hash_file_base[len('_0x'):] - logger.debug("Previous node hash = %s", exp_hash) - try: - prev_inputs = load_json(exp_hash_paths[0]) - except: - pass - else: - logging.logdebug_dict_differences(prev_inputs, - hashed_inputs) if not force_run and str2bool(self.config['execution']['stop_on_first_rerun']): raise Exception('Cannot rerun when "stop_on_first_rerun" is set to True') @@ -389,60 +391,51 @@ def run(self, updatehash=False): os.remove(hashfile) # Delete directory contents if this is not a MapNode or can't resume - rm_outdir = not is_mapnode and not ( + rm_outdir = not isinstance(self, MapNode) and not ( self._interface.can_resume and op.isfile(hashfile_unfinished)) if rm_outdir: emptydirs(outdir) else: - logger.debug( - "%s hashfile=%s", '[MapNode] Resume -' if is_mapnode - else '[Node] Resume - can_resume=True,', hashfile_unfinished) - if is_mapnode: + logger.debug('[%sNode] Resume - hashfile=%s', + 'Map' * int(isinstance(self, MapNode)), + hashfile_unfinished) + if isinstance(self, MapNode): # remove old json files for filename in glob(op.join(outdir, '_0x*.json')): os.remove(filename) + # Make sure outdir is created + makedirs(outdir, exist_ok=True) + # Store runtime-hashfile, pre-execution report, the node and the inputs set. - self._save_hashfile(hashfile_unfinished, hashed_inputs) - self.write_report(report_type='preexec', cwd=outdir) + _save_hashfile(hashfile_unfinished, hashed_inputs) + write_report(self, report_type='preexec', cwd=outdir) savepkl(op.join(outdir, '_node.pklz'), self) savepkl(op.join(outdir, '_inputs.pklz'), self.inputs.get_traitsfree()) + + cwd = os.getcwd() + os.chdir(outdir) try: - self._run_interface(execute=True) - except: + result = self._run_interface(execute=True) + except Exception: logger.warning('[Node] Exception "%s" (%s)', self.fullname, outdir) # Tear-up after error os.remove(hashfile_unfinished) - os.chdir(cwd) raise + finally: # Ensure we come back to the original CWD + os.chdir(cwd) # Tear-up after success shutil.move(hashfile_unfinished, hashfile) - self.write_report(report_type='postexec', cwd=outdir) + write_report(self, report_type='postexec', cwd=outdir) logger.info('[Node] Finished "%s".', self.fullname) - os.chdir(cwd) - return self.result - - # Private functions - def _parameterization_dir(self, param): - """ - Returns the directory name for the given parameterization string as follows: - - If the parameterization is longer than 32 characters, then - return the SHA-1 hex digest. - - Otherwise, return the parameterization unchanged. - """ - if len(param) > 32: - return sha1(param.encode()).hexdigest() - else: - return param + return result def _get_hashval(self): """Return a hash of the input state""" - if not self._got_inputs: - self._get_inputs() - self._got_inputs = True + self._get_inputs() hashed_inputs, hashvalue = self.inputs.get_hashval( hash_method=self.config['execution']['hash_method']) rm_extra = self.config['execution']['remove_unnecessary_outputs'] @@ -455,30 +448,15 @@ def _get_hashval(self): hashed_inputs.append(('needed_outputs', sorted_outputs)) return hashed_inputs, hashvalue - def _save_hashfile(self, hashfile, hashed_inputs): - try: - save_json(hashfile, hashed_inputs) - except (IOError, TypeError): - err_type = sys.exc_info()[0] - if err_type is TypeError: - # XXX - SG current workaround is to just - # create the hashed file and not put anything - # in it - with open(hashfile, 'wt') as fd: - fd.writelines(str(hashed_inputs)) - - logger.debug( - 'Unable to write a particular type to the json file') - else: - logger.critical('Unable to open the file in write mode: %s', - hashfile) - def _get_inputs(self): """Retrieve inputs from pointers to results file This mechanism can be easily extended/replaced to retrieve data from other data sources (e.g., XNAT, HTTP, etc.,.) """ + if self._got_inputs: + return + logger.debug('Setting node inputs') for key, info in list(self.input_source.items()): logger.debug('input: %s', key) @@ -490,9 +468,8 @@ def _get_inputs(self): output_name = info[1][0] value = getattr(results.outputs, output_name) if isdefined(value): - output_value = evaluate_connect_function(info[1][1], - info[1][2], - value) + output_value = evaluate_connect_function( + info[1][1], info[1][2], value) else: output_name = info[1] try: @@ -511,85 +488,16 @@ def _get_inputs(self): e.args = (e.args[0] + "\n" + '\n'.join(msg),) raise + # Successfully set inputs + self._got_inputs = True + def _run_interface(self, execute=True, updatehash=False): if updatehash: - return + return self._load_results(self.output_dir()) return self._run_command(execute) - def _save_results(self, result, cwd): - resultsfile = op.join(cwd, 'result_%s.pklz' % self.name) - if result.outputs: - try: - outputs = result.outputs.get() - except TypeError: - outputs = result.outputs.dictcopy() # outputs was a bunch - result.outputs.set(**modify_paths(outputs, relative=True, - basedir=cwd)) - - savepkl(resultsfile, result) - logger.debug('saved results in %s', resultsfile) - - if result.outputs: - result.outputs.set(**outputs) - - def _load_resultfile(self, cwd): - """Load results if it exists in cwd - - Parameter - --------- - - cwd : working directory of node - - Returns - ------- - - result : InterfaceResult structure - aggregate : boolean indicating whether node should aggregate_outputs - attribute error : boolean indicating whether there was some mismatch in - versions of traits used to store result and hence node needs to - rerun - """ - aggregate = True - resultsoutputfile = op.join(cwd, 'result_%s.pklz' % self.name) - result = None - attribute_error = False - if op.exists(resultsoutputfile): - pkl_file = gzip.open(resultsoutputfile, 'rb') - try: - result = pickle.load(pkl_file) - except UnicodeDecodeError: - # Was this pickle created with Python 2.x? - pickle.load(pkl_file, fix_imports=True, encoding='utf-8') - logger.warn('Successfully loaded pickle in compatibility mode') - except (traits.TraitError, AttributeError, ImportError, - EOFError) as err: - if isinstance(err, (AttributeError, ImportError)): - attribute_error = True - logger.debug('attribute error: %s probably using ' - 'different trait pickled file', str(err)) - else: - logger.debug( - 'some file does not exist. hence trait cannot be set') - else: - if result.outputs: - try: - outputs = result.outputs.get() - except TypeError: - outputs = result.outputs.dictcopy() # outputs == Bunch - try: - result.outputs.set(**modify_paths(outputs, - relative=False, - basedir=cwd)) - except FileNotFoundError: - logger.debug('conversion to full path results in ' - 'non existent file') - aggregate = False - pkl_file.close() - logger.debug('Aggregate: %s', aggregate) - return result, aggregate, attribute_error - def _load_results(self, cwd): - result, aggregate, attribute_error = self._load_resultfile(cwd) + result, aggregate, attribute_error = _load_resultfile(cwd, self.name) # try aggregating first if aggregate: logger.debug('aggregating results') @@ -609,176 +517,122 @@ def _load_results(self, cwd): runtime=runtime, inputs=self._interface.inputs.get_traitsfree(), outputs=aggouts) - self._save_results(result, cwd) + _save_resultfile(result, cwd, self.name) else: logger.debug('aggregating mapnode results') result = self._run_interface() return result def _run_command(self, execute, copyfiles=True): - cwd = os.getcwd() - if execute and copyfiles: + outdir = self.output_dir() + + if not execute: + try: + result = self._load_results(outdir) + except (FileNotFoundError, AttributeError): + # if aggregation does not work, rerun the node + logger.info("[Node] Some of the outputs were not found: " + "rerunning node.") + copyfiles = False # OE: this was like this before, + execute = True # I'll keep them for safety + else: + logger.info( + "[Node] Cached - collecting precomputed outputs") + return result + + # Run command: either execute is true or load_results failed. + runtime = Bunch(returncode=1, + environ=dict(os.environ), + hostname=socket.gethostname()) + result = InterfaceResult( + interface=self._interface.__class__, + runtime=runtime, + inputs=self._interface.inputs.get_traitsfree()) + + if copyfiles: self._originputs = deepcopy(self._interface.inputs) - if execute: - runtime = Bunch(returncode=1, - environ=dict(os.environ), - hostname=socket.gethostname()) - result = InterfaceResult( - interface=self._interface.__class__, - runtime=runtime, - inputs=self._interface.inputs.get_traitsfree()) - - if copyfiles: - self._copyfiles_to_wd(cwd, execute) - - message = '[Node] Running "%s" ("%s.%s")' - if issubclass(self._interface.__class__, CommandLine): - try: - cmd = self._interface.cmdline - except Exception as msg: - result.runtime.stderr = msg - raise - cmdfile = op.join(cwd, 'command.txt') - with open(cmdfile, 'wt') as fd: - print(cmd + "\n", file=fd) - message += ', a CommandLine Interface with command:\n%s' % cmd - logger.info(message + '.', self.name, self._interface.__module__, - self._interface.__class__.__name__) + self._copyfiles_to_wd(outdir, execute) + + message = '[Node] Running "%s" ("%s.%s")' + if issubclass(self._interface.__class__, CommandLine): try: - result = self._interface.run() + cmd = self._interface.cmdline except Exception as msg: - self._save_results(result, cwd) result.runtime.stderr = msg raise + cmdfile = op.join(outdir, 'command.txt') + with open(cmdfile, 'wt') as fd: + print(cmd + "\n", file=fd) + message += ', a CommandLine Interface with command:\n%s' % cmd + logger.info(message, self.name, self._interface.__module__, + self._interface.__class__.__name__) + try: + result = self._interface.run() + except Exception as msg: + _save_resultfile(result, outdir, self.name) + result.runtime.stderr = msg + raise - dirs2keep = None - if isinstance(self, MapNode): - dirs2keep = [op.join(cwd, 'mapflow')] - result.outputs = clean_working_directory(result.outputs, cwd, - self._interface.inputs, - self.needed_outputs, - self.config, - dirs2keep=dirs2keep) - self._save_results(result, cwd) - else: - logger.info("Collecting precomputed outputs") - try: - result = self._load_results(cwd) - except (FileNotFoundError, AttributeError): - # if aggregation does not work, rerun the node - logger.info(("Some of the outputs were not found: " - "rerunning node.")) - result = self._run_command(execute=True, copyfiles=False) - return result + dirs2keep = None + if isinstance(self, MapNode): + dirs2keep = [op.join(outdir, 'mapflow')] + result.outputs = clean_working_directory(result.outputs, outdir, + self._interface.inputs, + self.needed_outputs, + self.config, + dirs2keep=dirs2keep) + _save_resultfile(result, outdir, self.name) - def _strip_temp(self, files, wd): - out = [] - for f in files: - if isinstance(f, list): - out.append(self._strip_temp(f, wd)) - else: - out.append(f.replace(op.join(wd, '_tempinput'), wd)) - return out + return result def _copyfiles_to_wd(self, outdir, execute, linksonly=False): """ copy files over and change the inputs""" - if hasattr(self._interface, '_get_filecopy_info'): - logger.debug('copying files to wd [execute=%s, linksonly=%s]', - str(execute), str(linksonly)) - if execute and linksonly: - olddir = outdir - outdir = op.join(outdir, '_tempinput') - makedirs(outdir, exist_ok=True) - for info in self._interface._get_filecopy_info(): - files = self.inputs.get().get(info['key']) - if not isdefined(files): - continue - if files: - infiles = filename_to_list(files) - if execute: - if linksonly: - if not info['copy']: - newfiles = copyfiles(infiles, - [outdir], - copy=info['copy'], - create_new=True) - else: - newfiles = fnames_presuffix(infiles, - newpath=outdir) - newfiles = self._strip_temp( - newfiles, - op.abspath(olddir).split(op.sep)[-1]) - else: - newfiles = copyfiles(infiles, - [outdir], - copy=info['copy'], - create_new=True) + if not hasattr(self._interface, '_get_filecopy_info'): + # Nothing to be done + return + + logger.debug('copying files to wd [execute=%s, linksonly=%s]', + execute, linksonly) + if execute and linksonly: + olddir = outdir + outdir = op.join(outdir, '_tempinput') + makedirs(outdir, exist_ok=True) + + for info in self._interface._get_filecopy_info(): + files = self.inputs.get().get(info['key']) + if not isdefined(files) or not files: + continue + + infiles = filename_to_list(files) + if execute: + if linksonly: + if not info['copy']: + newfiles = copyfiles(infiles, + [outdir], + copy=info['copy'], + create_new=True) else: - newfiles = fnames_presuffix(infiles, newpath=outdir) - if not isinstance(files, list): - newfiles = list_to_filename(newfiles) - setattr(self.inputs, info['key'], newfiles) - if execute and linksonly: - rmtree(outdir) + newfiles = fnames_presuffix(infiles, + newpath=outdir) + newfiles = _strip_temp( + newfiles, + op.abspath(olddir).split(op.sep)[-1]) + else: + newfiles = copyfiles(infiles, + [outdir], + copy=info['copy'], + create_new=True) + else: + newfiles = fnames_presuffix(infiles, newpath=outdir) + if not isinstance(files, list): + newfiles = list_to_filename(newfiles) + setattr(self.inputs, info['key'], newfiles) + if execute and linksonly: + rmtree(outdir) def update(self, **opts): self.inputs.update(**opts) - def write_report(self, report_type=None, cwd=None): - if not str2bool(self.config['execution']['create_report']): - return - report_dir = op.join(cwd, '_report') - report_file = op.join(report_dir, 'report.rst') - makedirs(report_dir, exist_ok=True) - - if report_type == 'preexec': - logger.debug('writing pre-exec report to %s', report_file) - fp = open(report_file, 'wt') - fp.writelines(write_rst_header('Node: %s' % get_print_name(self), - level=0)) - fp.writelines(write_rst_list(['Hierarchy : %s' % self.fullname, - 'Exec ID : %s' % self._id])) - fp.writelines(write_rst_header('Original Inputs', level=1)) - fp.writelines(write_rst_dict(self.inputs.get())) - if report_type == 'postexec': - logger.debug('writing post-exec report to %s', report_file) - fp = open(report_file, 'at') - fp.writelines(write_rst_header('Execution Inputs', level=1)) - fp.writelines(write_rst_dict(self.inputs.get())) - exit_now = (not hasattr(self.result, 'outputs') or - self.result.outputs is None) - if exit_now: - return - fp.writelines(write_rst_header('Execution Outputs', level=1)) - if isinstance(self.result.outputs, Bunch): - fp.writelines(write_rst_dict(self.result.outputs.dictcopy())) - elif self.result.outputs: - fp.writelines(write_rst_dict(self.result.outputs.get())) - if isinstance(self, MapNode): - fp.close() - return - fp.writelines(write_rst_header('Runtime info', level=1)) - # Init rst dictionary of runtime stats - rst_dict = {'hostname': self.result.runtime.hostname, - 'duration': self.result.runtime.duration} - # Try and insert memory/threads usage if available - if config.resource_monitor: - rst_dict['mem_peak_gb'] = self.result.runtime.mem_peak_gb - rst_dict['cpu_percent'] = self.result.runtime.cpu_percent - - if hasattr(self.result.runtime, 'cmdline'): - rst_dict['command'] = self.result.runtime.cmdline - fp.writelines(write_rst_dict(rst_dict)) - else: - fp.writelines(write_rst_dict(rst_dict)) - if hasattr(self.result.runtime, 'merged'): - fp.writelines(write_rst_header('Terminal output', level=2)) - fp.writelines(write_rst_list(self.result.runtime.merged)) - if hasattr(self.result.runtime, 'environ'): - fp.writelines(write_rst_header('Environment', level=2)) - fp.writelines(write_rst_dict(self.result.runtime.environ)) - fp.close() - class JoinNode(Node): """Wraps interface objects that join inputs into a list. @@ -1099,9 +953,7 @@ def _set_mapnode_input(self, object, name, newvalue): def _get_hashval(self): """ Compute hash including iterfield lists.""" - if not self._got_inputs: - self._get_inputs() - self._got_inputs = True + self._get_inputs() self._check_iterfield() hashinputs = deepcopy(self._interface.inputs) for name in self.iterfield: @@ -1147,7 +999,7 @@ def _make_nodes(self, cwd=None): else: nitems = len(filename_to_list(getattr(self.inputs, self.iterfield[0]))) for i in range(nitems): - nodename = '_' + self.name + str(i) + nodename = '_%s%d' % (self.name, i) node = Node(deepcopy(self._interface), n_procs=self._n_procs, mem_gb=self._mem_gb, @@ -1169,20 +1021,6 @@ def _make_nodes(self, cwd=None): node.config = self.config yield i, node - def _node_runner(self, nodes, updatehash=False): - old_cwd = os.getcwd() - for i, node in nodes: - err = None - try: - node.run(updatehash=updatehash) - except Exception as this_err: - err = this_err - if str2bool(self.config['execution']['stop_on_first_crash']): - raise - finally: - os.chdir(old_cwd) - yield i, node, err - def _collate_results(self, nodes): result = InterfaceResult( interface=[], runtime=[], provenance=[], inputs=[], @@ -1235,43 +1073,14 @@ def _collate_results(self, nodes): return result - def write_report(self, report_type=None, cwd=None): - if not str2bool(self.config['execution']['create_report']): - return - if report_type == 'preexec': - super(MapNode, self).write_report(report_type=report_type, cwd=cwd) - if report_type == 'postexec': - super(MapNode, self).write_report(report_type=report_type, cwd=cwd) - report_dir = op.join(cwd, '_report') - report_file = op.join(report_dir, 'report.rst') - fp = open(report_file, 'at') - fp.writelines(write_rst_header('Subnode reports', level=1)) - nitems = len(filename_to_list( - getattr(self.inputs, self.iterfield[0]))) - subnode_report_files = [] - for i in range(nitems): - nodename = '_' + self.name + str(i) - subnode_report_files.insert(i, 'subnode %d' % i + ' : ' + - op.join(cwd, - 'mapflow', - nodename, - '_report', - 'report.rst')) - fp.writelines(write_rst_list(subnode_report_files)) - fp.close() - def get_subnodes(self): - if not self._got_inputs: - self._get_inputs() - self._got_inputs = True + self._get_inputs() self._check_iterfield() - self.write_report(report_type='preexec', cwd=self.output_dir()) + write_report(self, report_type='preexec', cwd=self.output_dir()) return [node for _, node in self._make_nodes()] def num_subnodes(self): - if not self._got_inputs: - self._get_inputs() - self._got_inputs = True + self._get_inputs() self._check_iterfield() if self._serial: return 1 @@ -1314,30 +1123,285 @@ def _run_interface(self, execute=True, updatehash=False): This is primarily intended for serial execution of mapnode. A parallel execution requires creation of new nodes that can be spawned """ - old_cwd = os.getcwd() - cwd = self.output_dir() - os.chdir(cwd) self._check_iterfield() - if execute: - if self.nested: - nitems = len(filename_to_list(flatten(getattr(self.inputs, - self.iterfield[0])))) + cwd = self.output_dir() + if not execute: + result = self._load_results(cwd) + return result + + # Set up mapnode folder names + if self.nested: + nitems = len(filename_to_list(flatten(getattr(self.inputs, + self.iterfield[0])))) + else: + nitems = len(filename_to_list(getattr(self.inputs, + self.iterfield[0]))) + nnametpl = '_%s{}' % self.name + nodenames = [nnametpl.format(i) for i in range(nitems)] + + # Run mapnode + result = self._collate_results(self._node_runner( + self._make_nodes(cwd), + updatehash=updatehash, + stop_first=str2bool(self.config['execution']['stop_on_first_crash']) + )) + # And store results + _save_resultfile(result, cwd, self.name) + # remove any node directories no longer required + dirs2remove = [] + for path in glob(op.join(cwd, 'mapflow', '*')): + if op.isdir(path): + if path.split(op.sep)[-1] not in nodenames: + dirs2remove.append(path) + for path in dirs2remove: + shutil.rmtree(path) + + return result + + +def _parameterization_dir(param): + """ + Returns the directory name for the given parameterization string as follows: + - If the parameterization is longer than 32 characters, then + return the SHA-1 hex digest. + - Otherwise, return the parameterization unchanged. + """ + if len(param) > 32: + return sha1(param.encode()).hexdigest() + else: + return param + + +def _save_hashfile(hashfile, hashed_inputs): + try: + save_json(hashfile, hashed_inputs) + except (IOError, TypeError): + err_type = sys.exc_info()[0] + if err_type is TypeError: + # XXX - SG current workaround is to just + # create the hashed file and not put anything + # in it + with open(hashfile, 'wt') as fd: + fd.writelines(str(hashed_inputs)) + + logger.debug( + 'Unable to write a particular type to the json file') + else: + logger.critical('Unable to open the file in write mode: %s', + hashfile) + + +def _node_runner(nodes, updatehash=False, stop_first=False): + """ + A generator that iterates and over a list of ``nodes`` and + executes them. + + """ + for i, node in nodes: + err = None + try: + result = node.run(updatehash=updatehash) + except Exception as this_err: + err = this_err + if stop_first: + raise + finally: + yield i, result, err + + +def write_report(node, report_type=None, cwd=None): + if not str2bool(node.config['execution']['create_report']): + return + + if cwd is None: + cwd = node.output_dir() + + if report_type not in ['preexec', 'postexec']: + logger.warning('[Node] Unknown report type "%s".', report_type) + return + + report_dir = op.join(cwd, '_report') + report_file = op.join(report_dir, 'report.rst') + makedirs(report_dir, exist_ok=True) + + logger.debug('[Node] Writing %s-exec report to "%s"', + report_type[:-4], report_file) + if report_type.startswith('pre'): + lines = [ + write_rst_header('Node: %s' % get_print_name(node), level=0), + write_rst_list(['Hierarchy : %s' % node.fullname, + 'Exec ID : %s' % node._id]), + write_rst_header('Original Inputs', level=1), + write_rst_dict(node.inputs.get()), + ] + with open(report_file, 'wt') as fp: + fp.write('\n'.join(lines)) + return + + lines = [ + write_rst_header('Execution Inputs', level=1), + write_rst_dict(node.inputs.get()), + ] + + result = node.result # Locally cache result + outputs = result.get('outputs') + + if outputs is None: + with open(report_file, 'at') as fp: + fp.write('\n'.join(lines)) + return + + lines.append(write_rst_header('Execution Outputs', level=1)) + + if isinstance(outputs, Bunch): + lines.append(write_rst_dict(outputs.dictcopy())) + elif outputs: + lines.append(write_rst_dict(outputs.get())) + + if isinstance(node, MapNode): + lines.append(write_rst_header('Subnode reports', level=1)) + nitems = len(filename_to_list( + getattr(node.inputs, node.iterfield[0]))) + subnode_report_files = [] + for i in range(nitems): + nodecwd = op.join( + cwd, 'mapflow', '_%s%d' % (node.name, i), + '_report', 'report.rst') + subnode_report_files.append( + 'subnode %d : %s' % (i, nodecwd)) + + lines.append(write_rst_list(subnode_report_files)) + + with open(report_file, 'at') as fp: + fp.write('\n'.join(lines)) + return + + lines.append(write_rst_header('Runtime info', level=1)) + # Init rst dictionary of runtime stats + rst_dict = { + 'hostname': result.runtime.hostname, + 'duration': result.runtime.duration, + } + + if hasattr(result.runtime, 'cmdline'): + rst_dict['command'] = result.runtime.cmdline + + # Try and insert memory/threads usage if available + if node.config.resource_monitor: + rst_dict['mem_peak_gb'] = result.runtime.mem_peak_gb + rst_dict['cpu_percent'] = result.runtime.cpu_percent + + lines.append(write_rst_dict(rst_dict)) + + # Collect terminal output + if hasattr(result.runtime, 'merged'): + lines += [ + write_rst_header('Terminal output', level=2), + write_rst_list(result.runtime.merged), + ] + if hasattr(result.runtime, 'stdout'): + lines += [ + write_rst_header('Terminal - standard output', level=2), + write_rst_list(result.runtime.stdout), + ] + if hasattr(result.runtime, 'stderr'): + lines += [ + write_rst_header('Terminal - standard error', level=2), + write_rst_list(result.runtime.stderr), + ] + + # Store environment + if hasattr(result.runtime, 'environ'): + lines += [ + write_rst_header('Environment', level=2), + write_rst_dict(result.runtime.environ), + ] + + with open(report_file, 'at') as fp: + fp.write('\n'.join(lines)) + return + + +def _save_resultfile(result, cwd, name): + """Save a result pklz file to ``cwd``""" + resultsfile = op.join(cwd, 'result_%s.pklz' % name) + if result.outputs: + try: + outputs = result.outputs.get() + except TypeError: + outputs = result.outputs.dictcopy() # outputs was a bunch + result.outputs.set(**modify_paths( + outputs, relative=True, basedir=cwd)) + + savepkl(resultsfile, result) + logger.debug('saved results in %s', resultsfile) + + if result.outputs: + result.outputs.set(**outputs) + + +def _load_resultfile(cwd, name): + """Load results if it exists in cwd + + Parameter + --------- + + cwd : working directory of node + + Returns + ------- + + result : InterfaceResult structure + aggregate : boolean indicating whether node should aggregate_outputs + attribute error : boolean indicating whether there was some mismatch in + versions of traits used to store result and hence node needs to + rerun + """ + aggregate = True + resultsoutputfile = op.join(cwd, 'result_%s.pklz' % name) + result = None + attribute_error = False + if op.exists(resultsoutputfile): + pkl_file = gzip.open(resultsoutputfile, 'rb') + try: + result = pickle.load(pkl_file) + except UnicodeDecodeError: + # Was this pickle created with Python 2.x? + pickle.load(pkl_file, fix_imports=True, encoding='utf-8') + logger.warn('Successfully loaded pickle in compatibility mode') + except (traits.TraitError, AttributeError, ImportError, + EOFError) as err: + if isinstance(err, (AttributeError, ImportError)): + attribute_error = True + logger.debug('attribute error: %s probably using ' + 'different trait pickled file', str(err)) else: - nitems = len(filename_to_list(getattr(self.inputs, - self.iterfield[0]))) - nodenames = ['_' + self.name + str(i) for i in range(nitems)] - result = self._collate_results( - self._node_runner(self._make_nodes(cwd), - updatehash=updatehash)) - self._save_results(result, cwd) - # remove any node directories no longer required - dirs2remove = [] - for path in glob(op.join(cwd, 'mapflow', '*')): - if op.isdir(path): - if path.split(op.sep)[-1] not in nodenames: - dirs2remove.append(path) - for path in dirs2remove: - shutil.rmtree(path) + logger.debug( + 'some file does not exist. hence trait cannot be set') else: - result = self._load_results(cwd) - os.chdir(old_cwd) + if result.outputs: + try: + outputs = result.outputs.get() + except TypeError: + outputs = result.outputs.dictcopy() # outputs == Bunch + try: + result.outputs.set(**modify_paths(outputs, + relative=False, + basedir=cwd)) + except FileNotFoundError: + logger.debug('conversion to full path results in ' + 'non existent file') + aggregate = False + pkl_file.close() + logger.debug('Aggregate: %s', aggregate) + return result, aggregate, attribute_error + + +def _strip_temp(files, wd): + out = [] + for f in files: + if isinstance(f, list): + out.append(_strip_temp(f, wd)) + else: + out.append(f.replace(op.join(wd, '_tempinput'), wd)) + return out From e975626d57a43dc946a4d6420500ace94000d91f Mon Sep 17 00:00:00 2001 From: oesteban Date: Thu, 21 Dec 2017 19:27:51 -0800 Subject: [PATCH 070/365] fix emptydirs --- nipype/pipeline/engine/nodes.py | 2 +- nipype/utils/filemanip.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 900b9db0fd..4ad5fbca45 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -395,7 +395,7 @@ def run(self, updatehash=False): self._interface.can_resume and op.isfile(hashfile_unfinished)) if rm_outdir: - emptydirs(outdir) + emptydirs(outdir, noexist_ok=True) else: logger.debug('[%sNode] Resume - hashfile=%s', 'Map' * int(isinstance(self, MapNode)), diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index adc2752f56..5ffefc1af1 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -699,9 +699,10 @@ def makedirs(path, exist_ok=False): return path -def emptydirs(path): +def emptydirs(path, noexist_ok=False): """ - Empty an existing directory, without deleting it + Empty an existing directory, without deleting it. Do not + raise error if the path does not exist and noexist_ok is True. Parameters ---------- @@ -709,8 +710,11 @@ def emptydirs(path): """ fmlogger.debug("Removing contents of %s", path) - pathconts = os.listdir(path) + if noexist_ok and not os.path.exists(path): + return True + + pathconts = os.listdir(path) if not pathconts: return True From 73ec692d98faf51689564ed3cc8747bf87ce5283 Mon Sep 17 00:00:00 2001 From: oesteban Date: Thu, 21 Dec 2017 20:07:45 -0800 Subject: [PATCH 071/365] fix write_report --- nipype/pipeline/engine/nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 4ad5fbca45..33b9a24cbc 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -1244,7 +1244,7 @@ def write_report(node, report_type=None, cwd=None): ] result = node.result # Locally cache result - outputs = result.get('outputs') + outputs = result.outputs if outputs is None: with open(report_file, 'at') as fp: From d256a5932245e59a1d545927728cd1ec532c34d2 Mon Sep 17 00:00:00 2001 From: Dorota Jarecka Date: Fri, 22 Dec 2017 05:13:55 -0500 Subject: [PATCH 072/365] running check-before-commit --- doc/users/config_file.rst | 2 +- doc/users/plugins.rst | 4 +- .../ants/tests/test_auto_Registration.py | 157 ------------------ .../tests/test_auto_RegistrationSynQuick.py | 64 +++++++ .../niftyseg/tests/test_auto_PatchMatch.py | 61 ------- 5 files changed, 67 insertions(+), 221 deletions(-) delete mode 100644 nipype/interfaces/ants/tests/test_auto_Registration.py create mode 100644 nipype/interfaces/ants/tests/test_auto_RegistrationSynQuick.py delete mode 100644 nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index f53a2900db..279dc1aadd 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -170,7 +170,7 @@ Resource Monitor Indicates where the summary file collecting all profiling information from the resource monitor should be stored after execution of a workflow. The ``summary_file`` does not apply to interfaces run independently. - (unset by default, in which case the summary file will be written out to + (unset by default, in which case the summary file will be written out to ``/resource_monitor.json`` of the top-level workflow). *summary_append* diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index 501e7aa1d6..e655e5f6db 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: diff --git a/nipype/interfaces/ants/tests/test_auto_Registration.py b/nipype/interfaces/ants/tests/test_auto_Registration.py deleted file mode 100644 index ea9bc02e79..0000000000 --- a/nipype/interfaces/ants/tests/test_auto_Registration.py +++ /dev/null @@ -1,157 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..registration import Registration - - -def test_Registration_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - collapse_output_transforms=dict(argstr='--collapse-output-transforms %d', - usedefault=True, - ), - convergence_threshold=dict(requires=['number_of_iterations'], - usedefault=True, - ), - convergence_window_size=dict(requires=['convergence_threshold'], - usedefault=True, - ), - dimension=dict(argstr='--dimensionality %d', - usedefault=True, - ), - environ=dict(nohash=True, - usedefault=True, - ), - fixed_image=dict(mandatory=True, - ), - fixed_image_mask=dict(argstr='%s', - max_ver='2.1.0', - xor=['fixed_image_masks'], - ), - fixed_image_masks=dict(min_ver='2.2.0', - xor=['fixed_image_mask'], - ), - float=dict(argstr='--float %d', - ), - ignore_exception=dict(deprecated='1.0.0', - nohash=True, - usedefault=True, - ), - initial_moving_transform=dict(argstr='%s', - exists=True, - xor=['initial_moving_transform_com'], - ), - initial_moving_transform_com=dict(argstr='%s', - xor=['initial_moving_transform'], - ), - initialize_transforms_per_stage=dict(argstr='--initialize-transforms-per-stage %d', - usedefault=True, - ), - interpolation=dict(argstr='%s', - usedefault=True, - ), - interpolation_parameters=dict(), - invert_initial_moving_transform=dict(requires=['initial_moving_transform'], - xor=['initial_moving_transform_com'], - ), - metric=dict(mandatory=True, - ), - metric_item_trait=dict(), - metric_stage_trait=dict(), - metric_weight=dict(mandatory=True, - requires=['metric'], - usedefault=True, - ), - metric_weight_item_trait=dict(), - metric_weight_stage_trait=dict(), - moving_image=dict(mandatory=True, - ), - moving_image_mask=dict(max_ver='2.1.0', - requires=['fixed_image_mask'], - xor=['moving_image_masks'], - ), - moving_image_masks=dict(min_ver='2.2.0', - xor=['moving_image_mask'], - ), - num_threads=dict(nohash=True, - usedefault=True, - ), - number_of_iterations=dict(), - output_inverse_warped_image=dict(hash_files=False, - requires=['output_warped_image'], - ), - output_transform_prefix=dict(argstr='%s', - usedefault=True, - ), - output_warped_image=dict(hash_files=False, - ), - radius_bins_item_trait=dict(), - radius_bins_stage_trait=dict(), - radius_or_number_of_bins=dict(requires=['metric_weight'], - usedefault=True, - ), - restore_state=dict(argstr='--restore-state %s', - ), - restrict_deformation=dict(), - sampling_percentage=dict(requires=['sampling_strategy'], - ), - sampling_percentage_item_trait=dict(), - sampling_percentage_stage_trait=dict(), - sampling_strategy=dict(requires=['metric_weight'], - ), - sampling_strategy_item_trait=dict(), - sampling_strategy_stage_trait=dict(), - save_state=dict(argstr='--save-state %s', - ), - shrink_factors=dict(mandatory=True, - ), - sigma_units=dict(requires=['smoothing_sigmas'], - ), - smoothing_sigmas=dict(mandatory=True, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - transform_parameters=dict(), - transforms=dict(argstr='%s', - mandatory=True, - ), - use_estimate_learning_rate_once=dict(), - use_histogram_matching=dict(usedefault=True, - ), - verbose=dict(argstr='-v', - ), - winsorize_lower_quantile=dict(argstr='%s', - usedefault=True, - ), - winsorize_upper_quantile=dict(argstr='%s', - usedefault=True, - ), - write_composite_transform=dict(argstr='--write-composite-transform %d', - usedefault=True, - ), - ) - inputs = Registration.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_Registration_outputs(): - output_map = dict(composite_transform=dict(), - elapsed_time=dict(), - forward_invert_flags=dict(), - forward_transforms=dict(), - inverse_composite_transform=dict(), - inverse_warped_image=dict(), - metric_value=dict(), - reverse_invert_flags=dict(), - reverse_transforms=dict(), - save_state=dict(), - warped_image=dict(), - ) - outputs = Registration.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/ants/tests/test_auto_RegistrationSynQuick.py b/nipype/interfaces/ants/tests/test_auto_RegistrationSynQuick.py new file mode 100644 index 0000000000..e781f27133 --- /dev/null +++ b/nipype/interfaces/ants/tests/test_auto_RegistrationSynQuick.py @@ -0,0 +1,64 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..registration import RegistrationSynQuick + + +def test_RegistrationSynQuick_inputs(): + input_map = dict(args=dict(argstr='%s', + ), + dimension=dict(argstr='-d %d', + usedefault=True, + ), + environ=dict(nohash=True, + usedefault=True, + ), + fixed_image=dict(argstr='-f %s', + mandatory=True, + ), + histogram_bins=dict(argstr='-r %d', + ), + ignore_exception=dict(deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + moving_image=dict(argstr='-m %s', + mandatory=True, + ), + num_threads=dict(argstr='-n %d', + ), + output_prefix=dict(argstr='-o %s', + usedefault=True, + ), + precision_type=dict(argstr='-p %s', + usedefault=True, + ), + spline_distance=dict(argstr='-s %d', + ), + terminal_output=dict(deprecated='1.0.0', + nohash=True, + ), + transform_type=dict(argstr='-t %s', + usedefault=True, + ), + use_histogram_matching=dict(argstr='-j %d', + ), + ) + inputs = RegistrationSynQuick.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value + + +def test_RegistrationSynQuick_outputs(): + output_map = dict(forward_warp_field=dict(), + inverse_warp_field=dict(), + inverse_warped_image=dict(), + out_matrix=dict(), + warped_image=dict(), + ) + outputs = RegistrationSynQuick.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py b/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py deleted file mode 100644 index ba6ea5a40c..0000000000 --- a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py +++ /dev/null @@ -1,61 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..patchmatch import PatchMatch - - -def test_PatchMatch_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - cs_size=dict(argstr='-cs %i', - ), - database_file=dict(argstr='-db %s', - mandatory=True, - position=3, - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(deprecated='1.0.0', - nohash=True, - usedefault=True, - ), - in_file=dict(argstr='-i %s', - mandatory=True, - position=1, - ), - it_num=dict(argstr='-it %i', - ), - mask_file=dict(argstr='-m %s', - mandatory=True, - position=2, - ), - match_num=dict(argstr='-match %i', - ), - out_file=dict(argstr='-o %s', - name_source=['in_file'], - name_template='%s_pm.nii.gz', - position=4, - ), - patch_size=dict(argstr='-size %i', - ), - pm_num=dict(argstr='-pm %i', - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - ) - inputs = PatchMatch.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_PatchMatch_outputs(): - output_map = dict(out_file=dict(), - ) - outputs = PatchMatch.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value From cc72fbe4d7341b1146df4f000d42f18635510410 Mon Sep 17 00:00:00 2001 From: Dorota Jarecka Date: Fri, 22 Dec 2017 06:24:14 -0500 Subject: [PATCH 073/365] small pep8 changes --- nipype/interfaces/ants/registration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/ants/registration.py b/nipype/interfaces/ants/registration.py index 3e44158dff..82d100ae0b 100644 --- a/nipype/interfaces/ants/registration.py +++ b/nipype/interfaces/ants/registration.py @@ -1031,6 +1031,7 @@ def _format_winsorize_image_intensities(self): self._quantilesDone = True return '--winsorize-image-intensities [ %s, %s ]' % (self.inputs.winsorize_lower_quantile, self.inputs.winsorize_upper_quantile) + def _get_initial_transform_filenames(self): n_transforms = len(self.inputs.initial_moving_transform) @@ -1428,4 +1429,3 @@ def _list_outputs(self): outputs['inverse_warp_field'] = os.path.abspath( self.inputs.output_prefix + '1InverseWarp.nii.gz') return outputs - From ead00d703c24add30330df12a068b4d618f107f4 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 22 Dec 2017 14:12:46 -0800 Subject: [PATCH 074/365] refactor nodes --- nipype/pipeline/engine/nodes.py | 438 +++++--------------- nipype/pipeline/engine/tests/test_engine.py | 1 - nipype/pipeline/engine/utils.py | 313 ++++++++++++-- nipype/pipeline/engine/workflows.py | 7 - nipype/utils/filemanip.py | 124 ++++-- 5 files changed, 458 insertions(+), 425 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 33b9a24cbc..34aa2028d3 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -19,25 +19,22 @@ from collections import OrderedDict -from copy import deepcopy -import pickle -from glob import glob -import gzip import os import os.path as op import shutil import socket -from shutil import rmtree -import sys +from copy import deepcopy +from glob import glob + from tempfile import mkdtemp -from hashlib import sha1 +from future import standard_library from ... import config, logging from ...utils.misc import (flatten, unflatten, str2bool) from ...utils.filemanip import ( - md5, save_json, FileNotFoundError, filename_to_list, list_to_filename, + md5, FileNotFoundError, filename_to_list, list_to_filename, copyfiles, fnames_presuffix, loadpkl, split_filename, load_json, makedirs, - emptydirs, savepkl, write_rst_header, write_rst_dict, write_rst_list, to_str + emptydirs, savepkl, to_str ) from ...interfaces.base import ( @@ -45,19 +42,26 @@ Bunch, InterfaceResult, Interface, isdefined ) from .utils import ( - modify_paths, clean_working_directory, get_print_name, + _parameterization_dir, + save_hashfile as _save_hashfile, + load_resultfile as _load_resultfile, + save_resultfile as _save_resultfile, + nodelist_runner as _node_runner, + strip_temp as _strip_temp, + write_report, + clean_working_directory, merge_dict, evaluate_connect_function ) from .base import EngineBase -from future import standard_library standard_library.install_aliases() logger = logging.getLogger('workflow') class Node(EngineBase): - """Wraps interface objects for use in pipeline + """ + Wraps interface objects for use in pipeline A Node creates a sandbox-like directory for executing the underlying interface. It will copy or link inputs into this directory to ensure that @@ -155,14 +159,13 @@ def __init__(self, interface, name, iterables=None, itersource=None, if not isinstance(interface, Interface): raise IOError('interface must be an instance of an Interface') - base_dir = None - if 'base_dir' in kwargs: - base_dir = kwargs['base_dir'] - super(Node, self).__init__(name, base_dir) + super(Node, self).__init__(name, kwargs.get('base_dir')) - self._interface = interface self.name = name + self._interface = interface + self._hierarchy = None self._got_inputs = False + self._originputs = None self._output_dir = None self.iterables = iterables self.synchronize = synchronize @@ -192,6 +195,7 @@ def interface(self): @property def result(self): + """Get result from result file (do not hold it in memory)""" return _load_resultfile(self.output_dir(), self.name)[0] @property @@ -219,11 +223,11 @@ def n_procs(self): """Get the estimated number of processes/threads""" if self._n_procs is not None: return self._n_procs - elif hasattr(self._interface.inputs, 'num_threads') and isdefined( - self._interface.inputs.num_threads): + if hasattr(self._interface.inputs, + 'num_threads') and isdefined(self._interface.inputs.num_threads): return self._interface.inputs.num_threads - else: - return 1 + + return 1 @n_procs.setter def n_procs(self, value): @@ -295,7 +299,8 @@ def hash_exists(self, updatehash=False): # Find unfinished hashfiles and error if any unfinished = glob(op.join(outdir, '_0x*_unfinished.json')) - if unfinished: + + if unfinished and updatehash: raise RuntimeError( '[Node] Cache ERROR - Found unfinished hashfiles (%d) that indicate ' 'that the ``base_dir`` for this node went stale. Please re-run the ' @@ -410,7 +415,8 @@ def run(self, updatehash=False): # Store runtime-hashfile, pre-execution report, the node and the inputs set. _save_hashfile(hashfile_unfinished, hashed_inputs) - write_report(self, report_type='preexec', cwd=outdir) + write_report(self, report_type='preexec', + is_mapnode=isinstance(self, MapNode)) savepkl(op.join(outdir, '_node.pklz'), self) savepkl(op.join(outdir, '_inputs.pklz'), self.inputs.get_traitsfree()) @@ -429,7 +435,8 @@ def run(self, updatehash=False): # Tear-up after success shutil.move(hashfile_unfinished, hashfile) - write_report(self, report_type='postexec', cwd=outdir) + write_report(self, report_type='postexec', + is_mapnode=isinstance(self, MapNode)) logger.info('[Node] Finished "%s".', self.fullname) return result @@ -493,10 +500,11 @@ def _get_inputs(self): def _run_interface(self, execute=True, updatehash=False): if updatehash: - return self._load_results(self.output_dir()) + return self._load_results() return self._run_command(execute) - def _load_results(self, cwd): + def _load_results(self): + cwd = self.output_dir() result, aggregate, attribute_error = _load_resultfile(cwd, self.name) # try aggregating first if aggregate: @@ -505,7 +513,7 @@ def _load_results(self, cwd): old_inputs = loadpkl(op.join(cwd, '_inputs.pklz')) self.inputs.trait_set(**old_inputs) if not isinstance(self, MapNode): - self._copyfiles_to_wd(cwd, True, linksonly=True) + self._copyfiles_to_wd(linksonly=True) aggouts = self._interface.aggregate_outputs( needed_outputs=self.needed_outputs) runtime = Bunch(cwd=cwd, @@ -524,11 +532,10 @@ def _load_results(self, cwd): return result def _run_command(self, execute, copyfiles=True): - outdir = self.output_dir() if not execute: try: - result = self._load_results(outdir) + result = self._load_results() except (FileNotFoundError, AttributeError): # if aggregation does not work, rerun the node logger.info("[Node] Some of the outputs were not found: " @@ -549,16 +556,19 @@ def _run_command(self, execute, copyfiles=True): runtime=runtime, inputs=self._interface.inputs.get_traitsfree()) + outdir = self.output_dir() if copyfiles: - self._originputs = deepcopy(self._interface.inputs) - self._copyfiles_to_wd(outdir, execute) + self._originputs = deepcopy(self.interface.inputs) + self._copyfiles_to_wd(execute=execute) message = '[Node] Running "%s" ("%s.%s")' if issubclass(self._interface.__class__, CommandLine): try: cmd = self._interface.cmdline except Exception as msg: - result.runtime.stderr = msg + result.runtime.stderr = '%s\n\n%s' % ( + getattr(result.runtime, 'stderr', ''), msg) + _save_resultfile(result, outdir, self.name) raise cmdfile = op.join(outdir, 'command.txt') with open(cmdfile, 'wt') as fd: @@ -569,23 +579,27 @@ def _run_command(self, execute, copyfiles=True): try: result = self._interface.run() except Exception as msg: + result.runtime.stderr = '%s\n\n%s' % ( + getattr(result.runtime, 'stderr', ''), msg) _save_resultfile(result, outdir, self.name) - result.runtime.stderr = msg raise dirs2keep = None if isinstance(self, MapNode): dirs2keep = [op.join(outdir, 'mapflow')] - result.outputs = clean_working_directory(result.outputs, outdir, - self._interface.inputs, - self.needed_outputs, - self.config, - dirs2keep=dirs2keep) + + result.outputs = clean_working_directory( + result.outputs, outdir, + self._interface.inputs, + self.needed_outputs, + self.config, + dirs2keep=dirs2keep + ) _save_resultfile(result, outdir, self.name) return result - def _copyfiles_to_wd(self, outdir, execute, linksonly=False): + def _copyfiles_to_wd(self, execute=True, linksonly=False): """ copy files over and change the inputs""" if not hasattr(self._interface, '_get_filecopy_info'): # Nothing to be done @@ -593,12 +607,14 @@ def _copyfiles_to_wd(self, outdir, execute, linksonly=False): logger.debug('copying files to wd [execute=%s, linksonly=%s]', execute, linksonly) + + outdir = self.output_dir() if execute and linksonly: olddir = outdir outdir = op.join(outdir, '_tempinput') makedirs(outdir, exist_ok=True) - for info in self._interface._get_filecopy_info(): + for info in self.interface._get_filecopy_info(): files = self.inputs.get().get(info['key']) if not isdefined(files) or not files: continue @@ -628,9 +644,10 @@ def _copyfiles_to_wd(self, outdir, execute, linksonly=False): newfiles = list_to_filename(newfiles) setattr(self.inputs, info['key'], newfiles) if execute and linksonly: - rmtree(outdir) + emptydirs(outdir, noexist_ok=True) def update(self, **opts): + """Update inputs""" self.inputs.update(**opts) @@ -684,7 +701,8 @@ def __init__(self, interface, name, joinsource, joinfield=None, """ super(JoinNode, self).__init__(interface, name, **kwargs) - self.joinsource = joinsource + self._joinsource = None # The member should be defined + self.joinsource = joinsource # Let the setter do the job """the join predecessor iterable node""" if not joinfield: @@ -759,7 +777,7 @@ def _add_join_item_field(self, field, index): Return the new field name """ # the new field name - name = self._join_item_field_name(field, index) + name = "%sJ%d" % (field, index + 1) # make a copy of the join trait trait = self._inputs.trait(field, False, True) # add the join item trait to the override traits @@ -767,10 +785,6 @@ def _add_join_item_field(self, field, index): return name - def _join_item_field_name(self, field, index): - """Return the field suffixed by the index + 1""" - return "%sJ%d" % (field, index + 1) - def _override_join_traits(self, basetraits, fields): """Convert the given join fields to accept an input that is a list item rather than a list. Non-join fields @@ -846,13 +860,14 @@ def _collate_input_value(self, field): basetrait = self._interface.inputs.trait(field) if isinstance(basetrait.trait_type, traits.Set): return set(val) - elif self._unique: + + if self._unique: return list(OrderedDict.fromkeys(val)) - else: - return val + + return val def _slot_value(self, field, index): - slot_field = self._join_item_field_name(field, index) + slot_field = "%sJ%d" % (field, index + 1) try: return getattr(self._inputs, slot_field) except AttributeError as e: @@ -894,10 +909,11 @@ def __init__(self, interface, iterfield, name, serial=False, nested=False, **kwa serial : boolean flag to enforce executing the jobs of the mapnode in a serial manner rather than parallel - nested : boolea - support for nested lists, if set the input list will be flattened - before running, and the nested list structure of the outputs will - be resored + nested : boolean + support for nested lists. If set, the input list will be flattened + before running and the nested list structure of the outputs will + be resored. + See Node docstring for additional keyword arguments. """ @@ -941,9 +957,9 @@ def set_input(self, parameter, val): """ logger.debug('setting nodelevel(%s) input %s = %s', to_str(self), parameter, to_str(val)) - self._set_mapnode_input(self.inputs, parameter, deepcopy(val)) + self._set_mapnode_input(parameter, deepcopy(val)) - def _set_mapnode_input(self, object, name, newvalue): + def _set_mapnode_input(self, name, newvalue): logger.debug('setting mapnode(%s) input: %s -> %s', to_str(self), name, to_str(newvalue)) if name in self.iterfield: @@ -988,8 +1004,6 @@ def inputs(self): def outputs(self): if self._interface._outputs(): return Bunch(self._interface._outputs().get()) - else: - return None def _make_nodes(self, cwd=None): if cwd is None: @@ -1011,6 +1025,7 @@ def _make_nodes(self, cwd=None): node.plugin_args = self.plugin_args node._interface.inputs.trait_set( **deepcopy(self._interface.inputs.get())) + node.interface.resource_monitor = self._interface.resource_monitor for field in self.iterfield: if self.nested: fieldvals = flatten(filename_to_list(getattr(self.inputs, field))) @@ -1022,20 +1037,22 @@ def _make_nodes(self, cwd=None): yield i, node def _collate_results(self, nodes): - result = InterfaceResult( + finalresult = InterfaceResult( interface=[], runtime=[], provenance=[], inputs=[], outputs=self.outputs) returncode = [] - for i, node, err in nodes: - result.runtime.insert(i, None) - if node.result: - if hasattr(node.result, 'runtime'): - result.interface.insert(i, node.result.interface) - result.inputs.insert(i, node.result.inputs) - result.runtime[i] = node.result.runtime - if hasattr(node.result, 'provenance'): - result.provenance.insert(i, node.result.provenance) + for i, nresult, err in nodes: + finalresult.runtime.insert(i, None) returncode.insert(i, err) + + if nresult: + if hasattr(nresult, 'runtime'): + finalresult.interface.insert(i, nresult.interface) + finalresult.inputs.insert(i, nresult.inputs) + finalresult.runtime[i] = nresult.runtime + if hasattr(nresult, 'provenance'): + finalresult.provenance.insert(i, nresult.provenance) + if self.outputs: for key, _ in list(self.outputs.items()): rm_extra = (self.config['execution'] @@ -1043,52 +1060,52 @@ def _collate_results(self, nodes): if str2bool(rm_extra) and self.needed_outputs: if key not in self.needed_outputs: continue - values = getattr(result.outputs, key) + values = getattr(finalresult.outputs, key) if not isdefined(values): values = [] - if node.result.outputs: - values.insert(i, node.result.outputs.get()[key]) + if nresult and nresult.outputs: + values.insert(i, nresult.outputs.get()[key]) else: values.insert(i, None) defined_vals = [isdefined(val) for val in values] - if any(defined_vals) and result.outputs: - setattr(result.outputs, key, values) + if any(defined_vals) and finalresult.outputs: + setattr(finalresult.outputs, key, values) if self.nested: for key, _ in list(self.outputs.items()): - values = getattr(result.outputs, key) + values = getattr(finalresult.outputs, key) if isdefined(values): values = unflatten(values, filename_to_list( getattr(self.inputs, self.iterfield[0]))) - setattr(result.outputs, key, values) + setattr(finalresult.outputs, key, values) if returncode and any([code is not None for code in returncode]): msg = [] for i, code in enumerate(returncode): if code is not None: msg += ['Subnode %d failed' % i] - msg += ['Error:', str(code)] + msg += ['Error: %s' % str(code)] raise Exception('Subnodes of node: %s failed:\n%s' % (self.name, '\n'.join(msg))) - return result + return finalresult def get_subnodes(self): + """Generate subnodes of a mapnode and write pre-execution report""" self._get_inputs() self._check_iterfield() - write_report(self, report_type='preexec', cwd=self.output_dir()) + write_report(self, report_type='preexec', is_mapnode=True) return [node for _, node in self._make_nodes()] def num_subnodes(self): + """Get the number of subnodes to iterate in this MapNode""" self._get_inputs() self._check_iterfield() if self._serial: return 1 - else: - if self.nested: - return len(filename_to_list(flatten(getattr(self.inputs, self.iterfield[0])))) - else: - return len(filename_to_list(getattr(self.inputs, self.iterfield[0]))) + if self.nested: + return len(filename_to_list(flatten(getattr(self.inputs, self.iterfield[0])))) + return len(filename_to_list(getattr(self.inputs, self.iterfield[0]))) def _get_inputs(self): old_inputs = self._inputs.get() @@ -1126,8 +1143,7 @@ def _run_interface(self, execute=True, updatehash=False): self._check_iterfield() cwd = self.output_dir() if not execute: - result = self._load_results(cwd) - return result + return self._load_results() # Set up mapnode folder names if self.nested: @@ -1140,7 +1156,7 @@ def _run_interface(self, execute=True, updatehash=False): nodenames = [nnametpl.format(i) for i in range(nitems)] # Run mapnode - result = self._collate_results(self._node_runner( + result = self._collate_results(_node_runner( self._make_nodes(cwd), updatehash=updatehash, stop_first=str2bool(self.config['execution']['stop_on_first_crash']) @@ -1157,251 +1173,3 @@ def _run_interface(self, execute=True, updatehash=False): shutil.rmtree(path) return result - - -def _parameterization_dir(param): - """ - Returns the directory name for the given parameterization string as follows: - - If the parameterization is longer than 32 characters, then - return the SHA-1 hex digest. - - Otherwise, return the parameterization unchanged. - """ - if len(param) > 32: - return sha1(param.encode()).hexdigest() - else: - return param - - -def _save_hashfile(hashfile, hashed_inputs): - try: - save_json(hashfile, hashed_inputs) - except (IOError, TypeError): - err_type = sys.exc_info()[0] - if err_type is TypeError: - # XXX - SG current workaround is to just - # create the hashed file and not put anything - # in it - with open(hashfile, 'wt') as fd: - fd.writelines(str(hashed_inputs)) - - logger.debug( - 'Unable to write a particular type to the json file') - else: - logger.critical('Unable to open the file in write mode: %s', - hashfile) - - -def _node_runner(nodes, updatehash=False, stop_first=False): - """ - A generator that iterates and over a list of ``nodes`` and - executes them. - - """ - for i, node in nodes: - err = None - try: - result = node.run(updatehash=updatehash) - except Exception as this_err: - err = this_err - if stop_first: - raise - finally: - yield i, result, err - - -def write_report(node, report_type=None, cwd=None): - if not str2bool(node.config['execution']['create_report']): - return - - if cwd is None: - cwd = node.output_dir() - - if report_type not in ['preexec', 'postexec']: - logger.warning('[Node] Unknown report type "%s".', report_type) - return - - report_dir = op.join(cwd, '_report') - report_file = op.join(report_dir, 'report.rst') - makedirs(report_dir, exist_ok=True) - - logger.debug('[Node] Writing %s-exec report to "%s"', - report_type[:-4], report_file) - if report_type.startswith('pre'): - lines = [ - write_rst_header('Node: %s' % get_print_name(node), level=0), - write_rst_list(['Hierarchy : %s' % node.fullname, - 'Exec ID : %s' % node._id]), - write_rst_header('Original Inputs', level=1), - write_rst_dict(node.inputs.get()), - ] - with open(report_file, 'wt') as fp: - fp.write('\n'.join(lines)) - return - - lines = [ - write_rst_header('Execution Inputs', level=1), - write_rst_dict(node.inputs.get()), - ] - - result = node.result # Locally cache result - outputs = result.outputs - - if outputs is None: - with open(report_file, 'at') as fp: - fp.write('\n'.join(lines)) - return - - lines.append(write_rst_header('Execution Outputs', level=1)) - - if isinstance(outputs, Bunch): - lines.append(write_rst_dict(outputs.dictcopy())) - elif outputs: - lines.append(write_rst_dict(outputs.get())) - - if isinstance(node, MapNode): - lines.append(write_rst_header('Subnode reports', level=1)) - nitems = len(filename_to_list( - getattr(node.inputs, node.iterfield[0]))) - subnode_report_files = [] - for i in range(nitems): - nodecwd = op.join( - cwd, 'mapflow', '_%s%d' % (node.name, i), - '_report', 'report.rst') - subnode_report_files.append( - 'subnode %d : %s' % (i, nodecwd)) - - lines.append(write_rst_list(subnode_report_files)) - - with open(report_file, 'at') as fp: - fp.write('\n'.join(lines)) - return - - lines.append(write_rst_header('Runtime info', level=1)) - # Init rst dictionary of runtime stats - rst_dict = { - 'hostname': result.runtime.hostname, - 'duration': result.runtime.duration, - } - - if hasattr(result.runtime, 'cmdline'): - rst_dict['command'] = result.runtime.cmdline - - # Try and insert memory/threads usage if available - if node.config.resource_monitor: - rst_dict['mem_peak_gb'] = result.runtime.mem_peak_gb - rst_dict['cpu_percent'] = result.runtime.cpu_percent - - lines.append(write_rst_dict(rst_dict)) - - # Collect terminal output - if hasattr(result.runtime, 'merged'): - lines += [ - write_rst_header('Terminal output', level=2), - write_rst_list(result.runtime.merged), - ] - if hasattr(result.runtime, 'stdout'): - lines += [ - write_rst_header('Terminal - standard output', level=2), - write_rst_list(result.runtime.stdout), - ] - if hasattr(result.runtime, 'stderr'): - lines += [ - write_rst_header('Terminal - standard error', level=2), - write_rst_list(result.runtime.stderr), - ] - - # Store environment - if hasattr(result.runtime, 'environ'): - lines += [ - write_rst_header('Environment', level=2), - write_rst_dict(result.runtime.environ), - ] - - with open(report_file, 'at') as fp: - fp.write('\n'.join(lines)) - return - - -def _save_resultfile(result, cwd, name): - """Save a result pklz file to ``cwd``""" - resultsfile = op.join(cwd, 'result_%s.pklz' % name) - if result.outputs: - try: - outputs = result.outputs.get() - except TypeError: - outputs = result.outputs.dictcopy() # outputs was a bunch - result.outputs.set(**modify_paths( - outputs, relative=True, basedir=cwd)) - - savepkl(resultsfile, result) - logger.debug('saved results in %s', resultsfile) - - if result.outputs: - result.outputs.set(**outputs) - - -def _load_resultfile(cwd, name): - """Load results if it exists in cwd - - Parameter - --------- - - cwd : working directory of node - - Returns - ------- - - result : InterfaceResult structure - aggregate : boolean indicating whether node should aggregate_outputs - attribute error : boolean indicating whether there was some mismatch in - versions of traits used to store result and hence node needs to - rerun - """ - aggregate = True - resultsoutputfile = op.join(cwd, 'result_%s.pklz' % name) - result = None - attribute_error = False - if op.exists(resultsoutputfile): - pkl_file = gzip.open(resultsoutputfile, 'rb') - try: - result = pickle.load(pkl_file) - except UnicodeDecodeError: - # Was this pickle created with Python 2.x? - pickle.load(pkl_file, fix_imports=True, encoding='utf-8') - logger.warn('Successfully loaded pickle in compatibility mode') - except (traits.TraitError, AttributeError, ImportError, - EOFError) as err: - if isinstance(err, (AttributeError, ImportError)): - attribute_error = True - logger.debug('attribute error: %s probably using ' - 'different trait pickled file', str(err)) - else: - logger.debug( - 'some file does not exist. hence trait cannot be set') - else: - if result.outputs: - try: - outputs = result.outputs.get() - except TypeError: - outputs = result.outputs.dictcopy() # outputs == Bunch - try: - result.outputs.set(**modify_paths(outputs, - relative=False, - basedir=cwd)) - except FileNotFoundError: - logger.debug('conversion to full path results in ' - 'non existent file') - aggregate = False - pkl_file.close() - logger.debug('Aggregate: %s', aggregate) - return result, aggregate, attribute_error - - -def _strip_temp(files, wd): - out = [] - for f in files: - if isinstance(f, list): - out.append(_strip_temp(f, wd)) - else: - out.append(f.replace(op.join(wd, '_tempinput'), wd)) - return out diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index 8b4d559ec0..034174758a 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -488,7 +488,6 @@ def func1(in1): name='n1') n1.inputs.in1 = [[1, [2]], 3, [4, 5]] n1.run() - print(n1.get_output('out')) assert n1.get_output('out') == [[2, [3]], 4, [5, 6]] n2 = MapNode(Function(input_names=['in1'], diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index 5c223329ff..f5a9214d95 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -15,6 +15,15 @@ from glob import glob from distutils.version import LooseVersion +from traceback import format_exception +from hashlib import sha1 +import gzip + +from ...utils.filemanip import ( + save_json, savepkl, + write_rst_header, write_rst_dict, write_rst_list +) + try: from inspect import signature except ImportError: @@ -25,12 +34,13 @@ import networkx as nx from ...utils.filemanip import ( - makedirs, fname_presuffix, to_str, - filename_to_list, get_related_files) + relpath, makedirs, fname_presuffix, to_str, + filename_to_list, get_related_files, FileNotFoundError) from ...utils.misc import str2bool from ...utils.functions import create_function_from_source -from ...interfaces.base import (CommandLine, isdefined, Undefined, - InterfaceResult) +from ...interfaces.base import ( + Bunch, CommandLine, isdefined, Undefined, + InterfaceResult, traits) from ...interfaces.utility import IdentityInterface from ...utils.provenance import ProvStore, pm, nipype_ns, get_id @@ -47,39 +57,268 @@ dfs_preorder = nx.dfs_preorder_nodes logger.debug('networkx 1.4 dev or higher detected') -try: - from os.path import relpath -except ImportError: - import os.path as op - - def relpath(path, start=None): - """Return a relative version of a path""" - if start is None: - start = os.curdir - if not path: - raise ValueError("no path specified") - start_list = op.abspath(start).split(op.sep) - path_list = op.abspath(path).split(op.sep) - if start_list[0].lower() != path_list[0].lower(): - unc_path, rest = op.splitunc(path) - unc_start, rest = op.splitunc(start) - if bool(unc_path) ^ bool(unc_start): - raise ValueError(("Cannot mix UNC and non-UNC paths " - "(%s and %s)") % (path, start)) - else: - raise ValueError("path is on drive %s, start on drive %s" - % (path_list[0], start_list[0])) - # Work out how much of the filepath is shared by start and path. - for i in range(min(len(start_list), len(path_list))): - if start_list[i].lower() != path_list[i].lower(): - break + +def _parameterization_dir(param): + """ + Returns the directory name for the given parameterization string as follows: + - If the parameterization is longer than 32 characters, then + return the SHA-1 hex digest. + - Otherwise, return the parameterization unchanged. + """ + if len(param) > 32: + return sha1(param.encode()).hexdigest() + return param + + +def save_hashfile(hashfile, hashed_inputs): + """Store a hashfile""" + try: + save_json(hashfile, hashed_inputs) + except (IOError, TypeError): + err_type = sys.exc_info()[0] + if err_type is TypeError: + # XXX - SG current workaround is to just + # create the hashed file and not put anything + # in it + with open(hashfile, 'wt') as fd: + fd.writelines(str(hashed_inputs)) + + logger.debug( + 'Unable to write a particular type to the json file') else: - i += 1 + logger.critical('Unable to open the file in write mode: %s', + hashfile) + + +def nodelist_runner(nodes, updatehash=False, stop_first=False): + """ + A generator that iterates and over a list of ``nodes`` and + executes them. + + """ + for i, node in nodes: + err = None + result = None + try: + result = node.run(updatehash=updatehash) + except Exception: + if stop_first: + raise + + result = node._load_results() + err = [] + if result.runtime and hasattr(result.runtime, 'traceback'): + err = [result.runtime.traceback] + + err += format_exception(*sys.exc_info()) + err = '\n'.join(err) + finally: + yield i, result, err + + +def write_report(node, report_type=None, is_mapnode=False): + """ + Write a report file for a node + + """ + if not str2bool(node.config['execution']['create_report']): + return + + if report_type not in ['preexec', 'postexec']: + logger.warning('[Node] Unknown report type "%s".', report_type) + return + + cwd = node.output_dir() + report_dir = os.path.join(cwd, '_report') + report_file = os.path.join(report_dir, 'report.rst') + makedirs(report_dir, exist_ok=True) + + logger.debug('[Node] Writing %s-exec report to "%s"', + report_type[:-4], report_file) + if report_type.startswith('pre'): + lines = [ + write_rst_header('Node: %s' % get_print_name(node), level=0), + write_rst_list(['Hierarchy : %s' % node.fullname, + 'Exec ID : %s' % node._id]), + write_rst_header('Original Inputs', level=1), + write_rst_dict(node.inputs.get()), + ] + with open(report_file, 'wt') as fp: + fp.write('\n'.join(lines)) + return + + lines = [ + write_rst_header('Execution Inputs', level=1), + write_rst_dict(node.inputs.get()), + ] + + result = node.result # Locally cache result + outputs = result.outputs + + if outputs is None: + with open(report_file, 'at') as fp: + fp.write('\n'.join(lines)) + return + + lines.append(write_rst_header('Execution Outputs', level=1)) + + if isinstance(outputs, Bunch): + lines.append(write_rst_dict(outputs.dictcopy())) + elif outputs: + lines.append(write_rst_dict(outputs.get())) + + if is_mapnode: + lines.append(write_rst_header('Subnode reports', level=1)) + nitems = len(filename_to_list( + getattr(node.inputs, node.iterfield[0]))) + subnode_report_files = [] + for i in range(nitems): + nodecwd = os.path.join( + cwd, 'mapflow', '_%s%d' % (node.name, i), + '_report', 'report.rst') + subnode_report_files.append( + 'subnode %d : %s' % (i, nodecwd)) + + lines.append(write_rst_list(subnode_report_files)) + + with open(report_file, 'at') as fp: + fp.write('\n'.join(lines)) + return + + lines.append(write_rst_header('Runtime info', level=1)) + # Init rst dictionary of runtime stats + rst_dict = { + 'hostname': result.runtime.hostname, + 'duration': result.runtime.duration, + } + + if hasattr(result.runtime, 'cmdline'): + rst_dict['command'] = result.runtime.cmdline + + # Try and insert memory/threads usage if available + if hasattr(result.runtime, 'mem_peak_gb'): + rst_dict['mem_peak_gb'] = result.runtime.mem_peak_gb + + if hasattr(result.runtime, 'cpu_percent'): + rst_dict['cpu_percent'] = result.runtime.cpu_percent + + lines.append(write_rst_dict(rst_dict)) + + # Collect terminal output + if hasattr(result.runtime, 'merged'): + lines += [ + write_rst_header('Terminal output', level=2), + write_rst_list(result.runtime.merged), + ] + if hasattr(result.runtime, 'stdout'): + lines += [ + write_rst_header('Terminal - standard output', level=2), + write_rst_list(result.runtime.stdout), + ] + if hasattr(result.runtime, 'stderr'): + lines += [ + write_rst_header('Terminal - standard error', level=2), + write_rst_list(result.runtime.stderr), + ] + + # Store environment + if hasattr(result.runtime, 'environ'): + lines += [ + write_rst_header('Environment', level=2), + write_rst_dict(result.runtime.environ), + ] + + with open(report_file, 'at') as fp: + fp.write('\n'.join(lines)) + return + + +def save_resultfile(result, cwd, name): + """Save a result pklz file to ``cwd``""" + resultsfile = os.path.join(cwd, 'result_%s.pklz' % name) + if result.outputs: + try: + outputs = result.outputs.get() + except TypeError: + outputs = result.outputs.dictcopy() # outputs was a bunch + result.outputs.set(**modify_paths( + outputs, relative=True, basedir=cwd)) + + savepkl(resultsfile, result) + logger.debug('saved results in %s', resultsfile) + + if result.outputs: + result.outputs.set(**outputs) + + +def load_resultfile(path, name): + """ + Load InterfaceResult file from path + + Parameter + --------- + + path : base_dir of node + name : name of node + + Returns + ------- - rel_list = [op.pardir] * (len(start_list) - i) + path_list[i:] - if not rel_list: - return os.curdir - return op.join(*rel_list) + result : InterfaceResult structure + aggregate : boolean indicating whether node should aggregate_outputs + attribute error : boolean indicating whether there was some mismatch in + versions of traits used to store result and hence node needs to + rerun + """ + aggregate = True + resultsoutputfile = os.path.join(path, 'result_%s.pklz' % name) + result = None + attribute_error = False + if os.path.exists(resultsoutputfile): + pkl_file = gzip.open(resultsoutputfile, 'rb') + try: + result = pickle.load(pkl_file) + except UnicodeDecodeError: + # Was this pickle created with Python 2.x? + pickle.load(pkl_file, fix_imports=True, encoding='utf-8') + logger.warn('Successfully loaded pickle in compatibility mode') + except (traits.TraitError, AttributeError, ImportError, + EOFError) as err: + if isinstance(err, (AttributeError, ImportError)): + attribute_error = True + logger.debug('attribute error: %s probably using ' + 'different trait pickled file', str(err)) + else: + logger.debug( + 'some file does not exist. hence trait cannot be set') + else: + if result.outputs: + try: + outputs = result.outputs.get() + except TypeError: + outputs = result.outputs.dictcopy() # outputs == Bunch + try: + result.outputs.set(**modify_paths(outputs, + relative=False, + basedir=path)) + except FileNotFoundError: + logger.debug('conversion to full path results in ' + 'non existent file') + aggregate = False + pkl_file.close() + logger.debug('Aggregate: %s', aggregate) + return result, aggregate, attribute_error + + +def strip_temp(files, wd): + """Remove temp from a list of file paths""" + out = [] + for f in files: + if isinstance(f, list): + out.append(strip_temp(f, wd)) + else: + out.append(f.replace(os.path.join(wd, '_tempinput'), wd)) + return out def _write_inputs(node): @@ -91,7 +330,7 @@ def _write_inputs(node): if type(val) == str: try: func = create_function_from_source(val) - except RuntimeError as e: + except RuntimeError: lines.append("%s.inputs.%s = '%s'" % (nodename, key, val)) else: funcname = [name for name in func.__globals__ @@ -903,7 +1142,7 @@ def _standardize_iterables(node): fields = set(node.inputs.copyable_trait_names()) # Flag indicating whether the iterables are in the alternate # synchronize form and are not converted to a standard format. - synchronize = False + # synchronize = False # OE: commented out since it is not used # A synchronize iterables node without an itersource can be in # [fields, value tuples] format rather than # [(field, value list), (field, value list), ...] diff --git a/nipype/pipeline/engine/workflows.py b/nipype/pipeline/engine/workflows.py index b0ff7fcadc..e00f105c5e 100644 --- a/nipype/pipeline/engine/workflows.py +++ b/nipype/pipeline/engine/workflows.py @@ -24,7 +24,6 @@ from copy import deepcopy import pickle import shutil -from warnings import warn import numpy as np import networkx as nx @@ -560,12 +559,6 @@ def run(self, plugin=None, plugin_args=None, updatehash=False): runner = plugin_mod(plugin_args=plugin_args) flatgraph = self._create_flat_graph() self.config = merge_dict(deepcopy(config._sections), self.config) - if 'crashdump_dir' in self.config: - warn(("Deprecated: workflow.config['crashdump_dir']\n" - "Please use config['execution']['crashdump_dir']")) - crash_dir = self.config['crashdump_dir'] - self.config['execution']['crashdump_dir'] = crash_dir - del self.config['crashdump_dir'] logger.info('Workflow %s settings: %s', self.name, to_str(sorted(self.config))) self._set_needed_outputs(flatgraph) execgraph = generate_expanded_graph(deepcopy(flatgraph)) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 5ffefc1af1..d87f498d00 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -15,6 +15,7 @@ import locale from hashlib import md5 import os +import os.path as op import re import shutil import posixpath @@ -76,8 +77,8 @@ def split_filename(fname): special_extensions = [".nii.gz", ".tar.gz"] - pth = os.path.dirname(fname) - fname = os.path.basename(fname) + pth = op.dirname(fname) + fname = op.basename(fname) ext = None for special_ext in special_extensions: @@ -88,7 +89,7 @@ def split_filename(fname): fname = fname[:-ext_len] break if not ext: - fname, ext = os.path.splitext(fname) + fname, ext = op.splitext(fname) return pth, fname, ext @@ -187,8 +188,8 @@ def fname_presuffix(fname, prefix='', suffix='', newpath=None, use_ext=True): # No need for isdefined: bool(Undefined) evaluates to False if newpath: - pth = os.path.abspath(newpath) - return os.path.join(pth, prefix + fname + suffix + ext) + pth = op.abspath(newpath) + return op.join(pth, prefix + fname + suffix + ext) def fnames_presuffix(fnames, prefix='', suffix='', newpath=None, use_ext=True): @@ -206,14 +207,14 @@ def hash_rename(filename, hashvalue): """ path, name, ext = split_filename(filename) newfilename = ''.join((name, '_0x', hashvalue, ext)) - return os.path.join(path, newfilename) + return op.join(path, newfilename) def check_forhash(filename): """checks if file has a hash in its filename""" if isinstance(filename, list): filename = filename[0] - path, name = os.path.split(filename) + path, name = op.split(filename) if re.search('(_0x[a-z0-9]{32})', name): hashvalue = re.findall('(_0x[a-z0-9]{32})', name) return True, hashvalue @@ -224,7 +225,7 @@ def check_forhash(filename): def hash_infile(afile, chunk_len=8192, crypto=hashlib.md5): """ Computes hash of a file using 'crypto' module""" hex = None - if os.path.isfile(afile): + if op.isfile(afile): crypto_obj = crypto() with open(afile, 'rb') as fp: while True: @@ -239,7 +240,7 @@ def hash_infile(afile, chunk_len=8192, crypto=hashlib.md5): def hash_timestamp(afile): """ Computes md5 hash of the timestamp of a file """ md5hex = None - if os.path.isfile(afile): + if op.isfile(afile): md5obj = md5() stat = os.stat(afile) md5obj.update(str(stat.st_size).encode()) @@ -333,7 +334,7 @@ def copyfile(originalfile, newfile, copy=False, create_new=False, fmlogger.debug(newfile) if create_new: - while os.path.exists(newfile): + while op.exists(newfile): base, fname, ext = split_filename(newfile) s = re.search('_c[0-9]{4,4}$', fname) i = 0 @@ -363,9 +364,9 @@ def copyfile(originalfile, newfile, copy=False, create_new=False, # copy of file (same hash) (keep) # different file (diff hash) (unlink) keep = False - if os.path.lexists(newfile): - if os.path.islink(newfile): - if all((os.readlink(newfile) == os.path.realpath(originalfile), + if op.lexists(newfile): + if op.islink(newfile): + if all((os.readlink(newfile) == op.realpath(originalfile), not use_hardlink, not copy)): keep = True elif posixpath.samefile(newfile, originalfile): @@ -395,7 +396,7 @@ def copyfile(originalfile, newfile, copy=False, create_new=False, try: fmlogger.debug('Linking File: %s->%s', newfile, originalfile) # Use realpath to avoid hardlinking symlinks - os.link(os.path.realpath(originalfile), newfile) + os.link(op.realpath(originalfile), newfile) except OSError: use_hardlink = False # Disable hardlink for associated files else: @@ -422,7 +423,7 @@ def copyfile(originalfile, newfile, copy=False, create_new=False, related_file_pairs = (get_related_files(f, include_this_file=False) for f in (originalfile, newfile)) for alt_ofile, alt_nfile in zip(*related_file_pairs): - if os.path.exists(alt_ofile): + if op.exists(alt_ofile): copyfile(alt_ofile, alt_nfile, copy, hashmethod=hashmethod, use_hardlink=use_hardlink, copy_related_files=False) @@ -447,7 +448,7 @@ def get_related_files(filename, include_this_file=True): if this_type in type_set: for related_type in type_set: if include_this_file or related_type != this_type: - related_files.append(os.path.join(path, name + related_type)) + related_files.append(op.join(path, name + related_type)) if not len(related_files): related_files = [filename] return related_files @@ -519,9 +520,9 @@ def check_depends(targets, dependencies): """ tgts = filename_to_list(targets) deps = filename_to_list(dependencies) - return all(map(os.path.exists, tgts)) and \ - min(map(os.path.getmtime, tgts)) > \ - max(list(map(os.path.getmtime, deps)) + [0]) + return all(map(op.exists, tgts)) and \ + min(map(op.getmtime, tgts)) > \ + max(list(map(op.getmtime, deps)) + [0]) def save_json(filename, data): @@ -668,8 +669,8 @@ def dist_is_editable(dist): # Borrowed from `pip`'s' API """ for path_item in sys.path: - egg_link = os.path.join(path_item, dist + '.egg-link') - if os.path.isfile(egg_link): + egg_link = op.join(path_item, dist + '.egg-link') + if op.isfile(egg_link): return True return False @@ -688,13 +689,13 @@ def makedirs(path, exist_ok=False): return path # this odd approach deals with concurrent directory cureation - if not os.path.exists(os.path.abspath(path)): + if not op.exists(op.abspath(path)): fmlogger.debug("Creating directory %s", path) try: os.makedirs(path) except OSError: fmlogger.debug("Problem creating directory %s", path) - if not os.path.exists(path): + if not op.exists(path): raise OSError('Could not create directory %s' % path) return path @@ -711,30 +712,27 @@ def emptydirs(path, noexist_ok=False): """ fmlogger.debug("Removing contents of %s", path) - if noexist_ok and not os.path.exists(path): + if noexist_ok and not op.exists(path): return True - pathconts = os.listdir(path) - if not pathconts: - return True + if op.isfile(path): + raise OSError('path "%s" should be a directory' % path) - for el in pathconts: - if os.path.isfile(el): - os.remove(el) + try: + shutil.rmtree(path) + except OSError as ex: + elcont = os.listdir(path) + if ex.errno == errno.ENOTEMPTY and not elcont: + fmlogger.warning( + 'An exception was raised trying to remove old %s, but the path ' + 'seems empty. Is it an NFS mount?. Passing the exception.', path) + elif ex.errno == errno.ENOTEMPTY and elcont: + fmlogger.debug('Folder %s contents (%d items).', path, len(elcont)) + raise ex else: - try: - shutil.rmtree(el) - except OSError as ex: - elcont = os.listdir(el) - if ex.errno == errno.ENOTEMPTY and not elcont: - fmlogger.warning( - 'An exception was raised trying to remove old %s, but the path ' - 'seems empty. Is it an NFS mount?. Passing the exception.', el) - elif ex.errno == errno.ENOTEMPTY and elcont: - fmlogger.debug('Folder %s contents (%d items).', el, len(elcont)) - raise ex - else: - raise ex + raise ex + + makedirs(path) def which(cmd, env=None, pathext=None): @@ -765,8 +763,8 @@ def which(cmd, env=None, pathext=None): for ext in pathext: extcmd = cmd + ext for directory in path.split(os.pathsep): - filename = os.path.join(directory, extcmd) - if os.path.exists(filename): + filename = op.join(directory, extcmd) + if op.exists(filename): return filename return None @@ -822,3 +820,39 @@ def canonicalize_env(env): val = val.encode('utf-8') out_env[key] = val return out_env + + +def relpath(path, start=None): + """Return a relative version of a path""" + + try: + return op.relpath(path, start) + except AttributeError: + pass + + if start is None: + start = os.curdir + if not path: + raise ValueError("no path specified") + start_list = op.abspath(start).split(op.sep) + path_list = op.abspath(path).split(op.sep) + if start_list[0].lower() != path_list[0].lower(): + unc_path, rest = op.splitunc(path) + unc_start, rest = op.splitunc(start) + if bool(unc_path) ^ bool(unc_start): + raise ValueError(("Cannot mix UNC and non-UNC paths " + "(%s and %s)") % (path, start)) + else: + raise ValueError("path is on drive %s, start on drive %s" + % (path_list[0], start_list[0])) + # Work out how much of the filepath is shared by start and path. + for i in range(min(len(start_list), len(path_list))): + if start_list[i].lower() != path_list[i].lower(): + break + else: + i += 1 + + rel_list = [op.pardir] * (len(start_list) - i) + path_list[i:] + if not rel_list: + return os.curdir + return op.join(*rel_list) From 16eafc0ec1cdacf9957631d533e1483bedb810a2 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 22 Dec 2017 14:13:08 -0800 Subject: [PATCH 075/365] Update SPM interfaces to use the new PackageInfo --- .../freesurfer/tests/test_FSSurfaceCommand.py | 4 +- nipype/interfaces/spm/base.py | 78 ++++++++++++++----- nipype/interfaces/spm/tests/test_base.py | 12 +-- nipype/interfaces/spm/tests/test_model.py | 8 +- .../interfaces/spm/tests/test_preprocess.py | 12 +-- nipype/workflows/fmri/spm/preprocess.py | 62 +++++++++------ 6 files changed, 109 insertions(+), 67 deletions(-) diff --git a/nipype/interfaces/freesurfer/tests/test_FSSurfaceCommand.py b/nipype/interfaces/freesurfer/tests/test_FSSurfaceCommand.py index acaa5d466d..70701e5f57 100644 --- a/nipype/interfaces/freesurfer/tests/test_FSSurfaceCommand.py +++ b/nipype/interfaces/freesurfer/tests/test_FSSurfaceCommand.py @@ -29,9 +29,11 @@ def test_FSSurfaceCommand_inputs(): @pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed") -def test_associated_file(): +def test_associated_file(tmpdir): fssrc = FreeSurferSource(subjects_dir=fs.Info.subjectsdir(), subject_id='fsaverage', hemi='lh') + fssrc.base_dir = tmpdir.strpath + fssrc.resource_monitor = False fsavginfo = fssrc.run().outputs.get() diff --git a/nipype/interfaces/spm/base.py b/nipype/interfaces/spm/base.py index 391528e83b..bd76e868dc 100644 --- a/nipype/interfaces/spm/base.py +++ b/nipype/interfaces/spm/base.py @@ -29,8 +29,11 @@ # Local imports from ... import logging from ...utils import spm_docs as sd, NUMPY_MMAP -from ..base import (BaseInterface, traits, isdefined, InputMultiPath, - BaseInterfaceInputSpec, Directory, Undefined, ImageFile) +from ..base import ( + BaseInterface, traits, isdefined, InputMultiPath, + BaseInterfaceInputSpec, Directory, Undefined, + ImageFile, PackageInfo +) from ..matlab import MatlabCommand from ...external.due import due, Doi, BibTeX @@ -123,12 +126,34 @@ def scans_for_fnames(fnames, keep4d=False, separate_sessions=False): return flist -class Info(object): +class Info(PackageInfo): """Handles SPM version information """ - @staticmethod - def version(matlab_cmd=None, paths=None, use_mcr=None): - """Returns the path to the SPM directory in the Matlab path + _path = None + _name = None + + @classmethod + def path(klass, matlab_cmd=None, paths=None, use_mcr=None): + if klass._path: + return klass._path + return klass.getinfo(matlab_cmd, paths, use_mcr)['path'] + + @classmethod + def version(klass, matlab_cmd=None, paths=None, use_mcr=None): + if klass._version: + return klass._version + return klass.getinfo(matlab_cmd, paths, use_mcr)['release'] + + @classmethod + def name(klass, matlab_cmd=None, paths=None, use_mcr=None): + if klass._name: + return klass._name + return klass.getinfo(matlab_cmd, paths, use_mcr)['name'] + + @classmethod + def getinfo(klass, matlab_cmd=None, paths=None, use_mcr=None): + """ + Returns the path to the SPM directory in the Matlab path If path not found, returns None. Parameters @@ -152,6 +177,13 @@ def version(matlab_cmd=None, paths=None, use_mcr=None): returns None of path not found """ + if klass._name and klass._path and klass._version: + return { + 'name': klass._name, + 'path': klass._path, + 'release': klass._version + } + use_mcr = use_mcr or 'FORCE_SPMMCR' in os.environ matlab_cmd = ((use_mcr and os.getenv('SPMMCRCMD')) or os.getenv('MATLABCMD') or @@ -184,13 +216,17 @@ def version(matlab_cmd=None, paths=None, use_mcr=None): # No Matlab -- no spm logger.debug('%s', e) return None - else: - out = sd._strip_header(out.runtime.stdout) - out_dict = {} - for part in out.split('|'): - key, val = part.split(':') - out_dict[key] = val - return out_dict + + out = sd._strip_header(out.runtime.stdout) + out_dict = {} + for part in out.split('|'): + key, val = part.split(':') + out_dict[key] = val + + klass._version = out_dict['release'] + klass._path = out_dict['path'] + klass._name = out_dict['name'] + return out_dict def no_spm(): @@ -288,13 +324,15 @@ def _matlab_cmd_update(self): @property def version(self): - version_dict = Info.version(matlab_cmd=self.inputs.matlab_cmd, - paths=self.inputs.paths, - use_mcr=self.inputs.use_mcr) - if version_dict: - return '.'.join((version_dict['name'].split('SPM')[-1], - version_dict['release'])) - return version_dict + info_dict = Info.getinfo( + matlab_cmd=self.inputs.matlab_cmd, + paths=self.inputs.paths, + use_mcr=self.inputs.use_mcr + ) + if info_dict: + return '%s.%s' % ( + info_dict['name'].split('SPM')[-1], + info_dict['release']) @property def jobtype(self): diff --git a/nipype/interfaces/spm/tests/test_base.py b/nipype/interfaces/spm/tests/test_base.py index d1c517a0d3..57d0d88c21 100644 --- a/nipype/interfaces/spm/tests/test_base.py +++ b/nipype/interfaces/spm/tests/test_base.py @@ -16,12 +16,8 @@ from nipype.interfaces.spm.base import SPMCommandInputSpec from nipype.interfaces.base import traits -try: - matlab_cmd = os.environ['MATLABCMD'] -except: - matlab_cmd = 'matlab' - -mlab.MatlabCommand.set_default_matlab_cmd(matlab_cmd) +mlab.MatlabCommand.set_default_matlab_cmd( + os.getenv('MATLABCMD', 'matlab')) def test_scan_for_fnames(create_files_in_directory): @@ -35,10 +31,10 @@ def test_scan_for_fnames(create_files_in_directory): if not save_time: @pytest.mark.skipif(no_spm(), reason="spm is not installed") def test_spm_path(): - spm_path = spm.Info.version()['path'] + spm_path = spm.Info.path() if spm_path is not None: assert isinstance(spm_path, (str, bytes)) - assert 'spm' in spm_path + assert 'spm' in spm_path.lower() def test_use_mfile(): diff --git a/nipype/interfaces/spm/tests/test_model.py b/nipype/interfaces/spm/tests/test_model.py index e9e8a48849..307c4f1786 100644 --- a/nipype/interfaces/spm/tests/test_model.py +++ b/nipype/interfaces/spm/tests/test_model.py @@ -6,12 +6,8 @@ import nipype.interfaces.spm.model as spm import nipype.interfaces.matlab as mlab -try: - matlab_cmd = os.environ['MATLABCMD'] -except: - matlab_cmd = 'matlab' - -mlab.MatlabCommand.set_default_matlab_cmd(matlab_cmd) +mlab.MatlabCommand.set_default_matlab_cmd( + os.getenv('MATLABCMD', 'matlab')) def test_level1design(): diff --git a/nipype/interfaces/spm/tests/test_preprocess.py b/nipype/interfaces/spm/tests/test_preprocess.py index 4bf86285ad..f167ad521a 100644 --- a/nipype/interfaces/spm/tests/test_preprocess.py +++ b/nipype/interfaces/spm/tests/test_preprocess.py @@ -10,12 +10,8 @@ from nipype.interfaces.spm import no_spm import nipype.interfaces.matlab as mlab -try: - matlab_cmd = os.environ['MATLABCMD'] -except: - matlab_cmd = 'matlab' - -mlab.MatlabCommand.set_default_matlab_cmd(matlab_cmd) +mlab.MatlabCommand.set_default_matlab_cmd( + os.getenv('MATLABCMD', 'matlab')) def test_slicetiming(): @@ -88,7 +84,7 @@ def test_normalize12_list_outputs(create_files_in_directory): @pytest.mark.skipif(no_spm(), reason="spm is not installed") def test_segment(): - if spm.Info.version()['name'] == "SPM12": + if spm.Info.name() == "SPM12": assert spm.Segment()._jobtype == 'tools' assert spm.Segment()._jobname == 'oldseg' else: @@ -98,7 +94,7 @@ def test_segment(): @pytest.mark.skipif(no_spm(), reason="spm is not installed") def test_newsegment(): - if spm.Info.version()['name'] == "SPM12": + if spm.Info.name() == "SPM12": assert spm.NewSegment()._jobtype == 'spatial' assert spm.NewSegment()._jobname == 'preproc' else: diff --git a/nipype/workflows/fmri/spm/preprocess.py b/nipype/workflows/fmri/spm/preprocess.py index 384284434d..1a8b8cddee 100644 --- a/nipype/workflows/fmri/spm/preprocess.py +++ b/nipype/workflows/fmri/spm/preprocess.py @@ -8,7 +8,6 @@ from ....interfaces import spm as spm from ....interfaces import utility as niu from ....pipeline import engine as pe -from ....interfaces.matlab import no_matlab from ...smri.freesurfer.utils import create_getmask_flow from .... import logging @@ -141,7 +140,8 @@ def create_vbm_preproc(name='vbmpreproc'): >>> preproc = create_vbm_preproc() >>> preproc.inputs.inputspec.fwhm = 8 - >>> preproc.inputs.inputspec.structural_files = [os.path.abspath('s1.nii'), os.path.abspath('s3.nii')] + >>> preproc.inputs.inputspec.structural_files = [ + ... os.path.abspath('s1.nii'), os.path.abspath('s3.nii')] >>> preproc.inputs.inputspec.template_prefix = 'Template' >>> preproc.run() # doctest: +SKIP @@ -185,7 +185,9 @@ def getclass1images(class_images): class1images.extend(session[0]) return class1images - workflow.connect(dartel_template, ('segment.native_class_images', getclass1images), norm2mni, 'apply_to_files') + workflow.connect( + dartel_template, ('segment.native_class_images', getclass1images), + norm2mni, 'apply_to_files') workflow.connect(inputnode, 'fwhm', norm2mni, 'fwhm') def compute_icv(class_images): @@ -217,10 +219,11 @@ def compute_icv(class_images): "icv" ]), name="outputspec") - workflow.connect([(dartel_template, outputnode, [('outputspec.template_file', 'template_file')]), - (norm2mni, outputnode, [("normalized_files", "normalized_files")]), - (calc_icv, outputnode, [("icv", "icv")]), - ]) + workflow.connect([ + (dartel_template, outputnode, [('outputspec.template_file', 'template_file')]), + (norm2mni, outputnode, [("normalized_files", "normalized_files")]), + (calc_icv, outputnode, [("icv", "icv")]), + ]) return workflow @@ -233,7 +236,8 @@ def create_DARTEL_template(name='dartel_template'): ------- >>> preproc = create_DARTEL_template() - >>> preproc.inputs.inputspec.structural_files = [os.path.abspath('s1.nii'), os.path.abspath('s3.nii')] + >>> preproc.inputs.inputspec.structural_files = [ + ... os.path.abspath('s1.nii'), os.path.abspath('s3.nii')] >>> preproc.inputs.inputspec.template_prefix = 'Template' >>> preproc.run() # doctest: +SKIP @@ -259,24 +263,34 @@ def create_DARTEL_template(name='dartel_template'): name='segment') workflow.connect(inputnode, 'structural_files', segment, 'channel_files') - version = spm.Info.version() - if version: - spm_path = version['path'] - if version['name'] == 'SPM8': - tissue1 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 1), 2, (True, True), (False, False)) - tissue2 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 2), 2, (True, True), (False, False)) - tissue3 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 3), 2, (True, False), (False, False)) - tissue4 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 4), 3, (False, False), (False, False)) - tissue5 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 5), 4, (False, False), (False, False)) - tissue6 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 6), 2, (False, False), (False, False)) - elif version['name'] == 'SPM12': - spm_path = version['path'] + spm_info = spm.Info.getinfo() + if spm_info: + spm_path = spm_info['path'] + if spm_info['name'] == 'SPM8': + tissue1 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 1), + 2, (True, True), (False, False)) + tissue2 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 2), + 2, (True, True), (False, False)) + tissue3 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 3), + 2, (True, False), (False, False)) + tissue4 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 4), + 3, (False, False), (False, False)) + tissue5 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 5), + 4, (False, False), (False, False)) + tissue6 = ((os.path.join(spm_path, 'toolbox/Seg/TPM.nii'), 6), + 2, (False, False), (False, False)) + elif spm_info['name'] == 'SPM12': + spm_path = spm_info['path'] tissue1 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 1), 1, (True, True), (False, False)) tissue2 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 2), 1, (True, True), (False, False)) - tissue3 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 3), 2, (True, False), (False, False)) - tissue4 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 4), 3, (False, False), (False, False)) - tissue5 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 5), 4, (False, False), (False, False)) - tissue6 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 6), 2, (False, False), (False, False)) + tissue3 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 3), + 2, (True, False), (False, False)) + tissue4 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 4), + 3, (False, False), (False, False)) + tissue5 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 5), + 4, (False, False), (False, False)) + tissue6 = ((os.path.join(spm_path, 'tpm/TPM.nii'), 6), + 2, (False, False), (False, False)) else: logger.critical('Unsupported version of SPM') From db479b17d45471c661a037b6d6bebb28fb4d3c86 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 22 Dec 2017 16:06:47 -0800 Subject: [PATCH 076/365] fix spm.Info when spm is not installed --- nipype/interfaces/spm/base.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/nipype/interfaces/spm/base.py b/nipype/interfaces/spm/base.py index bd76e868dc..7882fa1280 100644 --- a/nipype/interfaces/spm/base.py +++ b/nipype/interfaces/spm/base.py @@ -136,19 +136,22 @@ class Info(PackageInfo): def path(klass, matlab_cmd=None, paths=None, use_mcr=None): if klass._path: return klass._path - return klass.getinfo(matlab_cmd, paths, use_mcr)['path'] + klass.getinfo(matlab_cmd, paths, use_mcr) + return klass._path @classmethod def version(klass, matlab_cmd=None, paths=None, use_mcr=None): if klass._version: return klass._version - return klass.getinfo(matlab_cmd, paths, use_mcr)['release'] + klass.getinfo(matlab_cmd, paths, use_mcr) + return klass._version @classmethod def name(klass, matlab_cmd=None, paths=None, use_mcr=None): if klass._name: return klass._name - return klass.getinfo(matlab_cmd, paths, use_mcr)['name'] + klass.getinfo(matlab_cmd, paths, use_mcr) + return klass._name @classmethod def getinfo(klass, matlab_cmd=None, paths=None, use_mcr=None): @@ -185,9 +188,9 @@ def getinfo(klass, matlab_cmd=None, paths=None, use_mcr=None): } use_mcr = use_mcr or 'FORCE_SPMMCR' in os.environ - matlab_cmd = ((use_mcr and os.getenv('SPMMCRCMD')) or - os.getenv('MATLABCMD') or - 'matlab -nodesktop -nosplash') + matlab_cmd = ( + (use_mcr and os.getenv('SPMMCRCMD')) or + os.getenv('MATLABCMD', 'matlab -nodesktop -nosplash')) mlab = MatlabCommand(matlab_cmd=matlab_cmd, resource_monitor=False) From 7b3d98c49fedd920f43746fa40e6b31b263d2400 Mon Sep 17 00:00:00 2001 From: Dorota Jarecka Date: Fri, 29 Dec 2017 03:57:22 -0500 Subject: [PATCH 077/365] adding exists=True for subjects_dir in FSSourceInputSpec --- nipype/interfaces/io.py | 2 +- nipype/interfaces/tests/test_io.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index 0793b955bd..7e8f4ab755 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -1485,7 +1485,7 @@ def _list_outputs(self): class FSSourceInputSpec(BaseInterfaceInputSpec): - subjects_dir = Directory(mandatory=True, + subjects_dir = Directory(exists=True, mandatory=True, desc='Freesurfer subjects directory.') subject_id = Str(mandatory=True, desc='Subject name for whom to retrieve data') diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index ff56c9ec9d..bb89b72fd9 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -407,6 +407,13 @@ def test_freesurfersource(): assert fss.inputs.subjects_dir == Undefined +def test_freesurfersource_incorrectdir(): + fss = nio.FreeSurferSource() + with pytest.raises(Exception) as err: + fss.inputs.subjects_dir = 'path/to/no/existing/directory' + assert "TraitError" == err.typename + + def test_jsonsink_input(): ds = nio.JSONFileSink() From 94a46042fdcd9689285837748b21199dd9139605 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Sun, 31 Dec 2017 09:54:08 -0800 Subject: [PATCH 078/365] improve logging of nodes with updated hash --- nipype/pipeline/engine/nodes.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 34aa2028d3..69b144d570 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -308,12 +308,11 @@ def hash_exists(self, updatehash=False): # Remove outdated hashfile if hashfiles and hashfiles[0] != hashfile: - logger.info('[Node] Removing outdated hashfile (%s) and forcing node to rerun', - op.basename(hashfiles[0])) + logger.info('[Node] Outdated hashfile found for "%s", removing and forcing node ' + 'to rerun', self.fullname) - # In DEBUG, print diff between hashes - log_debug = config.get('logging', 'workflow_level') == 'DEBUG' - if log_debug and hash_exists: # Lazy logging - only debug + # If logging is more verbose than INFO (20), print diff between hashes + if logger.getEffectiveLevel() < 20 and hash_exists: # Lazy logging: only < INFO split_out = split_filename(hashfiles[0]) exp_hash_file_base = split_out[1] exp_hash = exp_hash_file_base[len('_0x'):] @@ -426,7 +425,7 @@ def run(self, updatehash=False): try: result = self._run_interface(execute=True) except Exception: - logger.warning('[Node] Exception "%s" (%s)', self.fullname, outdir) + logger.warning('[Node] Error on "%s" (%s)', self.fullname, outdir) # Tear-up after error os.remove(hashfile_unfinished) raise From 37554d045462690783afc05396201ee7b6575423 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Sun, 31 Dec 2017 10:59:49 -0800 Subject: [PATCH 079/365] remove hashfiles on error situations, improve logging the diff of hashvalues --- nipype/pipeline/engine/nodes.py | 24 +++++++++----- nipype/utils/logger.py | 43 +++---------------------- nipype/utils/misc.py | 56 ++++++++++++++++++++++++++++++++- 3 files changed, 75 insertions(+), 48 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 69b144d570..627e77428d 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -30,7 +30,7 @@ from future import standard_library from ... import config, logging -from ...utils.misc import (flatten, unflatten, str2bool) +from ...utils.misc import flatten, unflatten, str2bool, dict_diff from ...utils.filemanip import ( md5, FileNotFoundError, filename_to_list, list_to_filename, copyfiles, fnames_presuffix, loadpkl, split_filename, load_json, makedirs, @@ -292,38 +292,46 @@ def hash_exists(self, updatehash=False): # Find previous hashfiles hashfiles = glob(op.join(outdir, '_0x*.json')) if len(hashfiles) > 1: + for rmfile in hashfiles: + os.remove(rmfile) + raise RuntimeError( - '[Node] Cache ERROR - Found %d previous hashfiles that indicate ' + '[Node] Cache ERROR - Found %d previous hashfiles indicating ' 'that the ``base_dir`` for this node went stale. Please re-run the ' 'workflow.' % len(hashfiles)) # Find unfinished hashfiles and error if any unfinished = glob(op.join(outdir, '_0x*_unfinished.json')) + # This should not happen, but clean up and break if so. if unfinished and updatehash: + for rmfile in unfinished: + os.remove(rmfile) + raise RuntimeError( - '[Node] Cache ERROR - Found unfinished hashfiles (%d) that indicate ' + '[Node] Cache ERROR - Found unfinished hashfiles (%d) indicating ' 'that the ``base_dir`` for this node went stale. Please re-run the ' 'workflow.' % len(unfinished)) # Remove outdated hashfile if hashfiles and hashfiles[0] != hashfile: logger.info('[Node] Outdated hashfile found for "%s", removing and forcing node ' - 'to rerun', self.fullname) + 'to rerun.', self.fullname) # If logging is more verbose than INFO (20), print diff between hashes - if logger.getEffectiveLevel() < 20 and hash_exists: # Lazy logging: only < INFO + loglevel = logger.getEffectiveLevel() + if loglevel < 20: # Lazy logging: only < INFO split_out = split_filename(hashfiles[0]) exp_hash_file_base = split_out[1] exp_hash = exp_hash_file_base[len('_0x'):] - logger.debug("Previous node hash = %s", exp_hash) + logger.log(loglevel, "[Node] Old/new hashes = %s/%s", exp_hash, hashvalue) try: prev_inputs = load_json(hashfiles[0]) except Exception: pass else: - logging.logdebug_dict_differences( - prev_inputs, hashed_inputs) + logger.log(loglevel, dict_diff(prev_inputs, hashed_inputs, 10)) + os.remove(hashfiles[0]) # Update only possible if it exists diff --git a/nipype/utils/logger.py b/nipype/utils/logger.py index 4604cc4145..2bdc54c791 100644 --- a/nipype/utils/logger.py +++ b/nipype/utils/logger.py @@ -97,42 +97,7 @@ def logdebug_dict_differences(self, dold, dnew, prefix=""): typical use -- log difference for hashed_inputs """ - # First check inputs, since they usually are lists of tuples - # and dicts are required. - if isinstance(dnew, list): - dnew = dict(dnew) - if isinstance(dold, list): - dold = dict(dold) - - # Compare against hashed_inputs - # Keys: should rarely differ - new_keys = set(dnew.keys()) - old_keys = set(dold.keys()) - if len(new_keys - old_keys): - self._logger.debug("%s not previously seen: %s" - % (prefix, new_keys - old_keys)) - if len(old_keys - new_keys): - self._logger.debug("%s not presently seen: %s" - % (prefix, old_keys - new_keys)) - - # Values in common keys would differ quite often, - # so we need to join the messages together - msgs = [] - for k in new_keys.intersection(old_keys): - same = False - try: - new, old = dnew[k], dold[k] - same = new == old - if not same: - # Since JSON does not discriminate between lists and - # tuples, we might need to cast them into the same type - # as the last resort. And lets try to be more generic - same = old.__class__(new) == old - except Exception as e: - same = False - if not same: - msgs += ["%s: %r != %r" - % (k, dnew[k], dold[k])] - if len(msgs): - self._logger.debug("%s values differ in fields: %s" % (prefix, - ", ".join(msgs))) + from .misc import dict_diff + self._logger.warning("logdebug_dict_differences has been deprecated, please use " + "nipype.utils.misc.dict_diff.") + self._logger.debug(dict_diff(dold, dnew)) diff --git a/nipype/utils/misc.py b/nipype/utils/misc.py index 81b29366a1..3cc77ee58c 100644 --- a/nipype/utils/misc.py +++ b/nipype/utils/misc.py @@ -15,7 +15,7 @@ import inspect from distutils.version import LooseVersion -from textwrap import dedent +from textwrap import dedent, indent as textwrap_indent import numpy as np def human_order_sorted(l): @@ -229,3 +229,57 @@ def normalize_mc_params(params, source): params[-1:2:-1] = aff2euler(matrix) return params + + +def dict_diff(dold, dnew, indent=0): + """Helper to log what actually changed from old to new values of + dictionaries. + + typical use -- log difference for hashed_inputs + """ + # First check inputs, since they usually are lists of tuples + # and dicts are required. + if isinstance(dnew, list): + dnew = dict(dnew) + if isinstance(dold, list): + dold = dict(dold) + + # Compare against hashed_inputs + # Keys: should rarely differ + new_keys = set(dnew.keys()) + old_keys = set(dold.keys()) + + diff = [] + if new_keys - old_keys: + diff += [" * keys not previously seen: %s" % (new_keys - old_keys)] + + if old_keys - new_keys: + diff += [" * keys not presently seen: %s" % (old_keys - new_keys)] + + # Add topical message + if diff: + diff.insert(0, "Dictionaries had differing keys:") + + diffkeys = len(diff) + + # Values in common keys would differ quite often, + # so we need to join the messages together + for k in new_keys.intersection(old_keys): + same = False + try: + new, old = dnew[k], dold[k] + same = new == old + if not same: + # Since JSON does not discriminate between lists and + # tuples, we might need to cast them into the same type + # as the last resort. And lets try to be more generic + same = old.__class__(new) == old + except Exception: + same = False + if not same: + diff += ["%s: %r != %r" % (k, dnew[k], dold[k])] + + if len(diff) > diffkeys: + diff.insert(diffkeys, "Some dictionary entries had differing values:") + + return textwrap_indent('\n'.join(diff), ' ' * indent) From a0b2b04e5a0d3ebecec695984eddb653d08a0a1c Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Sun, 31 Dec 2017 18:56:21 -0800 Subject: [PATCH 080/365] python2 compat, sty fixes --- nipype/utils/misc.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/nipype/utils/misc.py b/nipype/utils/misc.py index 3cc77ee58c..0d5942940a 100644 --- a/nipype/utils/misc.py +++ b/nipype/utils/misc.py @@ -4,19 +4,29 @@ """Miscellaneous utility functions """ from __future__ import print_function, unicode_literals, division, absolute_import -from future import standard_library -standard_library.install_aliases() from builtins import next, str -from future.utils import raise_from import sys import re from collections import Iterator -import inspect from distutils.version import LooseVersion -from textwrap import dedent, indent as textwrap_indent + import numpy as np +from future.utils import raise_from +from future import standard_library +try: + from textwrap import indent as textwrap_indent +except ImportError: + def textwrap_indent(text, prefix): + """ A textwrap.indent replacement for Python < 3.3 """ + if not prefix: + return text + splittext = text.splitlines(True) + return prefix + prefix.join(splittext) + +standard_library.install_aliases() + def human_order_sorted(l): """Sorts string in human order (i.e. 'stat10' will go after 'stat2')""" @@ -197,11 +207,11 @@ def unflatten(in_list, prev_structure): if not isinstance(prev_structure, list): return next(in_list) - else: - out = [] - for item in prev_structure: - out.append(unflatten(in_list, item)) - return out + + out = [] + for item in prev_structure: + out.append(unflatten(in_list, item)) + return out def normalize_mc_params(params, source): @@ -277,7 +287,7 @@ def dict_diff(dold, dnew, indent=0): except Exception: same = False if not same: - diff += ["%s: %r != %r" % (k, dnew[k], dold[k])] + diff += [" * %s: %r != %r" % (k, dnew[k], dold[k])] if len(diff) > diffkeys: diff.insert(diffkeys, "Some dictionary entries had differing values:") From 2daabf044205f35a3724ecfd9900f4058c0ff303 Mon Sep 17 00:00:00 2001 From: oesteban Date: Tue, 2 Jan 2018 17:21:50 -0800 Subject: [PATCH 081/365] [FIX] Fix surf_reg input trait Close #1078 as this PR supercedes that one --- .../freesurfer/tests/test_auto_SampleToSurface.py | 2 +- nipype/interfaces/freesurfer/utils.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/freesurfer/tests/test_auto_SampleToSurface.py b/nipype/interfaces/freesurfer/tests/test_auto_SampleToSurface.py index fd6440f10f..e479518cf3 100644 --- a/nipype/interfaces/freesurfer/tests/test_auto_SampleToSurface.py +++ b/nipype/interfaces/freesurfer/tests/test_auto_SampleToSurface.py @@ -93,7 +93,7 @@ def test_SampleToSurface_inputs(): ), subject_id=dict(), subjects_dir=dict(), - surf_reg=dict(argstr='--surfreg', + surf_reg=dict(argstr='--surfreg %s', requires=['target_subject'], ), surface=dict(argstr='--surf %s', diff --git a/nipype/interfaces/freesurfer/utils.py b/nipype/interfaces/freesurfer/utils.py index a5568ebbcb..97ae831b26 100644 --- a/nipype/interfaces/freesurfer/utils.py +++ b/nipype/interfaces/freesurfer/utils.py @@ -139,8 +139,9 @@ class SampleToSurfaceInputSpec(FSTraitedSpec): subject_id = traits.String(desc="subject id") target_subject = traits.String(argstr="--trgsubject %s", desc="sample to surface of different subject than source") - surf_reg = traits.Bool(argstr="--surfreg", requires=["target_subject"], - desc="use surface registration to target subject") + surf_reg = traits.Either(traits.Bool, traits.Str(), + argstr="--surfreg %s", requires=["target_subject"], + desc="use surface registration to target subject") ico_order = traits.Int(argstr="--icoorder %d", requires=["target_subject"], desc="icosahedron order when target_subject is 'ico'") @@ -238,6 +239,10 @@ def _format_arg(self, name, spec, value): if value in implicit_filetypes: return "" + if name == 'surf_reg': + if value is True: + return spec.argstr % 'sphere.reg' + return super(SampleToSurface, self)._format_arg(name, spec, value) def _get_outfilename(self, opt="out_file"): From afa74b71fa81d4eb124e28d7a6b07ef415bf6530 Mon Sep 17 00:00:00 2001 From: Oscar Esteban Date: Tue, 2 Jan 2018 22:43:02 -0800 Subject: [PATCH 082/365] make sure the OSError when cwd is deleted by other process is handled gracefully --- nipype/pipeline/engine/nodes.py | 16 ++++++++++++---- nipype/pipeline/plugins/base.py | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 627e77428d..a00165764e 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -428,7 +428,14 @@ def run(self, updatehash=False): savepkl(op.join(outdir, '_inputs.pklz'), self.inputs.get_traitsfree()) - cwd = os.getcwd() + try: + cwd = os.getcwd() + except OSError: + # Changing back to cwd is probably not necessary + # but this makes sure there's somewhere to change to. + cwd = os.path.split(outdir)[0] + logger.debug('Current folder does not exist, changing to "%s" instead.', cwd) + os.chdir(outdir) try: result = self._run_interface(execute=True) @@ -1009,8 +1016,8 @@ def inputs(self): @property def outputs(self): - if self._interface._outputs(): - return Bunch(self._interface._outputs().get()) + if self.interface._outputs(): + return Bunch(self.interface._outputs().get()) def _make_nodes(self, cwd=None): if cwd is None: @@ -1030,7 +1037,7 @@ def _make_nodes(self, cwd=None): base_dir=op.join(cwd, 'mapflow'), name=nodename) node.plugin_args = self.plugin_args - node._interface.inputs.trait_set( + node.interface.inputs.trait_set( **deepcopy(self._interface.inputs.get())) node.interface.resource_monitor = self._interface.resource_monitor for field in self.iterfield: @@ -1177,6 +1184,7 @@ def _run_interface(self, execute=True, updatehash=False): if path.split(op.sep)[-1] not in nodenames: dirs2remove.append(path) for path in dirs2remove: + logger.debug('[MapNode] Removing folder "%s".' , path) shutil.rmtree(path) return result diff --git a/nipype/pipeline/plugins/base.py b/nipype/pipeline/plugins/base.py index e27733ab77..ec8c68a148 100644 --- a/nipype/pipeline/plugins/base.py +++ b/nipype/pipeline/plugins/base.py @@ -408,7 +408,7 @@ def _remove_node_dirs(self): continue if self.proc_done[idx] and (not self.proc_pending[idx]): self.refidx[idx, idx] = -1 - outdir = self.procs[idx]._output_directory() + outdir = self.procs[idx].output_dir() logger.info(('[node dependencies finished] ' 'removing node: %s from directory %s') % (self.procs[idx]._id, outdir)) From 3bb84c49f9d4e43ece6e47b2ff81b2616b709ec1 Mon Sep 17 00:00:00 2001 From: Dorota Jarecka Date: Wed, 3 Jan 2018 02:30:21 -0500 Subject: [PATCH 083/365] using TriatError in pytest.raises --- nipype/interfaces/tests/test_io.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index bb89b72fd9..a15c831f9d 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -16,7 +16,7 @@ import pytest import nipype import nipype.interfaces.io as nio -from nipype.interfaces.base import Undefined +from nipype.interfaces.base import Undefined, TraitError # Check for boto noboto = False @@ -409,9 +409,8 @@ def test_freesurfersource(): def test_freesurfersource_incorrectdir(): fss = nio.FreeSurferSource() - with pytest.raises(Exception) as err: + with pytest.raises(TraitError) as err: fss.inputs.subjects_dir = 'path/to/no/existing/directory' - assert "TraitError" == err.typename def test_jsonsink_input(): From ba9ae4f2c1d985120fc08218afccc0f4f27e0bbe Mon Sep 17 00:00:00 2001 From: Dorota Jarecka Date: Wed, 3 Jan 2018 02:34:31 -0500 Subject: [PATCH 084/365] after make specs --- .../ants/tests/test_auto_Registration.py | 157 ------------------ .../niftyseg/tests/test_auto_PatchMatch.py | 61 ------- 2 files changed, 218 deletions(-) delete mode 100644 nipype/interfaces/ants/tests/test_auto_Registration.py delete mode 100644 nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py diff --git a/nipype/interfaces/ants/tests/test_auto_Registration.py b/nipype/interfaces/ants/tests/test_auto_Registration.py deleted file mode 100644 index ea9bc02e79..0000000000 --- a/nipype/interfaces/ants/tests/test_auto_Registration.py +++ /dev/null @@ -1,157 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..registration import Registration - - -def test_Registration_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - collapse_output_transforms=dict(argstr='--collapse-output-transforms %d', - usedefault=True, - ), - convergence_threshold=dict(requires=['number_of_iterations'], - usedefault=True, - ), - convergence_window_size=dict(requires=['convergence_threshold'], - usedefault=True, - ), - dimension=dict(argstr='--dimensionality %d', - usedefault=True, - ), - environ=dict(nohash=True, - usedefault=True, - ), - fixed_image=dict(mandatory=True, - ), - fixed_image_mask=dict(argstr='%s', - max_ver='2.1.0', - xor=['fixed_image_masks'], - ), - fixed_image_masks=dict(min_ver='2.2.0', - xor=['fixed_image_mask'], - ), - float=dict(argstr='--float %d', - ), - ignore_exception=dict(deprecated='1.0.0', - nohash=True, - usedefault=True, - ), - initial_moving_transform=dict(argstr='%s', - exists=True, - xor=['initial_moving_transform_com'], - ), - initial_moving_transform_com=dict(argstr='%s', - xor=['initial_moving_transform'], - ), - initialize_transforms_per_stage=dict(argstr='--initialize-transforms-per-stage %d', - usedefault=True, - ), - interpolation=dict(argstr='%s', - usedefault=True, - ), - interpolation_parameters=dict(), - invert_initial_moving_transform=dict(requires=['initial_moving_transform'], - xor=['initial_moving_transform_com'], - ), - metric=dict(mandatory=True, - ), - metric_item_trait=dict(), - metric_stage_trait=dict(), - metric_weight=dict(mandatory=True, - requires=['metric'], - usedefault=True, - ), - metric_weight_item_trait=dict(), - metric_weight_stage_trait=dict(), - moving_image=dict(mandatory=True, - ), - moving_image_mask=dict(max_ver='2.1.0', - requires=['fixed_image_mask'], - xor=['moving_image_masks'], - ), - moving_image_masks=dict(min_ver='2.2.0', - xor=['moving_image_mask'], - ), - num_threads=dict(nohash=True, - usedefault=True, - ), - number_of_iterations=dict(), - output_inverse_warped_image=dict(hash_files=False, - requires=['output_warped_image'], - ), - output_transform_prefix=dict(argstr='%s', - usedefault=True, - ), - output_warped_image=dict(hash_files=False, - ), - radius_bins_item_trait=dict(), - radius_bins_stage_trait=dict(), - radius_or_number_of_bins=dict(requires=['metric_weight'], - usedefault=True, - ), - restore_state=dict(argstr='--restore-state %s', - ), - restrict_deformation=dict(), - sampling_percentage=dict(requires=['sampling_strategy'], - ), - sampling_percentage_item_trait=dict(), - sampling_percentage_stage_trait=dict(), - sampling_strategy=dict(requires=['metric_weight'], - ), - sampling_strategy_item_trait=dict(), - sampling_strategy_stage_trait=dict(), - save_state=dict(argstr='--save-state %s', - ), - shrink_factors=dict(mandatory=True, - ), - sigma_units=dict(requires=['smoothing_sigmas'], - ), - smoothing_sigmas=dict(mandatory=True, - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - transform_parameters=dict(), - transforms=dict(argstr='%s', - mandatory=True, - ), - use_estimate_learning_rate_once=dict(), - use_histogram_matching=dict(usedefault=True, - ), - verbose=dict(argstr='-v', - ), - winsorize_lower_quantile=dict(argstr='%s', - usedefault=True, - ), - winsorize_upper_quantile=dict(argstr='%s', - usedefault=True, - ), - write_composite_transform=dict(argstr='--write-composite-transform %d', - usedefault=True, - ), - ) - inputs = Registration.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_Registration_outputs(): - output_map = dict(composite_transform=dict(), - elapsed_time=dict(), - forward_invert_flags=dict(), - forward_transforms=dict(), - inverse_composite_transform=dict(), - inverse_warped_image=dict(), - metric_value=dict(), - reverse_invert_flags=dict(), - reverse_transforms=dict(), - save_state=dict(), - warped_image=dict(), - ) - outputs = Registration.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value diff --git a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py b/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py deleted file mode 100644 index ba6ea5a40c..0000000000 --- a/nipype/interfaces/niftyseg/tests/test_auto_PatchMatch.py +++ /dev/null @@ -1,61 +0,0 @@ -# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT -from __future__ import unicode_literals -from ..patchmatch import PatchMatch - - -def test_PatchMatch_inputs(): - input_map = dict(args=dict(argstr='%s', - ), - cs_size=dict(argstr='-cs %i', - ), - database_file=dict(argstr='-db %s', - mandatory=True, - position=3, - ), - environ=dict(nohash=True, - usedefault=True, - ), - ignore_exception=dict(deprecated='1.0.0', - nohash=True, - usedefault=True, - ), - in_file=dict(argstr='-i %s', - mandatory=True, - position=1, - ), - it_num=dict(argstr='-it %i', - ), - mask_file=dict(argstr='-m %s', - mandatory=True, - position=2, - ), - match_num=dict(argstr='-match %i', - ), - out_file=dict(argstr='-o %s', - name_source=['in_file'], - name_template='%s_pm.nii.gz', - position=4, - ), - patch_size=dict(argstr='-size %i', - ), - pm_num=dict(argstr='-pm %i', - ), - terminal_output=dict(deprecated='1.0.0', - nohash=True, - ), - ) - inputs = PatchMatch.input_spec() - - for key, metadata in list(input_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(inputs.traits()[key], metakey) == value - - -def test_PatchMatch_outputs(): - output_map = dict(out_file=dict(), - ) - outputs = PatchMatch.output_spec() - - for key, metadata in list(output_map.items()): - for metakey, value in list(metadata.items()): - assert getattr(outputs.traits()[key], metakey) == value From 8fc2771e2cc40381e7d7503903df5274ce1b6c5d Mon Sep 17 00:00:00 2001 From: miykael Date: Fri, 5 Jan 2018 16:28:12 +0100 Subject: [PATCH 085/365] STY: correct for tailing spaces and newline at end of file --- CONTRIBUTING.md | 4 ++-- codecov.yml | 2 +- doc/_static/nipype.css | 2 +- doc/devel/gitwash/git_links.inc | 4 ++-- doc/searchresults.rst | 2 +- doc/users/aws.rst | 2 +- doc/users/config_file.rst | 2 +- doc/users/install.rst | 2 +- doc/users/plugins.rst | 4 ++-- doc/users/sphinx_ext.rst | 2 +- examples/nipype_tutorial.ipynb | 2 +- nipype/external/d3.js | 2 +- nipype/interfaces/fsl/model_templates/feat_fe_header.tcl | 2 +- nipype/interfaces/fsl/model_templates/feat_header.tcl | 8 ++++---- nipype/interfaces/fsl/model_templates/feat_header_l1.tcl | 4 ++-- nipype/interfaces/fsl/model_templates/featreg_header.tcl | 2 +- nipype/pytest.ini | 2 +- nipype/testing/data/bedpostxout/do_not_delete.txt | 2 +- nipype/testing/data/fmri_timeseries_nolabels.csv | 2 +- nipype/testing/data/jsongrabber.txt | 2 +- nipype/testing/data/realign_json.json | 2 +- nipype/testing/data/smri_ants_registration_settings.json | 2 +- nipype/testing/data/tbss_dir/do_not_delete.txt | 2 +- nipype/utils/spm_flat_config.m | 2 +- nipype/workflows/data/ecc.sch | 4 ++-- nipype/workflows/data/hmc.sch | 4 ++-- 26 files changed, 35 insertions(+), 35 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 083507547e..06ff582266 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,8 +16,8 @@ * The person who accepts/merges your PR will include an update to the CHANGES file: prefix: description (URL of pull request) * Run `make check-before-commit` before submitting the PR. This will require you to either install or be in developer mode with: `python setup.py install/develop`. -* In general, do not catch exceptions without good reason. - * catching non-fatal exceptions. +* In general, do not catch exceptions without good reason. + * catching non-fatal exceptions. Log the exception as a warning. * adding more information about what may have caused the error. Raise a new exception using ``raise_from(NewException("message"), oldException)`` from ``future``. diff --git a/codecov.yml b/codecov.yml index 2724855129..8a1ce2c18a 100644 --- a/codecov.yml +++ b/codecov.yml @@ -25,4 +25,4 @@ coverage: ignore: # files and folders that will be removed during processing - "nipype/external/*" - "tools/*" - - "doc/*" \ No newline at end of file + - "doc/*" diff --git a/doc/_static/nipype.css b/doc/_static/nipype.css index 7d0de1db74..cec080b3d6 100644 --- a/doc/_static/nipype.css +++ b/doc/_static/nipype.css @@ -57,4 +57,4 @@ div.doc2.container ul{ div.doc2 .reference.internal{ font-size: 14px; -} \ No newline at end of file +} diff --git a/doc/devel/gitwash/git_links.inc b/doc/devel/gitwash/git_links.inc index 14a76f5056..a679f2d78a 100644 --- a/doc/devel/gitwash/git_links.inc +++ b/doc/devel/gitwash/git_links.inc @@ -2,7 +2,7 @@ and name substitutions. It may be included in many files, therefore it should only contain link targets and name substitutions. Try grepping for "^\.\. _" to find plausible - candidates for this list. + candidates for this list. .. NOTE: reST targets are __not_case_sensitive__, so only one target definition is needed for @@ -42,7 +42,7 @@ .. _git config: http://www.kernel.org/pub/software/scm/git/docs/git-config.html .. _why the -a flag?: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html .. _git staging area: http://www.gitready.com/beginner/2009/01/18/the-staging-area.html -.. _tangled working copy problem: http://tomayko.com/writings/the-thing-about-git +.. _tangled working copy problem: http://tomayko.com/writings/the-thing-about-git .. _git management: http://kerneltrap.org/Linux/Git_Management .. _linux git workflow: http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html .. _git parable: http://tom.preston-werner.com/2009/05/19/the-git-parable.html diff --git a/doc/searchresults.rst b/doc/searchresults.rst index e02449f3a8..bef3894672 100644 --- a/doc/searchresults.rst +++ b/doc/searchresults.rst @@ -170,4 +170,4 @@ Search results .gsc-resultsHeader { clear: none; } - \ No newline at end of file + diff --git a/doc/users/aws.rst b/doc/users/aws.rst index 832072ba62..7ca7f1f3db 100644 --- a/doc/users/aws.rst +++ b/doc/users/aws.rst @@ -99,4 +99,4 @@ s3://mybucket/path/to/output/dir/sub001/motion/realigned_file1.nii.gz Using S3DataGrabber ====================== -Coming soon... \ No newline at end of file +Coming soon... diff --git a/doc/users/config_file.rst b/doc/users/config_file.rst index f53a2900db..279dc1aadd 100644 --- a/doc/users/config_file.rst +++ b/doc/users/config_file.rst @@ -170,7 +170,7 @@ Resource Monitor Indicates where the summary file collecting all profiling information from the resource monitor should be stored after execution of a workflow. The ``summary_file`` does not apply to interfaces run independently. - (unset by default, in which case the summary file will be written out to + (unset by default, in which case the summary file will be written out to ``/resource_monitor.json`` of the top-level workflow). *summary_append* diff --git a/doc/users/install.rst b/doc/users/install.rst index 9f500e7ec4..e5ca16f3be 100644 --- a/doc/users/install.rst +++ b/doc/users/install.rst @@ -117,4 +117,4 @@ Developers should start `here <../devel/testing_nipype.html>`_. Developers can also use this docker container: `docker pull nipype/nipype:master` -.. include:: ../links_names.txt \ No newline at end of file +.. include:: ../links_names.txt diff --git a/doc/users/plugins.rst b/doc/users/plugins.rst index 501e7aa1d6..e655e5f6db 100644 --- a/doc/users/plugins.rst +++ b/doc/users/plugins.rst @@ -82,9 +82,9 @@ Optional arguments:: exceed the total amount of resources available (memory and threads), when ``False`` (default), only a warning will be issued. - maxtasksperchild : number of nodes to run on each process before refreshing + maxtasksperchild : number of nodes to run on each process before refreshing the worker (default: 10). - + To distribute processing on a multicore machine, simply call:: diff --git a/doc/users/sphinx_ext.rst b/doc/users/sphinx_ext.rst index 6326a6041a..02832ef7f8 100644 --- a/doc/users/sphinx_ext.rst +++ b/doc/users/sphinx_ext.rst @@ -11,4 +11,4 @@ and simplify the generation process. .. automodule:: nipype.sphinxext.plot_workflow :undoc-members: - :noindex: \ No newline at end of file + :noindex: diff --git a/examples/nipype_tutorial.ipynb b/examples/nipype_tutorial.ipynb index f18cc6b187..4a01645fe5 100644 --- a/examples/nipype_tutorial.ipynb +++ b/examples/nipype_tutorial.ipynb @@ -1747,4 +1747,4 @@ "metadata": {} } ] -} \ No newline at end of file +} diff --git a/nipype/external/d3.js b/nipype/external/d3.js index 4577992aee..e1ddb0379e 100644 --- a/nipype/external/d3.js +++ b/nipype/external/d3.js @@ -9252,4 +9252,4 @@ } else { this.d3 = d3; } -}(); \ No newline at end of file +}(); diff --git a/nipype/interfaces/fsl/model_templates/feat_fe_header.tcl b/nipype/interfaces/fsl/model_templates/feat_fe_header.tcl index 1caee22a46..4d4d1939fa 100644 --- a/nipype/interfaces/fsl/model_templates/feat_fe_header.tcl +++ b/nipype/interfaces/fsl/model_templates/feat_fe_header.tcl @@ -259,7 +259,7 @@ set fmri(regstandard_dof) 12 set fmri(regstandard_nonlinear_yn) 0 # Control nonlinear warp field resolution -set fmri(regstandard_nonlinear_warpres) 10 +set fmri(regstandard_nonlinear_warpres) 10 # High pass filter cutoff set fmri(paradigm_hp) 100 diff --git a/nipype/interfaces/fsl/model_templates/feat_header.tcl b/nipype/interfaces/fsl/model_templates/feat_header.tcl index 6f5d895129..806d50c517 100644 --- a/nipype/interfaces/fsl/model_templates/feat_header.tcl +++ b/nipype/interfaces/fsl/model_templates/feat_header.tcl @@ -17,7 +17,7 @@ set fmri(level) 1 # 2 : Stats # 6 : Stats + Post-stats # 4 : Post-stats -set fmri(analysis) $analysis_stages +set fmri(analysis) $analysis_stages # Use relative filenames set fmri(relative_yn) 0 @@ -57,7 +57,7 @@ set fmri(inputtype) 1 # Carry out pre-stats processing? set fmri(filtering_yn) 0 -# Brain/background threshold, +# Brain/background threshold, set fmri(brain_thresh) 10 # Critical z for design efficiency calculation @@ -157,7 +157,7 @@ set fmri(evs_real) $num_evs set fmri(evs_vox) 0 # Number of contrasts -set fmri(ncon_orig) $num_contrasts +set fmri(ncon_orig) $num_contrasts set fmri(ncon_real) $num_contrasts # Number of F-tests @@ -259,7 +259,7 @@ set fmri(regstandard_dof) 12 set fmri(regstandard_nonlinear_yn) 0 # Control nonlinear warp field resolution -set fmri(regstandard_nonlinear_warpres) 10 +set fmri(regstandard_nonlinear_warpres) 10 # High pass filter cutoff set fmri(paradigm_hp) 100 diff --git a/nipype/interfaces/fsl/model_templates/feat_header_l1.tcl b/nipype/interfaces/fsl/model_templates/feat_header_l1.tcl index b810b272bf..fc63166cd5 100644 --- a/nipype/interfaces/fsl/model_templates/feat_header_l1.tcl +++ b/nipype/interfaces/fsl/model_templates/feat_header_l1.tcl @@ -57,7 +57,7 @@ set fmri(inputtype) 2 # Carry out pre-stats processing? set fmri(filtering_yn) 0 -# Brain/background threshold, +# Brain/background threshold, set fmri(brain_thresh) 10 # Critical z for design efficiency calculation @@ -259,7 +259,7 @@ set fmri(regstandard_dof) 0 set fmri(regstandard_nonlinear_yn) 0 # Control nonlinear warp field resolution -set fmri(regstandard_nonlinear_warpres) 10 +set fmri(regstandard_nonlinear_warpres) 10 # High pass filter cutoff set fmri(paradigm_hp) $high_pass_filter_cutoff diff --git a/nipype/interfaces/fsl/model_templates/featreg_header.tcl b/nipype/interfaces/fsl/model_templates/featreg_header.tcl index c0b0170819..a73b17bb44 100644 --- a/nipype/interfaces/fsl/model_templates/featreg_header.tcl +++ b/nipype/interfaces/fsl/model_templates/featreg_header.tcl @@ -259,7 +259,7 @@ set fmri(regstandard_dof) $regdof set fmri(regstandard_nonlinear_yn) 0 # Control nonlinear warp field resolution -set fmri(regstandard_nonlinear_warpres) 10 +set fmri(regstandard_nonlinear_warpres) 10 # High pass filter cutoff set fmri(paradigm_hp) 100 diff --git a/nipype/pytest.ini b/nipype/pytest.ini index ea149d6ed1..835b6381c9 100644 --- a/nipype/pytest.ini +++ b/nipype/pytest.ini @@ -1,4 +1,4 @@ [pytest] norecursedirs = .git build dist doc nipype/external tools examples src addopts = --doctest-modules -doctest_optionflags = ALLOW_UNICODE NORMALIZE_WHITESPACE \ No newline at end of file +doctest_optionflags = ALLOW_UNICODE NORMALIZE_WHITESPACE diff --git a/nipype/testing/data/bedpostxout/do_not_delete.txt b/nipype/testing/data/bedpostxout/do_not_delete.txt index a1df420e34..9c5c450dfa 100644 --- a/nipype/testing/data/bedpostxout/do_not_delete.txt +++ b/nipype/testing/data/bedpostxout/do_not_delete.txt @@ -1 +1 @@ -This file has to be here because git ignores empty folders. \ No newline at end of file +This file has to be here because git ignores empty folders. diff --git a/nipype/testing/data/fmri_timeseries_nolabels.csv b/nipype/testing/data/fmri_timeseries_nolabels.csv index 78df6fbd0b..c0fed6c90f 100644 --- a/nipype/testing/data/fmri_timeseries_nolabels.csv +++ b/nipype/testing/data/fmri_timeseries_nolabels.csv @@ -1 +1 @@ -10125.9,10112.8,9219.5,-7.39443,-8.74936,7.28395,13.7953,32.2328,32.4809,18.958,-12.2383,-6.86466,-23.0912,-16.425,-5.70842,11.2467,-1.58574,-4.53717,-17.3842,0.912601,13.0428,2.44622,2.08875,-8.74373,-9.47217,-6.87574,-8.11158,-14.54,0.414787,6.04424,0.540389 10136.8,10115.1,9222.54,-0.120582,-1.94906,6.92247,4.75197,11.0735,0.972766,10.2285,0.717545,-1.04488,-7.64424,-2.10875,-2.44368,1.52535,-1.14131,-1.72589,-1.1247,-0.993354,2.98318,1.29855,2.0688,1.00297,0.135373,-3.25325,-3.12065,0.913296,-1.7868,1.58829,-0.735248 10148,10122.2,9228.62,4.24336,-0.689111,5.12782,0.132862,-6.64526,-14.7952,5.19361,3.68198,2.77598,-0.691866,1.07559,1.71444,-1.30287,-2.75746,1.74208,4.75944,1.80799,-0.064464,2.37174,1.09905,3.5756,2.98064,-0.238711,0.822007,5.07188,-0.864496,-0.208741,-1.31367 10156.6,10132.2,9236.11,-0.047434,-1.79438,-0.767925,-3.78683,-2.46365,-12.9433,2.00586,-0.48292,1.16216,0.113706,-0.639879,-0.0445654,-2.82995,-2.22008,1.46544,3.70217,2.84476,-3.32792,6.701,0.982599,0.145487,0.0501163,-1.16747,-0.630382,-0.0550437,-0.0563951,0.0449386,-0.715988 10162.9,10141.8,9243.46,-0.3687,0.640608,-2.93969,-0.37466,-5.42813,-8.55527,-4.70566,-3.62351,-3.94857,0.847112,0.357187,1.39279,-3.07124,0.779726,5.12671,3.62277,2.86265,3.44378,5.49842,0.895482,-2.1777,0.14728,-0.491475,-0.0257423,-0.32504,2.28464,-0.610659,2.01955 10168.7,10149.5,9249.62,-0.272231,3.00751,-2.20783,-5.50238,-1.65733,-2.39574,-6.82249,-1.5591,-5.38806,-0.315138,2.41171,-0.227563,-0.306796,1.26618,4.45885,3.55662,3.14737,-0.0497907,2.76691,1.04757,-2.50276,3.25334,1.90194,3.54754,3.2308,0.393197,0.115407,1.88919 10175.3,10155.8,9253.09,0.271133,3.11725,-1.24188,-5.32432,6.94595,5.40219,2.63329,1.77742,-0.434798,3.20784,3.1926,-2.12653,1.4207,-0.162939,1.57116,1.20026,2.14004,-4.36978,-0.074248,0.344989,-2.79157,3.57441,2.795,6.81971,4.61981,-3.15395,-0.556388,-0.951462 10181,10160.9,9253.62,-1.52186,-1.02665,-1.31765,-8.89055,1.45638,-6.40533,-8.20284,3.42071,6.34151,7.32703,2.81444,-5.56924,-2.07761,-2.82472,1.75969,1.56549,2.59032,-4.99642,-0.861721,0.661704,1.27294,4.24609,5.72265,7.93181,6.46356,-4.54558,-2.93302,-2.55741 10182,10163.1,9253.53,-4.12759,-5.01517,-1.383,-11.7032,7.03273,-0.354258,-4.14846,2.56836,5.49077,2.70724,-0.00938943,-7.91268,-3.33257,-3.77932,-2.70035,-1.95288,1.51899,-10.5021,0.604386,1.13765,2.8031,0.719838,5.10986,5.4321,3.01561,-5.05514,-2.51591,-2.29453 10178.9,10161.7,9255.33,-2.09727,-3.23639,-0.971464,-6.47564,-1.86208,1.47429,-8.69004,2.23012,2.64935,4.20852,-0.00802028,-4.11236,-1.54808,-1.73414,-2.21966,-2.31888,0.521142,-4.49634,-1.66003,1.37105,1.47741,-1.17943,3.52554,2.31201,0.381259,-1.24137,-0.930002,-0.860505 10176.3,10158.2,9258.8,-2.87976,-1.16821,-1.15587,-7.36873,-2.70663,3.69409,-6.23946,3.17083,3.67683,5.95472,2.6739,-2.5798,1.61294,2.31642,-4.31408,-1.6647,-0.422612,-6.13843,-0.39141,1.92345,-2.82275,-0.742784,1.68164,-0.706688,-1.87652,0.172975,1.51911,1.04727 10176.2,10155.4,9261.93,-1.79655,0.511159,-2.91648,-1.19976,-6.01265,2.43062,-4.91165,1.64787,2.485,6.04132,2.79139,1.36683,2.36631,4.70105,-3.09068,-0.875835,-2.73203,-1.04036,0.0279962,0.57264,-4.70596,0.399049,0.109101,0.540718,-2.52779,1.90878,1.47212,2.48712 10177,10154.3,9263.36,-2.06935,1.47151,-1.59814,1.1621,-8.21806,2.74994,-4.8666,1.6535,2.86737,3.56179,1.87379,3.98852,2.20191,7.00018,-2.12026,-0.322149,-0.459427,1.99009,-0.386875,-1.65524,-2.88602,2.5405,3.09752,5.52644,1.72241,3.28467,2.06659,4.48929 10176.7,10153.6,9262.97,-2.47996,0.0736981,-1.18826,-1.40068,-2.38119,-1.33094,-3.87199,0.498621,1.31667,-0.952908,0.481976,0.0885501,1.11339,4.67043,-2.37383,-2.32579,0.991108,-0.25346,2.41941,-1.44295,0.0394728,1.67752,2.73018,4.10445,2.29859,0.993454,2.7469,3.39394 10174.9,10153,9261.77,-0.957748,-0.455644,0.885525,1.7746,0.0437147,0.878291,0.0855234,-0.572903,1.39546,0.00119098,1.69176,-1.96049,0.156938,2.84845,-1.18488,-2.65197,1.35428,1.98606,1.65427,-0.643756,-1.03602,-0.0406435,-0.236011,-0.961959,1.28125,-0.464305,1.75539,1.84618 10173.4,10153.5,9261.3,-0.583682,-0.792331,1.36077,0.644185,-3.55594,-0.618864,-4.88099,-0.136266,1.51362,2.73872,3.65897,-2.63062,0.416981,0.735765,0.533665,-0.326252,1.0146,2.83848,2.16063,2.30307,-2.01136,0.638055,-0.22921,-3.19692,0.947596,-0.379132,0.678065,0.747812 10174.5,10155.7,9262.24,-0.685336,0.856591,-2.63545,-0.959601,3.25442,0.791955,-2.20612,0.263046,-1.34292,4.47114,2.99912,-2.56858,-0.21931,-1.56389,-0.808263,0.311028,-2.34261,-0.965718,1.98615,3.50723,-1.41951,-0.258476,-1.16227,-1.73014,0.372641,-0.118946,-0.422557,-1.3986 10179.6,10157.8,9264.01,2.59538,3.68921,-1.9033,3.99249,0.109215,-1.86778,-4.51336,0.591929,-1.29086,1.52475,1.01934,0.773735,0.0652847,-3.00075,1.79923,2.1369,-2.11635,3.17035,-1.87907,2.19309,0.880052,-0.480886,-1.94369,-0.204693,1.63785,1.43004,-2.081,-3.24652 10186.9,10157.6,9265.4,2.10402,4.02633,0.884264,0.1708,-3.27208,-4.9215,-1.0364,1.60796,1.70888,-1.43476,1.10519,1.26841,0.0627916,-2.97727,1.13683,2.82663,-0.301705,-0.592683,-3.81587,-0.70989,1.60855,0.103857,-2.48043,-1.22737,-0.312858,1.31617,-1.91269,-3.98886 10192.2,10155.4,9265.29,1.6824,4.26755,1.57687,1.43194,-5.98808,-2.25097,0.153789,0.168572,0.879003,1.68604,0.75956,3.65922,-0.869793,-2.49312,0.497574,2.41553,-1.34226,-0.127659,-3.59295,-1.56547,0.88849,-0.785242,-4.24845,-5.15572,-4.81836,2.77035,-1.44493,-3.44434 10193.6,10153.7,9263.38,1.6491,4.80854,1.08823,5.10222,-5.26833,5.52263,-0.997094,-0.959485,-1.52356,6.15147,0.897033,7.60472,-1.50848,-0.576994,0.845199,3.25263,-2.21353,2.36454,-2.11918,-0.480371,1.405,-1.24949,-1.88424,-5.50221,-4.39822,4.6832,-0.575266,-0.350337 10193.7,10153.5,9260.14,0.371243,3.4575,-0.922956,2.86612,3.70316,4.4652,-2.35097,-2.08567,-4.55866,2.05406,0.20181,5.48777,-0.851734,-0.932792,0.852325,2.66059,-2.76402,-0.836483,3.32512,2.58318,3.54953,-1.82575,1.03107,-3.58566,-4.1055,2.71087,0.64122,1.16036 10193.4,10154.1,9256.45,0.655998,2.95689,-0.961572,2.95967,6.90968,-0.0847335,-1.13659,-2.64581,-3.78971,-2.43015,-0.722449,3.08777,-0.234356,-0.603156,1.30068,1.14368,-2.23215,0.241084,3.91588,3.38796,4.07024,-1.08082,1.15617,-0.375163,-2.54369,1.29418,0.795869,1.31402 10190.3,10152.8,9253.2,2.59279,1.93007,1.93861,4.82647,-1.84288,-5.84018,-7.03235,-2.16958,-0.8999,-4.4747,-1.99497,2.40008,0.0349671,-0.825783,2.00993,-0.184404,-0.576706,6.30193,1.43455,3.63536,2.34484,0.148851,-1.22127,-0.718508,-0.716753,1.50537,0.412978,0.73252 10185.2,10148.2,9250.73,1.88291,-0.127643,2.41457,0.38457,3.28565,2.40364,1.07674,-0.352091,-0.192694,-2.80281,-2.45121,-0.746935,0.454781,-0.345492,-2.38393,-2.35152,-0.468918,-0.28004,0.207449,2.6636,-1.39254,-2.09536,-4.44811,-4.48824,-2.93117,-0.770421,1.19,0.219788 10183,10142.2,9248.93,3.78484,0.701338,-0.71552,3.48407,0.454755,4.3743,3.68099,-0.668556,-3.42636,5.52772,-1.23863,-0.405148,0.665698,1.06479,-0.0251586,-0.48849,-0.847741,1.4814,-5.36764,-0.405219,-1.51485,-3.88226,-5.12764,-5.33767,-4.3365,-1.173,0.417418,0.415356 10185.4,10138.4,9247.93,3.11727,0.196163,-2.018,0.721283,-2.5075,-1.06349,0.331823,-1.2182,-4.01712,4.78444,0.452166,-2.16432,0.55673,1.61447,1.16718,1.44415,0.569846,-0.812131,-8.14324,-2.91296,2.43154,-1.45218,-0.730675,-1.0947,-2.25658,-3.52675,-0.361214,1.09266 10188,10139,9248.05,1.52249,-1.16117,-2.4591,-2.41492,-0.35832,-7.48161,-0.0490082,-2.1421,-3.52013,0.903896,-0.958215,-5.8036,-2.36788,-0.368615,-1.88998,-1.40466,-1.28791,-4.79995,-5.58563,-3.57656,4.13739,-0.274441,1.53352,2.93946,-1.96753,-6.76034,-1.87752,-0.324793 10186.8,10142.9,9249.23,2.29541,-0.414867,0.263844,-2.42527,-9.23597,-12.7958,-5.40665,-1.3296,-0.255947,1.05195,-3.09731,-3.83996,-4.40177,-0.0123634,-1.79533,-2.22933,-1.59891,-1.58539,-4.29444,-3.24283,2.73497,0.939395,2.25632,3.98042,0.672842,-4.87272,-3.0871,0.140664 10183.8,10146.3,9250.93,1.04007,-0.107056,-0.719832,-5.17314,-6.41206,-13.4527,-3.51115,-1.82372,-1.0661,0.164654,-4.87432,-3.16371,-3.16216,0.547311,-2.31938,-3.32366,-2.59406,-3.07878,1.07584,0.135595,-0.15385,-0.198986,-1.76614,-0.364142,-1.44816,-3.17832,-0.666637,0.539005 10182.5,10148.1,9252.57,1.58315,0.552138,-2.38854,1.84879,-2.25441,-6.8381,0.208721,-2.73312,-3.19332,-2.49192,-4.21087,0.445019,0.0651566,2.67403,-0.780414,-2.43461,-3.10543,1.48742,-0.123359,0.0321366,-2.00728,-1.30717,-5.02137,-5.05394,-3.39985,-0.233706,2.10556,1.51466 10182.7,10149.6,9253.33,0.671616,-1.8801,-5.19861,1.6691,-0.386439,-6.73637,0.390118,-1.36276,-2.8229,-3.74619,-1.53148,0.15594,0.934737,1.96014,-1.35363,-0.924511,-3.00858,0.653744,-1.84706,-3.59509,-0.247233,0.962108,-1.40552,-3.28119,-2.22432,0.0626129,2.48273,0.969888 10182.9,10150.9,9252.01,0.0166707,-2.52456,-5.48285,2.26653,-2.03587,-6.50283,-1.00325,0.264499,-1.46362,-0.822672,-1.11829,0.403605,-0.734484,-0.382999,-0.186567,1.24812,-2.13095,1.80897,-2.82131,-6.15356,2.54337,2.39696,2.51379,2.41699,0.307725,-0.195503,-0.252349,-0.890546 10182.1,10151,9248.33,-1.21698,-1.52567,-2.334,0.102378,3.74418,-1.36756,3.51501,1.50357,-1.80774,-0.855037,-2.71284,0.0746735,-1.2904,-2.37263,-0.326812,1.37779,0.0811662,-2.04277,0.452769,-4.37491,4.60025,0.785458,0.944597,2.57121,-0.443829,-1.9031,-1.78376,-2.25217 10180.2,10149.4,9243.85,-0.498632,0.815261,-1.05027,1.32586,2.65892,-5.17029,-0.588453,1.63481,-3.33979,4.4087,-1.26981,2.01576,-3.03953,-3.66687,1.33091,1.62961,0.568999,0.53543,0.477935,-1.78405,3.91722,-1.12653,-3.07327,-2.27103,-2.21119,-0.0469714,-3.05949,-3.83303 10176.1,10146.3,9240.54,-0.464849,1.25223,-1.14736,-0.645201,4.96922,-0.805424,1.85313,1.43677,-1.45072,6.22509,1.54511,2.89442,-3.56094,-4.35854,-0.476689,0.39343,-0.929162,-1.07774,0.941846,-0.57756,0.363373,-1.13491,-1.30865,-3.06369,-1.8739,2.47973,-3.19611,-5.38414 10169.3,10142.4,9238.91,2.28739,1.91951,-0.759834,1.17008,-1.10807,0.137649,-1.76481,-0.427729,-0.592675,2.50623,0.607717,4.10404,-2.20382,-5.11375,1.80008,0.383348,-3.40396,4.33491,0.605228,-0.0871236,0.185566,0.480246,2.74078,1.48145,2.07534,4.96863,-2.65852,-5.78272 10162.1,10139,9238.14,2.03262,2.32633,0.46709,-2.26524,5.80967,5.85587,5.67759,0.185696,-0.246666,-0.787877,-0.201738,0.61348,-0.542043,-3.51173,0.345287,-0.426571,-4.01566,0.315299,2.10005,-0.391753,2.39343,1.28396,3,4.99164,5.3145,2.31592,0.0224444,-4.14279 10158.4,10136.9,9237.31,2.77556,2.83113,1.37245,1.19159,2.19923,-2.0116,3.1913,1.03754,-0.929092,0.870894,1.00256,-0.624392,-0.561338,-2.99529,2.23674,0.823539,-1.63024,3.75817,0.298891,-1.18515,4.54738,1.25951,1.91277,3.57793,5.44217,0.785618,0.025315,-3.27161 10158.5,10135.5,9236.37,0.0672571,0.761886,2.35427,-0.889999,6.73976,-1.98269,8.45302,1.1398,0.0604089,-1.15193,1.32222,-2.47069,0.131408,-3.48238,-0.669944,0.753279,3.07189,-2.04262,0.174304,-2.32107,2.83224,0.708328,3.23848,0.984911,2.384,-1.28385,-0.548071,-3.32946 10160.6,10134.8,9236.46,-0.783525,0.239203,0.00548465,1.88108,6.83171,-2.89703,7.27976,-2.71585,-1.47417,2.12383,-1.04536,-1.14095,0.145875,-4.3962,-0.139564,0.781551,3.40043,-0.28834,-0.343608,-2.36391,0.0938093,-0.36295,1.0276,-0.578692,-0.619797,-0.489157,-1.92106,-4.163 10166.1,10135,9239.02,0.124276,1.29463,-1.44975,3.21172,2.53479,-3.38317,-0.20102,-4.72755,-2.14129,5.53743,-1.24849,0.994366,0.436372,-3.09635,2.19121,1.13794,1.52365,3.0586,0.622146,-0.699363,0.103461,0.316277,-1.73095,-0.195395,0.490618,1.44514,-2.50878,-3.62472 10175.6,10136.9,9243.9,1.67228,1.70099,-0.125799,2.04051,6.74509,2.05118,7.82124,-3.08565,-1.70842,3.37127,-0.160655,1.32998,0.57087,-1.46351,1.80831,-0.585194,-0.267853,0.719624,2.12333,-0.931791,2.61407,0.519467,-1.78038,1.70819,2.66646,1.47407,-2.48388,-2.6294 10184.4,10140.5,9249.09,4.05746,1.49391,3.1491,4.74869,1.42089,-7.65297,4.6083,-1.50292,-0.681543,0.792377,-1.54194,2.19467,-1.449,-2.54459,5.38937,-0.0662613,0.683022,6.46847,-1.151,-2.09676,5.40097,0.0884146,-0.584039,0.411805,2.87021,2.70096,-3.69024,-2.72328 10185.2,10143.8,9252.71,2.20708,-1.9117,6.2705,-1.38994,9.88462,0.984595,14.8745,1.09177,3.01497,-6.59006,-3.06879,0.864155,-0.352553,-2.42934,1.6214,-0.899998,2.90809,-2.62154,-0.748965,-1.78716,3.1828,-0.76616,1.51574,-1.80336,0.759499,1.08543,-1.48814,-0.830864 10176.5,10145.2,9254.8,3.08758,-1.24415,2.30133,1.5123,4.9996,-2.25743,5.71269,0.326257,0.862459,-5.32366,-2.15784,1.98295,-0.769376,-3.24456,1.73394,-1.18022,0.303592,1.19388,-1.18318,1.1848,-0.484859,-3.12715,-2.31674,-4.16244,-1.41399,2.32149,-1.0187,-1.70219 10164.6,10145.4,9256.92,1.59078,-1.06701,-0.557541,-2.88977,3.22953,-0.245042,-0.474481,0.0498212,-1.16809,-8.33134,-0.306573,0.38113,0.242976,-2.39828,-1.29092,-1.68013,-0.127576,-1.94114,1.03024,1.7825,-1.44807,-2.86352,-4.13379,-1.78466,1.5241,1.16147,-0.513496,-2.30027 10156.4,10145.9,9260.21,0.0333157,-1.40254,-1.63643,-2.63202,2.15792,2.8366,-1.32406,-2.25364,-4.61227,-7.74587,-1.005,0.107792,-0.131513,-2.0428,-1.28031,-1.65736,-0.0589992,-0.767749,0.0451012,-1.23948,0.334266,-2.05544,-5.74107,1.40617,2.47259,0.129519,-1.22605,-3.50154 10152.5,10145.2,9264.25,-2.23854,-3.34598,0.871046,-4.48776,-5.12246,-0.367558,-7.49548,-3.04105,-2.99035,-3.84367,-2.67766,1.19195,0.695189,-1.99211,2.38266,0.800284,2.92667,1.82052,-0.796218,-1.82753,3.43662,1.60186,-2.49788,2.02216,2.59346,0.975508,-0.397427,-2.78437 10148.6,10141.1,9267.56,-4.64613,-5.4569,3.80281,-6.22039,0.554038,5.00519,-0.395733,-3.04225,0.570141,-6.95862,-4.49105,-0.00732036,3.78285,-2.09066,1.46914,-0.873643,3.95228,-2.08532,2.8568,0.749314,1.78963,1.02579,-0.808831,-1.60113,-1.17483,0.544949,1.95805,-1.27827 10142.4,10134.6,9268.73,-4.02228,-5.3818,4.39201,-6.57399,-2.68308,-0.146626,-0.297909,-1.28233,3.72363,-10.5635,-3.46562,-0.498293,3.92457,-1.10422,0.725311,-0.888612,3.1725,-1.82837,4.64182,1.32637,-0.56378,0.781271,3.29557,-0.557202,-0.712584,0.587691,2.76212,1.05325 10137.8,10128,9266.83,-2.98689,-3.62614,2.49614,-3.78405,5.33483,-3.24499,-1.4797,-1.49474,0.75769,-13.0722,-3.57543,-1.73535,1.13307,-2.81826,-2.67056,-2.75063,-0.407379,-1.38965,7.67619,2.2374,-2.93415,-2.1994,0.956463,-2.25511,-4.42128,-0.889014,2.30781,-0.144069 10139.6,10121.2,9261.84,-1.19244,-2.09691,-1.17019,-2.92359,1.84257,-9.64131,-8.2266,-2.48032,-2.29368,-7.41116,-3.60172,0.404837,-2.31741,-3.52505,-1.14341,-1.1367,-2.22469,2.93998,5.91064,0.841518,-1.68308,-1.06298,-0.398387,-1.68239,-3.53445,0.38234,1.02165,-0.403129 10146.2,10113.8,9255.3,-3.35595,-3.34535,-1.74811,-10.4556,3.60927,-0.776329,-3.08604,-1.29687,0.835023,-5.76979,-1.7646,-2.22816,-1.31439,-0.382083,-1.73312,-0.792276,0.206848,-4.1992,4.29806,-0.830575,-1.71405,1.40452,2.00247,0.106559,-0.768805,-1.08451,1.11784,1.22578 10152.4,10107.8,9249.87,-2.49869,-3.87311,-1.98238,-6.90342,-1.23671,2.90852,2.97754,-0.581043,2.81778,-2.71728,-1.21684,-5.07044,0.497485,2.01224,-0.365556,-1.64542,1.17956,-3.76085,-0.573467,-2.58111,-2.12663,0.378165,4.18795,1.24581,-1.36196,-2.87649,0.482267,1.63454 10154.8,10107.2,9247.27,-4.01788,-5.39388,-1.72161,-10.3153,-0.251037,-1.57831,1.61553,1.18147,5.7765,-0.599766,-1.22598,-10.0294,0.895145,2.02015,-4.45992,-2.58818,2.98391,-9.45103,-1.41902,-1.29446,-0.55725,-0.180421,6.94249,-0.594659,-3.53394,-6.50742,1.38112,1.51458 10153,10112.2,9246.76,-3.24249,-5.01072,-2.02956,-7.46567,0.0264794,-1.5224,-3.31193,1.53111,5.32332,2.5335,0.40251,-7.05633,-0.711568,2.89381,-5.39998,-1.36446,2.04786,-7.02942,-4.53297,-0.88262,-0.357391,0.595822,6.5409,-2.84395,-2.64994,-5.7378,1.39939,2.97985 10148.7,10119,9246.16,-3.96002,-4.42756,-3.26432,-8.69557,4.03628,0.616301,-3.92147,2.76458,1.652,2.17356,4.22927,-4.5247,-2.33417,3.89508,-5.29918,-0.309883,-0.288513,-8.36711,-3.09529,-0.126421,-1.8539,2.38545,3.61409,-1.26649,0.429596,-4.19612,1.45711,3.95651 10145,10125.2,9244.17,-1.75695,-0.511195,-1.73883,-3.34742,-1.26592,5.24499,-3.03549,2.78645,-2.1334,0.220919,5.88292,0.160927,-1.7455,5.37331,-1.59599,1.91312,-0.631146,-3.16886,-2.94994,0.34822,-3.01289,2.84951,0.356135,3.47859,4.18276,-0.12287,0.984563,3.64398 10143.1,10130.2,9241.27,-1.71615,1.12867,1.04805,-6.57347,2.41341,16.2593,7.00371,0.924589,-2.71609,-6.2656,3.57183,0.37743,1.96421,5.66573,-2.3041,2.26799,0.668846,-8.32571,2.30148,2.66333,-1.75615,2.71555,1.44408,6.00224,4.85886,0.685304,3.03234,2.82015 10140.7,10134.4,9239.05,-1.25992,2.46902,-0.556969,-2.76672,5.45596,12.4649,8.36959,-2.49709,-3.8708,-1.40646,1.38854,1.37064,2.12007,3.84209,0.459629,2.15086,-1.24194,-4.15365,4.52043,5.4809,0.876317,0.656659,-1.01116,2.09458,1.65028,2.77599,3.21635,0.381243 10133.6,10137.8,9238.32,-2.22442,1.37094,-0.787327,-1.05469,3.55443,5.14715,-0.0509983,-0.0905216,0.72894,3.96149,2.38061,1.75467,3.09083,4.18358,2.79613,3.29833,0.325666,-0.671704,6.07566,7.72379,3.13564,0.655668,-2.59152,-1.76199,1.58102,4.45884,3.34631,0.480564 10121.1,10140.7,9238.2,-2.17367,-0.866588,-2.79273,0.692199,10.1863,9.97874,6.04483,2.66482,1.76948,2.61332,1.9281,-1.1243,5.03132,3.85731,-0.443337,0.284932,-0.868815,-3.31091,8.51065,6.49177,2.23459,-1.67042,-3.77735,-2.781,-0.902713,1.50205,4.04064,0.197185 10110.8,10144,9237.47,0.303664,0.966366,-2.65365,4.69141,3.98147,5.09796,4.57488,3.26927,0.562439,5.41174,1.92471,-1.15766,3.6349,2.42314,-0.0874924,-0.0560302,-1.22366,1.9914,3.44357,1.69106,1.98031,-1.32375,-0.576816,-1.03349,0.269332,-0.300454,3.28264,-0.458562 10110.3,10147.7,9235.48,1.28867,0.940385,2.1165,-0.581377,-0.643187,-2.16313,1.69237,2.47912,1.37859,3.32286,1.26412,-0.720553,2.36863,-1.25903,0.0706914,0.944374,2.2859,0.229574,1.5842,-0.12766,4.43122,1.34327,3.34673,-0.404948,2.87655,-1.67866,3.04869,-0.25307 10116.7,10150.7,9232.33,0.394714,-0.833445,4.94793,-6.11826,9.22151,2.99358,11.1041,1.15853,2.93899,0.397365,0.0221406,-0.0976144,-1.13452,-3.42557,-3.72862,0.476803,3.69054,-8.12164,2.48493,0.363106,3.87676,0.504363,0.972674,-1.44388,2.15926,-0.828986,1.75931,-0.549928 10121.4,10152.8,9229.14,1.29508,-0.757006,3.12597,-1.6729,7.62364,-0.936804,6.48918,-1.03742,1.86227,-0.262351,-0.75051,2.31301,-4.8422,-4.5034,-2.66476,0.578808,1.27532,-2.04282,3.45288,3.01897,0.564668,-1.21876,-3.06331,-2.70583,0.257935,3.52846,-1.56111,-1.5308 10121.6,10152.4,9226.86,0.677648,0.378414,1.31475,-2.61018,4.91454,0.37514,2.86121,-0.193973,1.93324,-4.63591,1.10695,3.14457,-2.96694,-2.19304,-2.99025,0.50097,0.165722,-0.200595,6.85438,4.63234,-2.47705,0.342532,-1.30419,-0.141339,1.63084,4.32707,-1.19328,0.76139 10120.5,10149.2,9225.49,0.499478,1.88224,-2.14427,-2.77288,10.6927,1.71766,6.49787,0.43981,0.0705592,-5.13201,2.57263,1.48076,-1.20267,-0.591255,-4.74193,-1.79266,-1.46188,-3.42451,8.04316,3.54243,-2.30088,0.0710442,-2.83238,0.653942,0.240506,0.904871,0.430945,1.6283 10121.2,10144.8,9224.89,1.35965,2.80608,-1.94166,1.75583,0.26227,-8.26437,0.567312,1.6259,1.60009,0.0627174,2.62631,2.65738,-1.31444,1.36503,-0.138702,-0.303116,1.07964,0.805711,0.6712,-0.0379901,0.596301,1.49046,-2.9437,-0.0854658,1.7116,1.14138,0.19577,2.11315 10121.7,10140,9224.64,-0.625981,1.46152,0.571473,-0.708952,-3.97306,-7.60183,3.54876,2.52756,3.43643,-3.37318,1.25185,1.95327,-0.430742,1.99167,1.38528,0.439469,3.35733,-3.21518,-3.33649,-3.33716,1.63613,2.87364,0.216347,-1.19264,2.34646,1.38095,0.250252,2.26893 10117.5,10135.7,9223.59,-0.644241,3.50756,1.18011,1.32346,-4.09529,-1.15572,8.91836,0.864807,0.810206,-4.21922,0.85698,1.54667,-0.984211,1.49262,0.424346,0.272079,0.55043,-3.11065,-4.92549,-5.21789,0.616593,0.933381,0.453042,-0.907799,0.816878,0.888407,-1.07882,0.897744 10109,10134,9221.44,1.24811,3.97674,3.11247,-1.16572,-9.20759,1.26864,10.07,0.861166,0.629341,-5.07074,1.84156,0.554677,0.501606,2.3508,-1.99158,1.42546,-0.0624237,-4.75601,-4.11731,-5.27973,3.12042,0.927954,2.01431,1.91643,2.26937,-2.42322,-1.85499,2.11246 10103,10135.6,9219.87,2.2046,4.10281,1.87105,-2.44462,-1.81059,2.73657,16.517,1.49188,0.862687,-1.50652,2.91423,-2.27191,-0.311967,3.16828,-6.05317,-0.647296,-0.600809,-9.86797,-3.317,-4.05579,3.51099,-1.77799,-1.17227,0.17711,-2.12588,-5.86398,-2.08211,1.43944 10103.9,10138.7,9220.3,3.77174,5.49059,1.2637,1.03751,-12.6254,-6.24364,0.90728,3.65224,3.71822,2.59825,4.31988,1.86088,-2.62582,4.43061,-1.00461,2.10803,1.47555,-3.28777,-8.18549,-4.31695,2.95113,-1.34785,0.676274,-1.38936,-3.04336,-1.37001,-2.35773,2.00922 10108.6,10140.8,9221.82,-0.70593,3.90046,-1.14247,-3.0764,-1.47295,-1.10809,-0.510284,3.79285,2.60078,-1.28697,3.77566,2.32766,-3.54475,2.99719,-1.20306,1.33262,-0.719923,-9.06449,-7.33119,-4.80493,-0.721145,-2.4024,1.79362,-1.97223,-5.04385,0.0875954,-1.73778,0.950888 10113.1,10142.1,9223.55,-1.06377,0.843971,-1.44889,-5.32939,2.69029,-3.83385,-5.63119,0.535717,-1.61039,-5.59267,1.26514,2.05707,-3.31026,-0.958826,1.33732,1.46551,-3.13585,-9.66605,-6.00234,-4.35532,-0.26599,-0.831562,2.98878,0.128679,-2.54674,-0.278737,-3.58409,-1.324 10120.7,10142.9,9227.01,3.56995,1.04759,3.75113,-1.7421,5.12807,3.1454,2.38504,-1.62768,-2.93793,-5.71266,-0.530001,2.84448,-2.04436,-1.31251,2.17243,2.11298,-0.867238,-7.66197,-6.87331,-3.32769,-0.373459,-0.116178,2.03689,0.379397,-0.00605166,-0.182103,-4.1657,-1.22794 10135.1,10142.1,9232.63,4.13322,3.14571,5.42112,-9.50857,6.61076,-1.5265,-1.3563,-0.229734,-0.953633,-2.39287,0.0907423,-2.25912,-2.95494,-0.622513,-0.878638,3.11006,2.20909,-12.7591,-4.65267,-0.652931,-0.508727,-0.484787,-1.43884,-3.89903,-1.68783,-1.20607,-1.47415,-0.30987 10150.6,10139.9,9237.26,7.08686,7.1115,3.05908,-7.31514,-2.75139,-6.15754,-6.75994,1.34201,0.583247,1.72791,0.0586144,-1.05549,-2.23348,1.35232,0.957745,3.9225,0.27845,-7.28043,-8.71747,-3.21629,1.12263,-1.08286,-3.72117,-4.10901,-0.817087,-0.319549,-0.171801,1.86899 10161.3,10137.9,9238.2,5.45348,5.872,0.0360833,-8.71486,1.68904,-1.57501,-9.84544,2.70784,2.39605,-1.45535,-0.548901,-2.93743,2.31592,2.21738,-0.0678836,1.75621,-1.90485,-7.83172,-5.34721,-0.902631,2.89369,0.938874,1.08004,0.946796,3.39736,-3.2386,1.23533,3.43628 10168.7,10135,9236.89,1.9988,3.16081,-0.959961,-1.65775,15.8147,12.2058,-6.43511,1.69639,2.59198,-2.06327,-0.47323,-4.35241,3.77438,3.79233,-2.16153,-2.08622,-2.56136,-3.89096,-0.736348,5.49778,-0.475583,0.770127,3.05002,3.17719,3.81221,-4.99556,1.59718,3.01185 10178.3,10131.2,9237.28,0.818385,-0.233269,1.46873,6.63122,10.9706,17.5879,-3.54675,0.677416,3.72244,0.655626,-0.201865,-1.16835,1.57109,5.42876,-0.444523,-1.12764,-0.256929,5.62565,-1.99386,6.4084,-2.47406,1.18593,3.2834,3.0293,3.51573,-2.53776,0.959038,3.23253 10193.3,10130.2,9242.16,-2.48525,-2.35837,2.98987,5.98816,11.4719,15.9039,-4.84232,-0.825315,2.54659,1.43064,-0.659643,-2.96556,0.571285,2.41784,-2.00371,-0.757574,1.41844,6.37057,1.42823,7.71148,-4.93994,-1.54988,-0.232174,-1.34349,-1.26249,-2.05601,1.26179,0.464125 10210.2,10133.3,9250.5,-0.302459,-1.69801,0.843368,2.30597,6.15326,11.0157,-5.9274,-1.05244,-1.68469,-0.278629,-0.694935,-0.891837,1.23651,-0.21345,-0.305015,-0.0987808,0.160233,4.91775,0.166271,3.92353,-3.88399,-2.55526,0.198425,-0.923912,-1.86728,-0.552523,1.22445,1.15572 10221,10137.3,9258.6,-1.56339,-0.256664,0.840544,-1.61826,11.0061,14.4706,-2.59098,0.449882,-1.65171,-1.89163,-1.35949,-1.40198,3.60618,0.270121,-1.02351,-1.1912,0.778059,-0.110922,0.867721,2.27546,-5.20223,-2.14642,1.17716,-1.36266,-2.51971,-1.10085,2.42789,2.32548 10222.9,10141.6,9264.61,-4.74868,-0.212232,1.05283,-1.29221,10.744,4.75459,-2.81401,0.644295,0.850172,0.179994,-3.01777,-4.30435,2.71079,-1.12735,-1.29174,-2.07496,1.34575,1.0376,2.5823,1.95702,-4.5778,-1.28586,-0.494008,-4.39926,-5.46478,-2.40477,1.70545,-0.546783 10222.5,10148.7,9269.02,-3.49502,-0.678579,-0.213247,8.06515,8.4472,0.736921,12.8231,-0.680516,1.09355,1.44143,-3.62765,-2.08929,0.194595,-2.35671,-0.392866,-2.86869,-0.655593,6.76095,0.52286,-1.94996,-0.69629,-1.94695,-3.05311,-3.36287,-5.8798,-2.04553,-0.962602,-2.08692 10226.3,10155.2,9271.48,-1.96969,-0.131236,-7.34816,10.3469,1.43629,-18.1274,6.28789,-1.94889,-4.21799,9.10578,-0.96868,-0.513386,-5.07894,-4.75252,3.07715,-1.21549,-4.62974,12.6049,-2.11208,-4.5134,4.07597,-2.26695,-5.31607,-0.080814,-4.75562,0.0499323,-2.60796,-2.05158 10230.1,10151.7,9270.27,-0.441668,1.99564,-2.24149,10.4542,-4.09391,-6.45561,-1.77752,0.712394,-1.02642,8.25875,2.54249,4.31177,-1.67116,1.28898,3.90167,2.27301,-0.292013,13.1856,-3.31394,-4.23242,0.509949,-0.582218,-1.55254,1.54596,0.383257,3.15094,0.659781,3.83919 10224.9,10138.7,9266.49,4.67287,5.1299,-1.26323,13.4301,-10.2745,-9.49416,-12.2719,-1.18436,-2.87586,6.16837,2.83569,6.07774,-2.8315,2.00898,6.40272,2.01559,-1.86315,15.8694,-4.72684,-3.25468,-2.65905,-3.311,-6.24296,-4.21139,-3.70695,4.80612,0.395122,1.76566 10212.8,10131.4,9265.67,3.01888,4.86272,2.80549,9.41976,5.08199,16.7307,3.01517,-1.39232,-0.901598,-3.17761,2.70511,2.89126,0.206015,2.09237,1.79821,0.427067,-0.286912,4.97158,1.88506,1.52106,-4.78901,-3.10639,-5.19696,-1.88352,-1.17405,1.76068,1.66502,-0.462334 10205.3,10137.3,9271.29,5.0191,6.44861,-1.029,10.2232,1.46143,6.79866,-7.1328,-3.52906,-8.32347,-3.93806,2.03961,4.301,-3.73195,-3.92217,6.44854,2.90593,-2.49697,11.4551,-0.562561,1.57056,0.711111,-0.350636,-4.25263,3.76126,3.75639,3.70316,-1.79131,-3.47622 10205.7,10147.7,9278.59,5.83546,6.36501,-0.202118,7.16455,-12.9828,-12.4607,-27.3389,-3.33415,-9.60681,-6.26496,-0.539386,6.78879,-3.91681,-6.10831,9.8609,6.12423,0.502419,17.71,-2.72276,0.90307,5.89102,4.35576,1.47131,6.87862,9.08531,6.44279,-3.45175,-1.92878 10205.4,10153.7,9279.43,2.61204,3.79426,2.8599,4.2373,-6.30104,-6.55433,-17.9117,-2.30217,-4.33352,-8.56342,-2.54108,4.06241,-0.221565,-2.25183,3.87958,2.42384,1.7425,10.0636,-0.274803,1.38918,2.9688,2.49859,1.85002,3.57782,5.56749,4.25356,-1.57246,0.769565 10198.3,10155.2,9271.53,1.79363,-0.436721,3.46418,1.17919,-6.21503,-12.0337,-14.7144,-0.753172,-0.422946,-10.0673,-1.05729,0.16841,0.00393219,0.329848,3.06417,0.641188,1.13987,4.50086,-1.96838,-0.158451,2.22687,1.01485,-0.617827,-1.82684,0.837829,1.35672,-0.969077,2.83866 10187,10154.7,9258.9,0.357944,-3.85399,-0.403587,-0.905802,-6.94279,-16.6984,-17.7781,-0.22625,-1.87358,-4.80273,-0.208291,-3.41762,-1.38116,-0.435891,4.56144,1.47257,0.881539,4.31043,-2.35524,-0.63135,2.49929,2.73787,-0.3439,-0.967951,0.479767,-1.25236,-0.198644,2.70849 10175.5,10150.8,9245.55,-2.22289,-4.64417,-1.57873,-3.37822,-3.35046,-9.88201,-14.3071,0.168661,-0.756661,-2.69992,-1.57269,-4.61371,-0.741804,-0.794809,1.95045,1.34471,1.90438,0.670421,-1.36383,-0.0207592,1.95603,4.44548,1.70081,0.896225,1.96219,-2.68814,1.37985,1.21966 10163.9,10144.5,9233.39,-1.0609,-3.6573,-1.22008,-1.66234,-8.72059,-9.8591,-9.71449,-0.237702,2.4907,-0.383432,-2.45784,-2.52105,-0.451308,-0.95008,0.101755,0.998499,0.0147502,0.763548,-2.08901,-0.286814,2.08671,3.24587,1.98374,-1.03823,1.41551,-1.64013,0.866956,-0.452541 10152.5,10140.9,9224.11,1.58528,-1.3177,-2.21666,-0.770113,-12.1162,-14.2306,-0.877621,-0.372338,1.62768,2.76293,-0.69447,0.389726,-2.24466,-0.492948,-1.07534,1.2119,-2.84085,1.62365,-4.58137,-3.47859,2.38127,-0.58689,-1.20067,-5.12188,-1.38938,0.191315,-1.00868,-0.231626 10144.9,10141,9218.45,2.9188,-0.174985,-4.58083,-6.94645,-12.0718,-23.1781,-6.27315,-0.364715,-3.24703,1.70145,0.993811,-0.598274,-3.56103,-0.759525,0.496704,2.46032,-1.89983,0.597576,-2.01394,-2.93857,4.73883,-0.682548,-1.34504,-3.70636,-1.23983,0.0550942,-2.01066,1.58053 10141.8,10139.7,9215.32,1.06474,0.421951,-5.29652,-9.2234,8.36446,-5.7284,0.960531,-0.909556,-4.90704,0.770291,1.54135,-5.62095,-2.20122,-1.09503,-2.35206,-0.974175,-1.0101,-7.23319,3.01594,0.768168,2.39478,-1.32615,-1.6404,1.53725,-1.51813,-3.97654,-1.7665,0.833795 10141.4,10134.3,9214.23,0.86273,1.35397,-0.657898,-4.72598,2.71892,1.93911,-8.71178,0.127278,0.812447,5.14689,3.34014,-5.47575,-0.124804,-2.70815,-0.541837,-0.600256,1.53834,-3.53843,0.0605411,2.43643,0.689316,0.936364,1.45495,3.58725,0.917646,-4.12549,-2.16127,-1.91164 10145.6,10128.8,9217.09,0.035273,1.26692,3.11502,-4.96307,-6.78084,1.02172,-8.79811,2.69846,4.94751,11.3598,6.51275,-2.0705,0.657905,-2.59061,-0.35795,1.18908,3.42851,-3.05799,-3.41004,0.806424,0.399374,2.92706,4.4301,0.273598,0.553543,-1.76552,-0.755718,-3.46001 10157.5,10128.8,9225.31,0.248702,0.312336,2.57768,-4.36878,-7.1619,-0.049009,-3.2758,2.7151,1.99544,11.1247,7.80862,3.2311,1.05086,1.13953,0.117826,1.5885,2.6575,-2.74279,-2.82058,-0.206648,1.25493,1.71967,2.81266,-4.13773,-2.45207,2.50385,0.789243,-0.268176 10170.7,10133.1,9236.11,-2.23675,-0.885477,2.34602,-6.30375,3.19378,12.3402,5.26964,2.51006,1.86666,4.33237,6.63528,4.85198,3.48519,8.46812,-2.52066,-0.634166,3.57125,-6.40349,1.46869,0.818123,-1.68738,1.2743,1.91738,-0.951766,-0.403311,4.63843,3.18061,7.04436 10176.7,10136.2,9243.78,0.782244,0.338989,-0.179665,0.677035,-11.8864,-9.98092,-16.6014,-0.0876104,-1.39338,0.511794,2.05749,5.37285,2.64871,7.7119,4.8232,-1.23349,2.56586,8.98335,0.643413,1.73431,-0.63479,2.49537,-0.600719,2.26345,1.69812,6.71431,2.31721,8.10433 10176.8,10136.6,9245.84,-3.20567,1.13405,3.92668,-1.78597,-0.236073,-2.19382,-11.4115,3.08973,1.33702,-3.27145,0.727769,-0.100717,5.38921,8.19297,0.492232,-2.20151,5.25989,3.6589,4.08819,2.21554,-1.32513,3.54291,0.119275,3.23854,3.862,2.19948,5.28701,6.25834 10178.4,10137.4,9245.74,-5.53585,0.420645,5.85295,-4.47724,14.54,12.4497,8.36972,4.99424,2.57479,-4.3639,0.677018,-2.6813,6.67898,7.5884,-5.54187,-1.3688,4.05586,-6.15054,4.2909,-0.899213,-1.24567,1.90686,-0.469126,1.72139,5.00978,-1.65339,6.96518,3.71489 10184.8,10141.1,9247.89,-4.95644,-1.91401,3.7243,-7.95873,7.49028,6.40526,5.31843,3.53676,4.4376,-3.95261,0.746514,-2.92295,5.17495,5.09822,-5.56387,2.13589,1.74219,-7.51099,1.13636,-2.24892,-0.712168,1.40767,0.401594,-0.663717,6.22808,-1.51586,5.59537,1.86444 10195.1,10147.9,9253.27,-3.98,-3.06823,-2.05534,-6.10099,3.83685,4.55708,3.92119,0.928846,2.49159,0.0763172,1.14792,-2.88509,3.3624,3.14131,-4.76678,1.53759,-2.49281,-5.00974,0.3227,-1.57677,-2.36177,0.558465,1.76223,-0.153596,3.21585,-0.248642,3.44061,1.09292 10206.6,10155.3,9259.98,-4.64998,-1.64546,-4.6585,-6.92405,-1.23826,-1.4651,-7.80907,2.03872,0.322905,5.35637,2.9557,-1.90346,0.941137,2.90995,-2.25745,1.6362,-2.73525,-3.06893,0.361893,-0.410406,-1.95298,3.18373,4.96997,3.18307,2.09522,2.29277,1.29516,1.46329 10215.1,10159.8,9265.65,-5.64262,-2.22323,-2.32616,-8.62966,1.24852,3.53986,-7.11813,2.5704,-0.221435,0.41167,0.765415,-1.44792,2.10023,1.14341,-1.90736,0.761342,-0.0657556,-6.90094,4.60419,2.00852,-1.1143,4.44335,7.23913,4.6059,2.18355,1.92624,1.0442,1.06642 10218.9,10161,9269.98,-5.54728,-2.69742,0.623383,-4.54971,5.62832,12.115,1.60837,0.527375,0.225195,-4.35554,-1.09064,-1.69716,2.68584,-2.42078,-3.28377,-0.48855,1.46337,-7.59929,7.41232,3.78152,-1.52786,1.12019,5.14455,0.902689,0.791392,0.171231,1.01653,-2.1951 10225.1,10161.4,9274.87,-4.18459,-1.40959,4.0543,-3.78563,4.56469,13.1486,7.4468,1.32559,4.01602,-4.26528,2.47676,-0.706977,1.49841,-2.44619,-4.48237,0.314642,3.21848,-7.78537,6.45365,2.67192,-0.518631,-0.579868,3.1551,-3.30298,0.42352,0.385421,1.09082,-3.38628 10238.6,10163.7,9281.72,0.163978,0.29531,1.39945,-1.88245,0.770367,3.01996,6.47156,0.843119,3.05229,-2.89342,3.69162,1.01002,0.156961,-1.63668,-1.88068,0.459627,0.572044,-3.8789,6.07964,1.73877,1.04155,-0.952277,-0.352698,-3.89818,-1.13337,1.63306,0.655322,-3.05775 10252.3,10168.8,9289.58,1.69242,0.803041,0.969081,-1.57571,10.1963,10.1486,9.01137,-0.23779,2.45598,-11.8335,0.764195,0.347471,0.63322,0.818036,-2.67947,-0.48707,-0.0121974,-5.92175,4.75178,1.31186,-0.59319,-0.865273,-2.13114,-0.629395,-0.22624,0.187864,0.687159,-1.38416 10258.4,10175.1,9296.44,0.693656,-1.47018,1.57507,-4.07861,13.9151,7.913,3.87705,-2.41045,1.40643,-18.8401,-3.38044,-3.78137,0.444306,-0.142111,-3.19856,-0.633983,1.26609,-6.96487,4.03731,1.86282,-0.255938,0.885239,0.576534,4.16798,1.48633,-2.91027,0.44246,-1.26861 10259.2,10179.7,9301.13,-1.11281,-2.9356,3.48279,-4.07376,14.5961,4.75668,2.95063,-2.50321,1.99968,-15.2573,-3.94817,-6.19421,0.994523,-0.409685,-3.36826,-1.30752,2.89435,-7.11783,2.3961,1.75016,-0.287404,0.839505,2.32354,3.16514,0.431073,-4.23834,0.224613,-1.13459 10258.9,10180.8,9303.2,-3.70956,-2.93593,3.76222,-6.98265,14.1006,4.36509,3.13521,0.524873,3.4745,-8.19672,-0.812591,-7.54285,2.87285,0.165482,-4.34303,-3.00502,3.10194,-11.8146,3.48326,1.87454,-2.39007,-1.71717,-0.0308325,-3.00344,-3.10099,-5.07511,0.999296,-0.291248 10259.7,10178.9,9302.61,-2.50722,-0.863499,1.6361,-7.29671,5.65875,7.35687,6.74534,2.86707,2.5541,-4.10002,1.92641,-4.21325,3.79643,1.11564,-2.85299,-3.384,0.718232,-13.5344,2.15514,-0.378278,-3.09826,-4.48668,-4.09564,-6.07121,-4.62941,-4.63714,1.35609,1.33932 10264.3,10176.2,9300.58,-1.50986,-0.476834,0.153861,-9.03392,2.34462,9.76008,11.2624,0.958254,-0.70443,-6.3101,0.886002,-3.04957,4.20237,0.687347,-2.59931,-4.30057,-0.344332,-15.3463,3.30618,0.212706,-1.83037,-5.39362,-6.37009,-5.79293,-5.6463,-5.17005,1.45394,1.2199 10270.2,10175.5,9299.06,-1.8193,-1.62584,1.49621,-15.2891,-0.19176,0.694336,7.97111,-0.906134,-1.88497,-6.47048,-0.900237,-3.70282,1.23614,0.322582,-3.93212,-3.45866,1.71962,-16.8955,0.58688,-0.409914,-0.259588,-2.68512,-3.64588,-3.35838,-4.51583,-4.19392,0.240148,0.159851 10270.2,10179.6,9298.63,-1.90388,-3.42457,3.36972,-15.5947,6.83754,-2.72512,7.96959,-1.26132,-2.35887,-7.13988,-3.00989,-4.84946,-1.32472,-2.90407,-7.21556,-3.99747,1.63284,-18.121,1.49353,-0.486008,-0.289734,-2.44221,-2.61409,-4.74746,-6.81336,-4.22186,-0.397997,-3.01155 10263.1,10186.3,9296.94,0.1046,-2.95923,0.55802,-3.53552,11.956,6.06043,20.0157,-0.175478,-1.81809,-1.77528,-2.10279,-0.283075,-3.48288,-4.09089,-6.41457,-3.4926,-1.98205,-11.2644,1.51324,-2.56718,2.01317,-3.17178,-3.03644,-4.28621,-6.82533,-2.57386,-0.732198,-4.52782 10250.3,10186.7,9289.82,0.787893,-2.63004,-4.83671,4.59987,9.90165,5.11396,20.1712,-1.49013,-0.900383,3.2704,-1.38302,1.01612,-3.51797,-3.65748,-2.01906,-2.31487,-4.58178,-0.663723,4.99631,0.0846666,6.20019,-1.32911,-0.366123,-0.708005,-3.05462,-1.4169,-1.33549,-4.03837 10229.6,10174.2,9276.51,2.92922,1.43172,-8.45959,7.92191,9.82817,0.906035,15.1761,-5.66535,-4.80598,8.92318,-1.50732,0.863702,-4.19618,-1.72605,1.43049,-1.60336,-7.78679,7.9456,2.20311,0.976306,4.6808,-2.0774,-1.41618,1.52784,-1.00485,0.251303,-2.51818,-3.24837 10203.9,10154.8,9263.01,1.97737,4.88419,1.86761,-1.89071,16.8831,21.8027,18.6752,-2.85592,-0.407409,1.1857,1.57668,2.90834,1.42619,5.01683,-2.88862,1.13125,-1.02838,-3.77013,-1.83294,-0.874118,-1.82318,-1.06152,0.617181,1.34269,3.38069,1.15764,1.12216,1.38647 10184.5,10141.2,9256.68,5.24597,7.64832,2.18557,1.58328,4.92602,9.28816,-0.0172234,-2.70209,-2.36954,2.63625,2.45988,6.65341,1.30855,2.45772,0.884071,4.15289,-0.306199,0.501745,-3.91598,-0.843063,-3.78083,-0.751671,-0.908618,-0.353576,1.46737,4.59599,1.10914,-1.05414 10178.9,10140.4,9258.57,8.5511,8.38576,-0.704081,10.0442,3.87995,9.53107,4.06474,-2.33977,-3.33414,3.45052,0.769206,8.44243,0.151836,-0.110094,2.50423,3.89258,-1.86971,4.86933,-2.34618,0.208276,-3.54318,-0.382483,-0.444637,3.17545,1.86638,6.31308,-0.0788599,-2.11239 10182.7,10148,9263.52,7.664,6.75263,-0.540997,5.42972,-5.04193,-7.98425,-8.29464,-0.166299,-0.588527,3.31557,0.500806,4.72146,-2.51571,-1.43305,5.52369,5.671,1.03703,8.03067,0.0463032,4.16527,0.993743,2.27,2.01907,5.48701,6.28587,6.50446,-0.915646,-0.555951 10185.6,10156.6,9266.64,4.26252,2.60407,3.65205,1.35764,1.93964,-1.71464,3.62386,0.664968,2.07164,-1.84774,-1.41728,2.03742,-1.93901,-0.955849,2.55509,2.24827,3.4143,2.08534,1.52467,4.36357,2.40504,-0.149419,1.87333,2.56701,3.76988,3.58853,-0.290298,1.53656 10182.8,10164.1,9266.99,3.44774,1.00051,3.58435,5.06036,-3.20427,-1.32409,2.16178,-1.24869,0.986594,2.68824,-3.10496,3.75494,-3.03899,-1.36189,2.85639,-0.797041,2.25309,6.84226,-1.01807,1.45026,1.64915,-1.77668,1.47461,1.32051,0.0174875,3.15498,-1.91103,0.915561 10177.6,10169.5,9265.47,2.97062,0.742454,2.19308,3.39405,-10.2555,-6.11354,-8.35604,-2.29312,-0.492631,4.2024,-2.46282,2.85236,-2.05854,-1.07623,3.34902,-1.67951,1.43015,9.72371,1.0556,1.2093,0.0329592,0.933345,2.62882,4.14907,1.43657,2.25242,-2.21302,0.424466 10175.1,10171.1,9262.53,2.78573,0.66686,2.0545,2.76769,-2.38316,1.38611,1.33538,-1.98843,-1.22362,0.719734,-1.48276,0.571928,-0.303568,1.13172,0.533248,-2.57485,0.218063,4.75694,4.12677,1.25451,-2.29974,1.77459,2.18864,5.66448,2.31972,-0.197648,-0.423422,1.24127 10176.1,10170.7,9258.49,5.31438,0.737423,2.23937,7.15555,-6.03862,-6.93885,2.59027,-2.08985,-1.82474,1.76361,-1.51506,2.40133,-2.94977,1.13326,2.34185,-1.4691,-0.319475,6.55378,0.151184,-0.820336,-1.03183,0.737373,1.0173,1.60097,0.120988,0.706961,-1.06361,1.61191 10177.1,10171.1,9253.43,5.27989,0.124242,0.594136,6.40228,-14.4792,-17.9873,-7.83873,-2.70593,-2.84279,6.19952,-1.02819,4.22035,-3.89328,-0.655654,4.6427,-0.543649,-0.312946,7.67303,-3.34568,-2.99026,0.892734,0.193866,0.437901,-1.37172,-2.06494,3.10779,-2.09072,0.969194 10175,10171.9,9247.28,2.27598,-1.11333,-0.371999,2.70022,-5.44405,-1.24932,2.95574,-2.54561,-3.07604,2.81372,-0.48024,4.11824,2.04907,-0.370621,1.24343,-2.71039,-1.27809,-0.906837,-1.29061,-4.80376,-0.177684,-0.68347,-0.0356975,0.976652,-2.58184,2.60538,-0.53245,1.0079 10170.6,10171.1,9240.98,0.484599,0.0646839,-1.51326,2.89899,-3.4319,-0.213982,2.47953,-0.834731,-2.00581,5.72898,0.227883,2.67222,2.27602,0.0505934,1.31844,-2.26552,-2.6972,-0.975391,-0.869576,-3.70984,-1.26158,-0.292123,-0.590846,2.58737,-1.84822,1.62378,-0.526111,-0.491878 10166.9,10167.6,9236.09,0.964725,-0.0392702,-0.079079,4.19696,-8.77705,-7.3393,-5.33084,1.7816,1.00552,6.00308,-0.645333,1.80016,-0.345783,0.537513,3.29513,-0.258503,-1.94323,3.02276,-2.07851,-0.708951,-0.985472,0.42465,-0.0047685,-0.0149723,-1.37113,0.550535,-0.779034,-0.484969 10166.1,10161.5,9233.6,-0.598547,-1.76595,-1.06041,-0.952044,-3.22733,-6.25839,-1.71002,3.5389,3.14678,2.52469,-0.94774,-0.697306,-1.82073,1.8162,-0.398189,-0.0962201,-1.17773,-3.11075,-1.86249,-0.148137,-0.912351,0.0729367,0.372787,-1.52491,-1.99794,-1.67208,0.753712,1.02245 10167.9,10154.5,9233.85,1.32924,-0.579085,-4.09528,3.27081,-6.78357,-9.38603,-3.06915,1.95927,0.70163,2.46784,-0.635142,0.854662,-1.03664,2.44479,0.381434,0.976493,-2.1874,1.35415,-3.25712,-1.85514,0.202589,0.286026,0.720155,0.627719,-0.687001,-0.872865,1.21871,2.25385 10170.4,10147.3,9236.23,1.55419,0.655793,-3.90119,3.65032,-6.92144,-3.81534,-0.829364,1.59907,-0.150104,0.588015,0.212751,1.04803,3.09472,3.79829,-0.218751,1.11779,-1.55055,0.933332,-1.25266,-2.59487,0.647035,1.39731,2.58953,2.8589,1.80309,-1.43261,2.52993,2.79953 10171.9,10139.7,9239.22,2.16966,0.513128,-2.93705,2.73804,-10.8601,-4.50483,3.76187,1.03924,-0.676839,-1.4866,-1.19577,1.6866,5.98311,3.12642,0.0885709,0.9896,-0.594518,0.533618,0.379411,-3.82145,2.32664,2.22298,3.60721,3.05218,2.2889,-1.98702,2.79897,1.35025 10172.4,10133.5,9242.05,0.627291,0.905709,1.39363,2.99372,-15.425,-9.09382,2.11414,1.04226,2.10526,-4.39506,-2.77953,2.15891,6.66724,1.70369,-0.372333,1.40462,2.59187,2.26874,-0.378224,-3.69675,3.0335,2.25396,3.10192,0.0429504,0.10951,-0.799702,2.66794,-0.282681 10173.8,10130.2,9245.36,-1.33644,1.42161,3.11004,3.93858,-17.0646,-12.116,1.67239,1.94826,5.54306,-3.85205,-1.5475,2.52019,4.33814,1.15019,-0.541069,1.99129,3.05378,4.25369,-2.76731,-2.80645,1.85733,0.988299,2.88783,-1.97077,-2.83768,1.85125,2.84766,0.389147 10176.4,10130.9,9250,-3.53503,0.391503,-0.270572,1.95882,-15.1875,-18.5758,-1.42497,2.28845,5.40786,-2.12974,1.20821,0.911564,0.2788,0.0689856,-0.00271805,2.01928,-0.20812,3.23848,-1.98612,0.0245125,0.488358,-1.18054,1.47019,-3.47437,-4.6287,2.11498,2.20934,0.993318 10178.8,10135.9,9255.56,-3.20255,-0.268054,-3.48033,2.47099,-11.3536,-16.9308,2.01776,1.40976,1.56328,0.853625,1.89586,1.47109,-1.50849,0.167668,0.627511,1.41809,-4.21425,2.05546,-2.39209,-0.416193,0.276633,-1.50971,-0.820011,-1.25927,-1.76,0.153711,0.431209,1.48315 10181.2,10144.1,9260.31,-2.49125,-0.613263,-3.86482,0.287362,-9.17309,-14.1157,3.48478,0.196793,-1.25386,2.83848,0.198147,-0.0165582,0.471677,-0.139327,-0.216901,-0.966032,-5.2193,-1.40546,-0.977273,-1.2574,1.78779,0.134179,-1.72164,0.653388,0.313432,-3.37716,-0.587605,0.861387 10186.6,10151.1,9263.12,-0.0358474,0.714951,-5.47328,-0.875177,-17.5089,-13.8361,0.471247,0.643912,-2.41975,9.9458,0.993041,0.803296,-0.226386,0.0668295,2.19176,-1.16819,-4.40868,0.69383,-3.38706,-3.58218,3.07732,2.10253,1.79789,2.06744,1.83904,-2.15516,-1.67344,0.661882 10193.4,10152.2,9264.85,-2.78688,1.85556,-1.96216,-7.27433,-5.61022,0.625161,3.91544,2.78407,0.13042,8.01854,3.573,-2.43853,-1.07905,0.148792,-1.48277,-2.3792,0.378784,-7.05144,-1.06108,-1.76148,0.135824,1.71393,3.80312,-1.43656,0.702495,-1.95731,-0.703674,-0.33177 10196.9,10148.7,9267.46,1.41437,4.41491,0.0330121,-0.96198,-19.7539,-11.561,-5.49424,1.03618,-0.588315,13.1158,4.11913,1.82776,-4.02743,-1.24038,4.49417,2.16391,1.61464,5.33203,-6.2827,-3.22771,2.42673,4.53812,5.27571,1.95384,4.83592,2.15944,-2.23414,-0.0179182 10195.1,10146.6,9271.67,-0.599083,4.08109,5.56207,-0.651956,-1.899,4.41751,8.64946,-0.00765143,1.65381,7.40697,3.13743,0.528221,-1.17274,-0.333192,-1.34405,0.810869,3.04978,-1.96585,-3.00608,-1.02587,-0.427114,2.63482,2.33223,1.44749,2.70602,-0.508442,-0.782524,0.838544 10190.6,10149.1,9275.95,0.560997,3.32623,0.00253245,1.6273,-9.62681,-9.32197,-7.13248,-1.74244,-2.26773,10.279,2.01853,1.79006,-2.32577,-1.861,2.70102,2.63733,-0.668516,4.89049,-2.56801,1.67809,-0.682542,1.07859,-0.730879,1.04436,0.219305,1.04839,-1.30085,-0.204558 10188,10153.1,9277.72,-1.05102,1.4439,-1.2902,0.37219,3.61058,7.8905,-0.13638,-0.797121,-3.203,3.7144,-0.467361,1.43319,1.01941,-0.964803,1.27849,1.32106,-0.71757,-0.281666,1.82319,4.43107,-2.93419,-0.102775,-2.79816,1.60946,-0.350934,0.837113,0.975085,-0.206216 10189.3,10155.8,9275.17,1.71247,1.79065,-0.806826,4.2591,-1.07113,5.08033,-3.80833,-1.05846,-3.93516,4.86697,-2.48519,4.41458,1.0147,-2.04319,5.76698,3.04901,0.621182,6.18537,-0.471514,3.74338,0.0954557,1.78055,-2.23478,4.29533,3.28968,4.08665,-0.45381,-1.12752 10190.8,10155.9,9267.91,0.0885688,1.62773,3.97676,0.475719,6.50171,12.0036,4.17355,0.0800788,0.877184,4.13283,-1.66529,2.3731,1.22312,-1.52431,1.32333,1.30085,4.02821,0.00402446,-0.278254,3.83144,-0.00616006,1.70507,0.14686,2.05675,3.75234,3.42709,-1.13997,-2.28219 10186.5,10152.6,9257.34,-0.152071,1.1051,2.98089,-3.26014,-3.23874,0.545145,-3.74253,0.650653,4.32612,4.55661,-0.349067,0.443991,-1.54712,-2.37082,1.08068,1.11666,3.19332,0.114235,-4.77887,1.03262,0.526047,1.57427,1.96416,-1.21359,2.2522,2.81775,-2.19914,-3.20958 10175.9,10146,9246.33,-2.37365,-0.801223,1.8448,-4.49245,2.73452,3.45587,0.665856,0.804743,7.15539,-1.25789,-1.25952,-2.70716,-1.07845,-2.04441,-1.93328,-1.35806,1.5978,-5.1161,-5.79834,-0.925826,-2.80177,-1.15512,-1.39234,-4.88988,-2.71874,-0.727928,-1.17586,-2.55528 10163.6,10137.3,9237.87,-0.803469,-2.78044,-0.895544,-1.96323,-0.541223,-3.95959,-1.23923,0.0489646,5.82687,-0.842944,-2.20839,-1.37161,-0.868195,-0.366623,-0.326653,-0.542204,-0.442138,-3.06811,-5.05951,-1.77693,-2.56412,-2.0747,-5.18551,-5.90628,-3.59607,-1.51359,-1.0358,-0.0442413 10154.4,10129.1,9233.99,1.23915,-3.76005,-2.64612,0.723829,-3.148,-4.96491,0.57486,-0.202117,2.21428,-0.386009,-2.61213,0.591537,-0.420445,2.51457,0.848114,0.0155665,-2.8099,-0.688955,-1.65728,-1.68576,-0.314736,-2.37588,-7.30164,-5.93878,-1.09582,-1.08092,-1.23666,3.04974 10147.7,10124.3,9234.84,0.130569,-3.33534,-5.30783,0.228073,-1.79103,-2.90284,1.72325,0.336059,-1.67646,0.805152,-2.51359,-1.68843,-1.08056,2.79024,0.667811,-0.918425,-5.25023,-0.613583,-1.21144,-3.86108,1.12026,-2.87087,-6.96217,-3.74878,-0.871173,-1.99148,-1.4983,3.13726 10141.9,10125,9238.34,-2.3342,-3.74514,-6.28736,0.247636,2.71253,3.12847,7.57994,-0.0401623,-2.07147,0.481455,-3.97685,-4.46362,-0.415913,1.42821,-0.575486,-2.68041,-4.57327,-2.24353,-2.60028,-5.84863,0.625916,-3.42977,-3.6369,-0.844099,-3.5874,-4.64335,-0.985747,1.2717 10139.9,10130.2,9242.19,-1.31024,-4.72475,-7.14762,0.73153,1.45053,-5.53508,5.90136,-2.31863,0.194991,0.488804,-6.97821,-4.41928,-2.29074,-1.35009,0.919216,-2.89533,-3.25509,-0.799203,-1.99553,-4.14064,2.04707,-1.98553,-0.137078,-0.0166083,-4.9352,-5.40326,-1.67739,-1.42035 10146.2,10135.6,9246.04,1.48702,-3.36982,-6.22071,1.74719,2.56435,-13.0074,1.99705,-3.21561,2.91416,0.844878,-6.7988,-2.16439,-5.4962,-1.85975,2.13575,-1.59383,-2.91884,1.52462,-1.3314,-1.85117,3.6544,-0.430522,0.692754,-0.840642,-3.31251,-2.33908,-3.05762,-2.1983 10158.1,10136.1,9250.8,0.841737,-2.49661,-1.39476,-1.47649,15.6927,0.965199,10.869,-0.546861,4.02682,-3.15137,-2.65822,-1.05518,-4.77058,0.229656,-2.58261,-1.60934,-0.689737,-5.44364,-0.234473,-1.95479,2.60062,-0.769404,0.484685,-2.21476,-2.21659,-0.527818,-2.3356,-0.631119 10167.2,10131.4,9256.17,1.43756,-1.64599,0.0828565,1.10643,1.09851,-8.71597,-1.14743,1.16785,1.24835,1.69522,0.678389,1.91657,-5.73395,-1.26925,0.618759,0.671225,0.99422,2.5392,-3.14056,-3.00047,3.39733,-0.267724,0.865602,-1.72338,-1.28093,1.59131,-3.58079,-1.60917 10168.5,10125.9,9259.95,0.111755,-1.49369,1.18289,-0.284048,-1.52165,-7.82514,1.91577,2.83987,1.30957,4.34859,2.31828,0.547347,-5.35341,-2.95714,0.120479,-0.07344,1.25038,0.863374,-1.97606,-2.63292,2.99367,-1.51317,-0.192761,-1.94301,-2.34527,-0.816782,-4.15688,-3.69083 10164.7,10123.5,9260.03,2.54631,0.123647,1.85441,0.291179,-2.26534,-5.622,0.403256,2.75151,1.92159,5.45502,4.02912,0.277333,-3.49437,-2.59529,1.68451,1.03176,0.611114,1.05444,-1.37086,-0.762577,2.09659,-3.15435,-1.66892,-4.18628,-2.03484,-0.59484,-4.5361,-4.06338 10160.7,10123.9,9256.02,4.16394,1.15842,1.00215,-1.41089,3.00077,3.69915,2.12147,1.50602,1.11373,3.7783,5.12886,1.27055,-1.0735,0.163066,0.715848,1.75274,0.248762,-1.87449,-2.70607,-0.0821427,-0.982237,-3.91753,-0.603176,-5.15131,-1.55797,1.9122,-2.63806,-2.45448 10157.6,10124.8,9249.1,1.13904,0.752742,1.28292,-3.44794,5.87463,13.5955,-3.90547,0.053564,0.392376,-2.17549,4.02652,0.800942,2.14933,0.991305,-1.00534,1.93346,1.74799,-4.3887,-2.62983,2.12002,-3.97726,-2.37985,1.92724,-3.91126,-1.80145,3.29901,0.515867,-2.07875 10155.9,10125.9,9241.01,-1.21278,1.24353,0.0902419,-1.38693,3.90257,17.0687,-1.7671,-0.621263,-0.743581,-3.56603,3.19768,0.515647,2.83626,-0.394058,-0.965446,2.53295,1.02968,-3.73706,-0.646373,4.19926,-3.90665,0.100245,2.07717,0.65145,-0.4389,3.45695,1.30478,-2.26372 10156.9,10129,9233.19,-0.519545,3.45514,-0.128203,0.470911,-4.34917,11.6069,-5.37302,-0.249794,0.0908138,-1.64961,3.7305,0.887725,1.28233,-0.50548,0.651175,4.68216,0.481759,0.131141,2.83721,7.4517,-1.51906,2.02591,0.478488,2.8447,3.96564,4.21205,0.0189546,-1.26083 10160.2,10134.9,9226.61,0.334619,3.63902,-1.33005,0.500933,-0.0390483,15.3466,3.49804,-1.22599,-0.443012,-1.29729,1.85728,0.83413,0.663791,1.08815,-1.61332,2.35978,-1.91003,-1.54128,7.06018,8.52392,-0.0931056,-0.631766,-1.8937,1.21041,3.92464,3.0125,0.582016,-0.0552563 10165.1,10142,9222.12,-0.0501124,2.72845,-2.35233,0.461804,-3.24106,3.89637,-4.4752,-1.7395,-0.658087,1.46568,0.74815,1.9358,-1.37579,1.26993,0.248403,2.1501,-1.97865,2.84403,4.93078,6.34449,2.55208,-1.66616,-1.28941,-0.85475,2.44335,3.28626,0.575625,0.0867697 10169,10147.2,9219.92,-2.57524,1.55278,1.64717,-0.408592,2.78686,3.93608,-3.35557,-1.05071,0.358949,-1.71793,1.23509,0.730307,-0.807758,0.469476,-0.799756,2.26666,1.42763,2.57756,3.31921,4.24278,2.32673,-1.92157,-0.625841,-1.7385,0.55312,2.469,0.416022,0.102824 10167.7,10149.8,9219.39,-2.61236,0.265041,4.14099,-1.10443,5.68968,5.75872,0.437178,-1.27371,-1.44794,-5.50529,0.962099,-1.7594,-0.014506,-1.47838,-2.10998,2.88166,2.32266,2.31558,3.04189,2.76494,1.13588,-2.76241,-2.5749,-1.37983,-0.132212,1.62609,0.00182996,-0.567092 10161.2,10151.5,9219.88,-1.00231,0.225002,2.94421,2.03312,-0.355979,4.16591,-0.636307,-0.980578,-3.17075,-4.4683,-0.0413473,-0.96548,-0.194949,-0.798368,-1.08568,3.94015,1.20872,6.21739,0.493017,0.663456,-1.20346,-2.76074,-4.99576,-0.484664,1.27829,1.87168,-0.0347963,-0.649195 10155.5,10153.9,9220.83,-0.939771,0.647249,0.0634509,3.2582,-1.62031,4.0693,-0.997477,-0.169163,-4.01209,-4.20755,-1.14083,-0.040949,0.676499,1.0769,-0.637069,2.85891,0.53402,4.18699,0.666861,0.369829,-2.63692,-0.336214,-3.73798,1.47577,2.81105,-0.292838,0.0270106,-0.151526 10154.1,10157.5,9221.67,-1.65802,1.59847,-3.57612,1.52401,6.37221,4.48866,-1.46299,-0.915699,-6.98915,-0.340048,-0.952717,-2.18866,-0.811792,-0.642645,-0.622625,-0.300884,-1.00057,-1.15759,2.44751,2.6773,-1.823,1.29837,-1.91591,2.49204,1.93197,-3.59974,-1.91245,-2.4109 10154.4,10160.7,9221.98,-0.583463,-0.108757,-4.6507,-0.0693877,5.35637,4.425,-6.56889,-1.82597,-8.57191,2.85503,-1.05825,-2.33955,-3.22781,-4.76081,2.05753,-0.861931,-1.83229,-0.124382,0.503483,2.18131,1.30665,2.42826,0.824233,3.84653,2.09007,-3.3925,-4.31649,-3.96112 10153.4,10159.2,9221.68,-2.76485,-4.09131,-2.87698,-1.10712,12.5336,12.9839,-4.34652,-1.87041,-6.50663,-1.43881,-2.78497,-4.09349,-3.27711,-7.58611,-0.918956,-2.43732,-1.68029,-2.93885,1.37614,1.00354,-0.202025,0.252735,-1.35224,2.14941,-1.22668,-3.85694,-3.91196,-5.39514 10153.1,10150.6,9221.82,-3.95579,-6.11602,-1.95691,-0.571033,7.36799,2.23424,-8.23593,-1.15065,-2.89936,-3.34966,-3.42278,-4.92737,-4.22729,-7.57776,-1.53936,-2.4826,-0.485854,-2.05301,1.35048,0.235875,-0.851581,0.299046,-3.65228,0.452501,-2.53126,-4.14097,-3.0318,-6.032 10156.5,10138.1,9224.22,-1.72219,-4.81284,-2.04034,3.64429,-3.40667,-8.21149,-2.06758,-0.247629,0.240041,0.844032,-2.55693,-2.29071,-5.62686,-4.10255,0.955484,-2.58578,-0.573095,1.96046,-2.89531,-2.47853,1.00662,1.59082,-2.31097,1.60096,-0.355857,-3.59741,-2.54995,-3.16362 10162.5,10126.5,9229.66,-1.48624,-2.31864,-1.19917,5.07688,-2.15075,-4.48733,6.81643,1.19375,3.4529,3.66948,-1.49639,-1.71619,-5.51437,-1.29231,-0.407537,-4.604,-2.54282,0.0824236,-5.27449,-4.81883,0.767691,-1.39492,-2.55861,-0.325428,-1.75464,-3.59903,-1.89829,-0.732932 10167.7,10118.7,9237.56,-1.06333,-0.880843,-0.709075,2.8371,-10.0447,-10.4348,-2.5904,3.18465,5.97115,6.33779,-0.55058,-1.01646,-4.14332,-1.6247,-0.0193591,-4.01402,-3.73144,0.38443,-5.50468,-6.41294,-0.295721,-3.62009,-2.70822,-3.1355,-4.45086,-2.10376,-1.79258,-1.22716 10172.5,10116.9,9247.18,1.551,0.130326,-0.490568,5.87654,-14.5436,-8.35183,-0.790109,3.39107,4.7174,8.28156,-0.0057788,2.6686,-1.84943,-1.48071,1.03911,-4.0934,-3.48936,2.7605,-6.22541,-8.72046,-2.487,-3.9855,-3.15508,-4.85806,-6.30628,-0.1826,-2.22861,-1.91313 10179.7,10122.6,9257.78,1.5355,1.00586,-2.46594,5.55739,-10.6179,-9.89219,1.01847,2.02002,1.55047,10.3651,1.59035,2.3257,-3.02423,-0.681756,0.379055,-4.13859,-2.86252,2.65539,-7.09955,-8.4785,-1.80811,-2.44766,-3.84586,-6.08215,-4.18234,0.309597,-3.66089,-1.78168 10188.9,10134.4,9267.84,0.423127,-1.44673,-6.16369,2.54558,-3.2605,-10.2788,1.93481,-0.460125,-1.55478,7.53447,1.04311,-2.037,-5.33297,-0.715827,-0.912315,-4.00679,-5.27357,1.32517,-7.02947,-5.6844,2.49,-1.1701,-4.14164,-4.46692,0.160721,-1.23591,-5.46575,-0.678645 10196.3,10145.5,9275.21,0.204833,-4.851,-9.24744,3.38063,-3.90706,-1.89916,-0.318999,-3.05687,-4.83175,3.88926,-1.68472,-4.52857,-6.76493,0.053409,0.356074,-2.44354,-9.25902,3.95243,-8.99635,-3.68403,4.07743,-1.41439,-4.06526,0.784286,2.50666,-1.59161,-6.31937,0.0761621 10200.4,10148.5,9278.92,-3.06966,-5.752,-6.27773,-0.452092,4.18213,13.2473,-12.0757,-4.47092,-6.49884,-5.96616,-4.08975,-9.08064,-3.65565,-1.03612,-1.9757,-2.79369,-8.22081,-3.13926,-2.68074,1.98539,-1.47914,-4.27865,-6.82097,-0.0420558,-2.72616,-3.80964,-3.69263,-2.81706 10202.3,10144.3,9279.66,1.7621,-1.2767,-1.87182,1.61337,-6.80859,14.4514,-16.815,-2.07514,-4.63562,0.0307544,-1.49074,-2.29138,-1.18636,-1.08621,1.86862,0.689509,-4.2555,-0.913166,-4.04706,-1.13903,-2.95495,-1.4359,-3.45987,4.36607,0.619825,-1.53464,-2.06409,-2.58631 10201.6,10141.5,9277.89,2.73427,2.11183,3.79277,1.71546,-5.8859,13.3557,-11.3022,2.79327,2.37116,13.2011,3.98285,0.966107,0.039656,-0.715821,2.85166,2.34242,2.77476,-0.0888099,-4.98538,-3.4432,-1.83877,3.57211,2.68075,7.05565,6.45616,-1.54302,-1.24469,-1.49869 10196,10143.8,9273.55,-2.52737,0.202188,7.08167,-4.89952,6.71679,10.6699,0.756855,5.54471,7.25909,13.9583,6.39787,-2.37566,0.745793,-1.45474,-1.09404,0.910205,7.21143,-6.92492,-3.24203,-2.89701,-0.543452,6.07649,7.33376,6.57894,6.15484,-4.40884,0.0587056,-1.11052 10186.2,10147.8,9267.63,-4.31786,0.145523,8.74123,-1.12372,3.61382,5.90919,-2.20636,4.87121,7.93339,10.8223,5.77747,-1.02016,1.70524,-1.23974,-1.99873,1.22043,7.18349,-2.02393,-4.52471,-1.19367,-1.87015,5.60664,6.92162,5.30532,3.03549,-3.16865,1.33872,-1.3693 10178.3,10151.3,9262.07,-1.01371,-0.36759,7.07326,3.03463,-3.67644,6.41668,1.01659,3.32806,5.69645,6.11989,4.17302,3.13986,4.40199,0.31144,-2.58094,-0.0539033,4.16067,1.49299,-3.2753,-1.39228,-2.172,3.33149,4.19598,3.46064,0.616277,-0.818505,3.98959,0.698301 10177.2,10154.3,9257.94,2.09186,0.0766925,2.17884,5.08344,-13.9717,-0.882929,-3.84368,2.86526,4.57806,7.77504,4.75117,6.29349,4.58116,4.04706,1.06485,0.914494,1.84175,7.12093,-3.92066,-3.04038,-1.76589,1.29071,2.74094,1.46176,1.98937,3.12251,5.09485,3.84087 10179.4,10155.4,9254.74,0.187596,-0.882072,-0.665652,4.15319,-3.56212,6.25634,3.46947,2.99756,3.30879,0.859046,5.1349,3.91232,5.90056,6.60019,0.839946,-0.162343,-0.484405,2.65509,-1.8674,-3.50916,-5.10299,-1.60522,1.28388,-0.0295086,1.05,2.81748,5.21994,5.53563 10178.8,10153.1,9251.26,-1.91139,-0.154839,-0.832651,7.32065,-8.14661,3.20829,-4.61065,3.9011,1.20806,1.29028,6.11631,4.24084,4.66918,7.38927,3.1094,1.72009,-0.436683,6.06925,-3.83738,-3.64103,-8.35166,-0.222316,1.74303,3.43329,2.82215,3.91599,3.2218,6.05878 10175,10149.2,9246.46,-3.00223,-0.829219,2.18951,8.12634,-8.29635,3.98254,-2.55022,3.58933,0.0476173,2.00734,2.85452,5.13863,4.39434,5.86178,1.57419,0.321093,2.11151,4.62819,-0.677836,-1.98205,-7.44972,1.36379,2.52895,5.12261,2.10196,3.15929,2.77152,6.16477 10170.8,10147.7,9240.32,-2.09934,-1.33891,3.77143,6.49402,-6.43302,-0.0826344,0.87837,1.12061,0.421557,1.06025,-1.52903,5.64507,3.68263,3.49536,1.25096,-1.4957,2.92854,4.60413,2.40658,-0.645265,-3.32217,0.987715,2.60908,1.94117,-0.424246,2.85508,2.71473,4.88469 10167.3,10148.7,9234.04,-1.71112,-2.89318,3.67043,1.66277,3.35424,4.57631,10.1924,-0.35173,1.35064,-5.80931,-1.82085,3.64176,4.57117,2.2882,0.924739,-2.41648,2.22467,2.19365,5.80375,-0.426137,-2.32705,-0.919332,2.09081,-2.34116,-2.25007,1.71251,3.40172,3.5108 10165.7,10149.1,9229.23,-1.45001,-3.05548,2.45599,-0.349391,3.71978,4.53119,5.144,-0.0754888,2.20722,-6.90377,0.948441,2.13514,3.08117,1.83942,2.86791,-0.010419,2.66035,5.23219,5.6626,-0.804354,-2.37724,-1.67323,0.673861,-3.53649,-1.59081,1.76997,2.75549,2.29186 10167.4,10147.1,9226.8,-1.49928,-2.70714,1.88393,-0.842721,-0.225431,3.25531,1.41947,0.140255,3.21042,-3.88608,1.41104,1.86088,-0.091131,0.642157,1.94581,0.307133,3.18746,6.22574,4.30938,-1.01513,-1.1936,-1.8575,-0.588364,-1.42784,-2.08205,1.85519,1.46316,1.06047 10171.1,10143.9,9226.48,-2.01672,-2.40053,3.06391,-0.0599903,-8.34303,2.94718,-5.04409,-0.199276,4.0892,-3.68083,-0.226057,2.75547,-0.686676,-0.843757,0.670264,-0.458086,3.08212,7.11729,2.84836,0.933537,-1.50789,-1.59001,0.179663,0.0589795,-2.55704,3.42709,0.775783,0.360096 10175,10140.6,9227.89,-1.34782,-2.60865,2.14445,1.39294,-10.3608,4.5868,-8.2559,-1.78039,0.356678,-10.0047,-3.28868,2.87133,1.85333,-3.67234,1.53223,-1.27653,0.113475,6.97877,4.49731,3.38158,-3.24882,-2.09817,-0.213742,-0.816136,-3.92766,4.36792,1.46638,-0.25462 10179,10139.5,9231.01,-0.683001,-1.14693,0.835389,1.45465,-4.93888,6.92044,-3.2459,-1.76518,-2.11784,-11.5638,-3.99539,3.25477,2.97649,-3.54233,2.62301,-0.286071,-1.99677,5.44349,5.35012,2.55683,-3.04093,-1.82791,-1.42661,0.583625,-2.6178,3.43693,2.29735,-0.308687 10185.5,10142.2,9235.77,-0.0852919,0.0218383,0.522022,1.091,-4.00515,-0.71681,-2.72016,-1.24891,-1.4593,-5.53454,-2.81228,2.98724,1.40275,-1.35994,4.37674,1.00841,-2.02092,6.34309,4.01241,0.223476,0.719167,-0.617158,-1.79277,2.19906,-0.00915837,1.60933,1.1106,-0.276707 10194.7,10147.7,9242.28,-0.507821,-1.45713,1.82236,1.06383,0.990703,1.16431,3.40878,-1.35424,0.436421,-3.7364,-2.82733,0.844561,2.18188,1.42103,2.14788,-1.48658,-0.956157,3.31294,2.03859,-1.09837,2.11718,-0.147919,0.113767,0.665977,1.0134,-0.758268,0.662046,1.48327 10202.3,10153,9250.68,-0.953894,-1.28733,1.09826,0.183582,-2.63676,-4.1377,-2.89907,-0.851983,3.07691,-0.452803,-2.18838,0.00930997,2.87142,4.0314,0.911046,-1.55443,1.18147,4.24956,-2.48362,-1.23019,1.72571,2.11001,5.29268,-0.281886,3.31927,-0.100871,1.85826,4.09941 10205.4,10156.4,9259.89,-1.27754,0.134823,0.181405,0.430733,3.94306,1.54036,2.99815,-1.16285,4.70226,-4.24342,-1.81256,1.00154,4.93307,6.24027,-1.59843,-1.48742,2.34844,2.10305,-2.00905,-0.662325,0.626241,1.17997,6.74123,-1.67701,1.35772,0.491316,4.32271,6.53414 10204.9,10157.9,9267.94,0.0906612,2.16352,-0.379486,5.42194,2.73054,2.84047,-1.4914,-1.83181,4.02307,-5.15449,-0.262248,3.79351,5.21678,7.80905,0.384689,1.27337,2.9796,6.90988,1.28339,2.20996,-0.91791,-0.163496,3.78903,-1.75168,-0.655347,2.9127,4.88667,7.66747 10203.5,10159,9273.39,2.81598,1.22437,-0.368556,7.79675,3.42922,7.94279,4.57077,-0.708312,0.0968463,-6.10539,0.906129,5.55489,5.11842,8.21484,-0.0671665,1.22889,2.37144,6.24544,4.97372,3.9233,-2.49967,0.267274,-0.310124,1.09266,-0.410233,4.04567,4.74621,8.0612 10203.2,10162.2,9275.77,5.91857,0.355765,0.897437,11.4606,-3.5509,6.21936,2.57301,-0.0103725,-3.12789,-4.93913,0.601331,6.94209,5.77388,6.93334,1.15761,0.716978,2.28439,10.4648,4.58557,4.39511,-2.76356,2.73426,-1.51427,4.03252,2.99548,5.47757,3.66414,6.66569 10203.5,10167.2,9275.21,3.60261,-0.370029,0.212296,6.53742,-1.17501,1.39057,4.60494,-1.59955,-3.36286,-6.83681,-0.619753,2.05525,7.21718,4.0699,-0.311278,-1.80144,1.07578,6.02142,4.81799,3.05296,-1.94492,1.84126,-1.66326,1.40391,1.77364,2.95825,3.1993,3.61198 10203.2,10169.7,9272.52,1.94895,1.27875,-0.411546,7.45768,-3.75161,0.551798,7.13428,-3.82068,-2.61405,-4.51085,-0.839975,-0.654388,7.59238,3.63367,1.11679,-0.895324,0.0589114,6.72608,0.605615,-0.28023,-1.84675,-0.134175,-0.468956,-1.06577,2.10307,1.19208,2.14254,2.35948 10201,10166,9269.14,-0.454618,0.774031,2.06017,2.8462,-0.622985,0.18548,5.53147,-2.50822,-2.46147,-4.96779,0.0109421,-5.95039,4.88549,1.45711,-1.36876,0.21175,1.58667,0.959389,-1.72767,-0.999701,-1.91612,-0.271218,-0.271307,-3.60937,2.2528,-2.81471,1.29832,0.342989 10196.9,10158.5,9266.51,1.16537,-1.9421,4.60098,6.66208,-8.91079,-4.05041,0.977918,-0.375912,-2.52562,-2.44083,-1.83608,-5.04574,0.870179,-2.88837,0.903319,2.45464,2.77487,7.13809,-7.32993,-2.29902,0.410437,1.61472,1.76486,-2.68616,2.88565,-3.79142,-0.830458,-1.20118 10194.1,10152.5,9265.18,-4.11534,-5.864,4.81522,5.05616,0.145339,-4.93641,2.59855,0.656712,1.10696,-4.83177,-6.68192,-7.2593,-1.01756,-6.50992,-0.623669,0.165413,3.83811,5.84041,-5.84841,-0.103661,1.98729,0.416145,1.34348,-6.16515,-2.67871,-5.57128,-1.65554,-3.26762 10194.1,10148.4,9264.07,-6.59722,-4.92656,-2.01588,3.7417,0.726794,-18.2936,5.15057,-0.276157,1.50739,-0.538248,-8.52874,-4.00362,-4.55022,-5.27015,0.604573,-0.930054,-0.109161,8.19838,-8.17669,-2.1092,4.17484,-1.56197,-1.02102,-5.8341,-5.50376,-1.7134,-2.50895,-3.06608 10193.9,10142,9261.25,-7.62788,-2.98611,1.9356,-1.40885,17.3716,4.06957,22.1809,1.39972,5.64224,-7.94302,-5.59134,-1.45901,0.439725,1.11211,-6.73411,-3.11746,1.4598,-4.78344,-2.09513,-0.404037,0.473396,-4.22587,-2.43839,-5.70551,-5.26427,-0.515338,1.20082,0.113119 10190.4,10132.9,9256.55,-0.061965,0.47587,-3.01478,1.28661,-2.15014,-14.2047,7.89898,0.463674,0.911903,2.0883,-1.64338,3.11185,-2.21723,0.781415,-1.37312,0.396228,-1.38267,3.09944,-1.8496,-1.29836,2.6087,-3.15966,-2.03297,-3.33185,-3.23065,2.92606,0.328003,-0.0324179 10185,10126,9252.36,-0.460313,1.71643,-3.7396,-2.47922,-1.49725,-15.3645,-1.80975,0.715758,-0.981069,-0.691494,-0.794101,-0.106849,-2.08179,-0.30971,-1.53311,0.428815,-0.320026,-0.221114,2.28648,0.175576,3.04606,-1.33911,-0.290353,-5.37868,-3.63253,0.919151,0.306196,-0.421839 10178.6,10124.8,9251.04,-1.00256,1.33259,-4.2472,-1.03971,2.95821,-4.55752,1.84476,0.117356,-4.36831,-4.27268,-1.02576,-0.886254,0.661063,-0.0446314,-0.718596,-0.508343,-2.00182,-0.337999,2.57329,-0.613947,2.18595,0.685998,2.2221,-1.4549,-2.89677,-0.0111036,1.2411,0.83044 10170.8,10127.6,9252.97,-1.71108,0.0714348,-2.91875,-0.0818013,10.0027,5.28964,4.84662,0.115636,-5.97389,-2.97492,0.466922,-1.16018,3.14319,-0.484977,-0.73996,-1.40938,-2.86898,-1.18229,2.85098,1.59393,-0.709864,0.769892,0.0526875,0.667581,-4.09633,-0.130706,2.87503,0.28772 10163.4,10130.8,9256.69,-0.0482655,-0.561906,-4.41924,-1.93638,1.00001,-3.80859,-6.74655,-0.693966,-6.90741,3.83606,-0.443929,0.133173,1.32042,-4.12952,2.21239,-0.401666,-2.83084,1.48444,3.60821,4.7162,0.0479322,1.57325,-2.9423,0.781086,-3.57562,1.01359,1.5974,-1.03302 10159.1,10132.9,9259.9,0.830676,1.38376,-3.59798,1.88876,1.90766,6.33722,1.16568,-1.88109,-5.49532,7.56995,-3.97276,2.47056,-1.10217,-4.02745,0.530141,-1.80729,-2.44923,1.11112,6.04583,5.79514,-1.61378,0.146823,-4.31812,1.65679,-0.82556,0.385538,-1.6035,-0.921055 10159.8,10135.2,9260.63,-0.16576,1.00018,-5.12473,0.442361,0.505831,-5.64864,-2.63413,-2.52592,-5.46478,4.95174,-4.3147,0.782684,-5.73615,-4.82371,0.266276,-1.86669,-4.0481,-1.31822,9.03428,5.18538,0.835431,-1.04748,-4.21294,1.0615,-0.105573,-1.22812,-5.24566,-3.63422 10165.2,10138.1,9258.46,0.205477,-0.680098,-4.46762,5.26891,1.18115,-1.68502,7.13137,-1.22722,-4.01706,-1.7858,-0.511666,3.55446,-3.85553,-2.43205,1.3525,-0.694302,-4.16672,-0.729833,7.26617,2.38627,0.742375,-2.04911,-3.24066,2.72775,2.10783,0.115275,-4.78462,-4.34396 10171.6,10139.6,9254.61,-1.51268,-2.23477,-5.13237,-3.29461,-0.317239,-10.5071,-7.94002,1.87205,-2.15615,-2.57627,4.52526,1.46446,-2.39092,-3.68309,1.44927,1.27351,-2.10555,-3.67494,7.0263,3.64847,0.370668,0.612656,-2.452,4.76347,5.31087,1.21101,-2.18927,-4.86589 10174.6,10139.6,9250.85,-0.380976,0.430706,-4.77251,1.24603,3.57465,-3.14504,-10.8805,1.4131,-3.82203,6.1265,4.05681,1.86576,-2.69539,-3.84931,0.571097,0.0445532,-3.61574,1.0929,5.45496,4.67637,-2.69117,0.376736,-3.44843,8.26613,5.44059,2.39248,-1.35143,-3.43895 10173.2,10141.8,9247.9,-0.967231,0.660605,-0.333774,0.682442,10.1733,9.80472,-4.02844,0.296976,-2.0856,1.70749,0.105393,-0.302007,-2.02762,-1.68176,-2.57321,-1.85542,-2.20576,-3.56605,7.81712,4.57148,-0.717533,0.00661063,0.070936,7.88567,3.00205,-0.188925,-1.30646,-0.417109 10169.8,10147.8,9245.05,1.57911,1.89614,-1.23894,5.44327,1.1255,2.7455,0.888702,-2.69789,-2.29535,1.37374,-2.16695,0.277041,-2.61632,-0.168021,1.19527,-0.966804,-1.39634,2.02717,6.13068,1.74285,2.61838,-0.673957,2.42798,5.71141,1.0237,-0.190537,-2.48355,-0.424022 10166.9,10152.4,9241.4,1.48812,1.56883,0.00439658,-1.99079,-5.3945,-7.45076,-2.79497,-1.09824,0.438405,1.08335,0.567998,-2.12211,0.537132,0.235065,2.13962,0.850241,2.33283,0.11668,5.71046,0.316621,2.37782,1.5783,4.38674,4.44102,2.85837,-0.867284,0.197126,-0.632035 10166,10149.9,9237.21,3.10346,3.20745,-0.0787972,3.26164,-1.99167,1.15174,7.73898,0.388067,-1.3872,7.93093,2.89628,-0.846609,2.95243,1.10786,0.0356645,-0.191303,-1.48335,3.06518,0.833731,-2.48298,-2.62814,-0.329278,-0.0454046,4.84244,1.50962,-0.571214,2.28968,0.0896905 10169.4,10141.9,9233.72,1.54047,2.79665,0.872984,0.435893,0.341067,4.50191,6.31086,2.24353,0.0763229,5.33021,2.30696,-1.94916,2.28551,1.6759,-3.55737,-0.57595,-3.31446,-1.28349,0.109544,-0.911539,-3.08755,0.149125,-2.57658,2.65457,-0.759677,-1.72314,1.73795,1.22082 10175.5,10134.5,9231.85,3.08721,1.31195,-0.463831,-2.78365,-16.0641,-12.4959,-7.90321,1.44639,2.2521,2.09953,-0.628689,0.674957,-0.991746,0.999703,0.501374,1.08647,-1.9555,-0.457535,-1.969,0.140249,0.679574,4.05153,-1.26929,2.9472,1.23177,0.0460567,-1.18548,1.19414 10178.5,10132.3,9231.94,4.8578,-0.156201,-1.83619,3.45539,-10.5983,-4.40534,-3.25278,-1.48511,1.7839,1.07398,-3.79721,3.44697,-0.661031,-0.19397,1.51898,-2.78611,-1.58924,-1.02247,-4.03291,-0.779814,-2.72459,1.42865,-4.44874,1.96164,0.024013,0.769821,-1.68183,-1.09525 10176,10135.5,9234.24,3.98434,-2.9881,-1.82932,-3.45496,-4.37718,-1.32479,-6.81161,0.242295,3.63988,0.773917,-2.92089,1.50769,1.03257,-1.29175,0.607123,-3.32519,0.794345,-7.2134,-4.18473,-2.11878,-3.48641,2.04926,-1.83971,2.5711,1.8547,-0.444122,0.204744,-0.633906 10170.3,10141.1,9238.24,4.5574,-1.21766,-1.92884,-3.3891,-4.53289,-3.61119,-11.1428,0.87067,2.52674,6.28098,-0.916225,0.833349,-0.285056,-2.02874,2.83162,-0.822357,0.836116,-2.02452,-4.36166,-2.46534,-2.40599,3.53798,0.439996,2.8824,2.66576,-0.190266,-0.411649,-0.335746 10164.8,10146.9,9241.73,1.14271,0.21175,2.54403,-5.97996,8.86795,9.92082,0.583279,0.92891,3.1377,1.52082,0.653327,-2.04189,-0.909795,-1.88382,-1.45444,-1.72465,2.94817,-6.9659,0.661566,-0.779148,-2.33549,3.61435,1.90115,-0.709103,0.572663,-2.44443,-1.61985,-1.24632 10161.8,10151.9,9242.42,0.429305,-0.24402,1.54324,-0.758714,1.99988,2.30697,-0.150645,-1.67843,-0.372931,2.68223,0.974669,-2.18675,-3.69726,-3.84373,0.315076,-1.61503,2.02219,-0.439987,1.5067,0.347441,-0.468043,1.85512,2.51346,-3.61534,-1.61311,-1.68631,-4.32277,-3.31289 10160.6,10154.5,9240.5,-1.6783,-2.7916,3.79283,-1.46484,1.8842,7.0456,3.61276,-2.08564,-1.14902,-3.90469,1.00738,-2.71903,-1.12392,-2.56102,-0.564502,-1.26929,2.87817,-3.80446,2.16188,1.69189,-0.17359,-0.806729,4.45158,-4.99401,-1.9224,-2.1335,-3.41399,-1.5215 10158.8,10152.9,9238.94,-1.26294,-1.55708,2.47997,-0.37092,-5.35681,-1.99801,-4.61673,-3.19995,-3.63982,-3.59422,0.268397,-1.15304,1.21312,-1.94008,2.37467,0.463918,1.03699,-0.249188,1.94821,3.1095,0.656428,-1.26258,5.17342,-2.5293,-0.911564,-0.727538,-1.60047,-0.657086 10157.1,10148.4,9241.47,-0.729297,1.90628,1.50273,8.02209,4.5029,7.25435,-0.943104,-3.87229,-5.15977,-0.605295,-0.786266,-0.00624273,3.2036,-0.99694,1.83674,-0.424322,-0.759934,4.69506,3.12589,4.93905,-1.14094,-2.37706,0.896838,-1.15642,-2.07425,-0.341439,0.651623,-1.90525 10159.3,10145.1,9249.53,-3.61489,-0.368775,4.8318,0.654323,13.8953,20.2332,9.01061,0.740005,1.06482,-1.98312,1.43178,-2.39481,5.44965,2.23927,-2.07082,1.84445,3.36316,-2.3874,5.82791,5.13504,0.331121,1.17574,4.11636,2.46863,2.53744,-2.31289,3.73605,1.261 10166.4,10146.2,9260.39,-0.690065,-0.196533,2.57149,3.28245,1.26863,3.07282,2.3288,0.343504,0.7493,7.7189,2.47287,-2.19401,1.83016,1.49389,2.04941,5.57015,1.68587,7.37325,4.33035,3.86901,3.21355,1.31074,4.30838,4.34097,4.14204,-0.792683,1.91579,1.4487 10174.6,10153.3,9268.63,0.973864,0.288282,4.67663,-0.604468,1.35396,1.77193,6.1612,0.928573,3.56181,0.301872,1.61496,-1.94891,1.37811,1.784,-0.829802,4.5252,2.98522,2.05165,3.03006,0.33278,4.9167,0.692046,4.78248,3.89965,4.1223,-1.28055,0.902128,2.44014 10179.4,10165.9,9270.91,0.383028,0.372248,2.91142,5.26445,-4.52355,-0.481389,-1.47582,-0.0802922,4.09074,-3.4789,-1.84054,-0.641665,1.60157,2.15213,-0.406849,1.24052,1.05589,7.69175,-4.79723,-3.42058,1.48542,-2.69221,-0.604027,-2.8823,-1.41943,-0.386671,1.59434,1.71786 10180.9,10180.3,9268.76,-7.39108,-4.07938,1.96913,5.84801,-1.99672,13.1344,-8.45676,2.45664,8.74322,0.00440195,-3.70354,-4.02376,5.09873,7.07674,-2.94009,-6.27334,-2.18896,9.06615,-15.5002,-6.518,-12.659,-9.2251,-8.78964,-16.0646,-15.2285,-1.36974,7.28841,2.96689 \ No newline at end of file +10125.9,10112.8,9219.5,-7.39443,-8.74936,7.28395,13.7953,32.2328,32.4809,18.958,-12.2383,-6.86466,-23.0912,-16.425,-5.70842,11.2467,-1.58574,-4.53717,-17.3842,0.912601,13.0428,2.44622,2.08875,-8.74373,-9.47217,-6.87574,-8.11158,-14.54,0.414787,6.04424,0.540389 10136.8,10115.1,9222.54,-0.120582,-1.94906,6.92247,4.75197,11.0735,0.972766,10.2285,0.717545,-1.04488,-7.64424,-2.10875,-2.44368,1.52535,-1.14131,-1.72589,-1.1247,-0.993354,2.98318,1.29855,2.0688,1.00297,0.135373,-3.25325,-3.12065,0.913296,-1.7868,1.58829,-0.735248 10148,10122.2,9228.62,4.24336,-0.689111,5.12782,0.132862,-6.64526,-14.7952,5.19361,3.68198,2.77598,-0.691866,1.07559,1.71444,-1.30287,-2.75746,1.74208,4.75944,1.80799,-0.064464,2.37174,1.09905,3.5756,2.98064,-0.238711,0.822007,5.07188,-0.864496,-0.208741,-1.31367 10156.6,10132.2,9236.11,-0.047434,-1.79438,-0.767925,-3.78683,-2.46365,-12.9433,2.00586,-0.48292,1.16216,0.113706,-0.639879,-0.0445654,-2.82995,-2.22008,1.46544,3.70217,2.84476,-3.32792,6.701,0.982599,0.145487,0.0501163,-1.16747,-0.630382,-0.0550437,-0.0563951,0.0449386,-0.715988 10162.9,10141.8,9243.46,-0.3687,0.640608,-2.93969,-0.37466,-5.42813,-8.55527,-4.70566,-3.62351,-3.94857,0.847112,0.357187,1.39279,-3.07124,0.779726,5.12671,3.62277,2.86265,3.44378,5.49842,0.895482,-2.1777,0.14728,-0.491475,-0.0257423,-0.32504,2.28464,-0.610659,2.01955 10168.7,10149.5,9249.62,-0.272231,3.00751,-2.20783,-5.50238,-1.65733,-2.39574,-6.82249,-1.5591,-5.38806,-0.315138,2.41171,-0.227563,-0.306796,1.26618,4.45885,3.55662,3.14737,-0.0497907,2.76691,1.04757,-2.50276,3.25334,1.90194,3.54754,3.2308,0.393197,0.115407,1.88919 10175.3,10155.8,9253.09,0.271133,3.11725,-1.24188,-5.32432,6.94595,5.40219,2.63329,1.77742,-0.434798,3.20784,3.1926,-2.12653,1.4207,-0.162939,1.57116,1.20026,2.14004,-4.36978,-0.074248,0.344989,-2.79157,3.57441,2.795,6.81971,4.61981,-3.15395,-0.556388,-0.951462 10181,10160.9,9253.62,-1.52186,-1.02665,-1.31765,-8.89055,1.45638,-6.40533,-8.20284,3.42071,6.34151,7.32703,2.81444,-5.56924,-2.07761,-2.82472,1.75969,1.56549,2.59032,-4.99642,-0.861721,0.661704,1.27294,4.24609,5.72265,7.93181,6.46356,-4.54558,-2.93302,-2.55741 10182,10163.1,9253.53,-4.12759,-5.01517,-1.383,-11.7032,7.03273,-0.354258,-4.14846,2.56836,5.49077,2.70724,-0.00938943,-7.91268,-3.33257,-3.77932,-2.70035,-1.95288,1.51899,-10.5021,0.604386,1.13765,2.8031,0.719838,5.10986,5.4321,3.01561,-5.05514,-2.51591,-2.29453 10178.9,10161.7,9255.33,-2.09727,-3.23639,-0.971464,-6.47564,-1.86208,1.47429,-8.69004,2.23012,2.64935,4.20852,-0.00802028,-4.11236,-1.54808,-1.73414,-2.21966,-2.31888,0.521142,-4.49634,-1.66003,1.37105,1.47741,-1.17943,3.52554,2.31201,0.381259,-1.24137,-0.930002,-0.860505 10176.3,10158.2,9258.8,-2.87976,-1.16821,-1.15587,-7.36873,-2.70663,3.69409,-6.23946,3.17083,3.67683,5.95472,2.6739,-2.5798,1.61294,2.31642,-4.31408,-1.6647,-0.422612,-6.13843,-0.39141,1.92345,-2.82275,-0.742784,1.68164,-0.706688,-1.87652,0.172975,1.51911,1.04727 10176.2,10155.4,9261.93,-1.79655,0.511159,-2.91648,-1.19976,-6.01265,2.43062,-4.91165,1.64787,2.485,6.04132,2.79139,1.36683,2.36631,4.70105,-3.09068,-0.875835,-2.73203,-1.04036,0.0279962,0.57264,-4.70596,0.399049,0.109101,0.540718,-2.52779,1.90878,1.47212,2.48712 10177,10154.3,9263.36,-2.06935,1.47151,-1.59814,1.1621,-8.21806,2.74994,-4.8666,1.6535,2.86737,3.56179,1.87379,3.98852,2.20191,7.00018,-2.12026,-0.322149,-0.459427,1.99009,-0.386875,-1.65524,-2.88602,2.5405,3.09752,5.52644,1.72241,3.28467,2.06659,4.48929 10176.7,10153.6,9262.97,-2.47996,0.0736981,-1.18826,-1.40068,-2.38119,-1.33094,-3.87199,0.498621,1.31667,-0.952908,0.481976,0.0885501,1.11339,4.67043,-2.37383,-2.32579,0.991108,-0.25346,2.41941,-1.44295,0.0394728,1.67752,2.73018,4.10445,2.29859,0.993454,2.7469,3.39394 10174.9,10153,9261.77,-0.957748,-0.455644,0.885525,1.7746,0.0437147,0.878291,0.0855234,-0.572903,1.39546,0.00119098,1.69176,-1.96049,0.156938,2.84845,-1.18488,-2.65197,1.35428,1.98606,1.65427,-0.643756,-1.03602,-0.0406435,-0.236011,-0.961959,1.28125,-0.464305,1.75539,1.84618 10173.4,10153.5,9261.3,-0.583682,-0.792331,1.36077,0.644185,-3.55594,-0.618864,-4.88099,-0.136266,1.51362,2.73872,3.65897,-2.63062,0.416981,0.735765,0.533665,-0.326252,1.0146,2.83848,2.16063,2.30307,-2.01136,0.638055,-0.22921,-3.19692,0.947596,-0.379132,0.678065,0.747812 10174.5,10155.7,9262.24,-0.685336,0.856591,-2.63545,-0.959601,3.25442,0.791955,-2.20612,0.263046,-1.34292,4.47114,2.99912,-2.56858,-0.21931,-1.56389,-0.808263,0.311028,-2.34261,-0.965718,1.98615,3.50723,-1.41951,-0.258476,-1.16227,-1.73014,0.372641,-0.118946,-0.422557,-1.3986 10179.6,10157.8,9264.01,2.59538,3.68921,-1.9033,3.99249,0.109215,-1.86778,-4.51336,0.591929,-1.29086,1.52475,1.01934,0.773735,0.0652847,-3.00075,1.79923,2.1369,-2.11635,3.17035,-1.87907,2.19309,0.880052,-0.480886,-1.94369,-0.204693,1.63785,1.43004,-2.081,-3.24652 10186.9,10157.6,9265.4,2.10402,4.02633,0.884264,0.1708,-3.27208,-4.9215,-1.0364,1.60796,1.70888,-1.43476,1.10519,1.26841,0.0627916,-2.97727,1.13683,2.82663,-0.301705,-0.592683,-3.81587,-0.70989,1.60855,0.103857,-2.48043,-1.22737,-0.312858,1.31617,-1.91269,-3.98886 10192.2,10155.4,9265.29,1.6824,4.26755,1.57687,1.43194,-5.98808,-2.25097,0.153789,0.168572,0.879003,1.68604,0.75956,3.65922,-0.869793,-2.49312,0.497574,2.41553,-1.34226,-0.127659,-3.59295,-1.56547,0.88849,-0.785242,-4.24845,-5.15572,-4.81836,2.77035,-1.44493,-3.44434 10193.6,10153.7,9263.38,1.6491,4.80854,1.08823,5.10222,-5.26833,5.52263,-0.997094,-0.959485,-1.52356,6.15147,0.897033,7.60472,-1.50848,-0.576994,0.845199,3.25263,-2.21353,2.36454,-2.11918,-0.480371,1.405,-1.24949,-1.88424,-5.50221,-4.39822,4.6832,-0.575266,-0.350337 10193.7,10153.5,9260.14,0.371243,3.4575,-0.922956,2.86612,3.70316,4.4652,-2.35097,-2.08567,-4.55866,2.05406,0.20181,5.48777,-0.851734,-0.932792,0.852325,2.66059,-2.76402,-0.836483,3.32512,2.58318,3.54953,-1.82575,1.03107,-3.58566,-4.1055,2.71087,0.64122,1.16036 10193.4,10154.1,9256.45,0.655998,2.95689,-0.961572,2.95967,6.90968,-0.0847335,-1.13659,-2.64581,-3.78971,-2.43015,-0.722449,3.08777,-0.234356,-0.603156,1.30068,1.14368,-2.23215,0.241084,3.91588,3.38796,4.07024,-1.08082,1.15617,-0.375163,-2.54369,1.29418,0.795869,1.31402 10190.3,10152.8,9253.2,2.59279,1.93007,1.93861,4.82647,-1.84288,-5.84018,-7.03235,-2.16958,-0.8999,-4.4747,-1.99497,2.40008,0.0349671,-0.825783,2.00993,-0.184404,-0.576706,6.30193,1.43455,3.63536,2.34484,0.148851,-1.22127,-0.718508,-0.716753,1.50537,0.412978,0.73252 10185.2,10148.2,9250.73,1.88291,-0.127643,2.41457,0.38457,3.28565,2.40364,1.07674,-0.352091,-0.192694,-2.80281,-2.45121,-0.746935,0.454781,-0.345492,-2.38393,-2.35152,-0.468918,-0.28004,0.207449,2.6636,-1.39254,-2.09536,-4.44811,-4.48824,-2.93117,-0.770421,1.19,0.219788 10183,10142.2,9248.93,3.78484,0.701338,-0.71552,3.48407,0.454755,4.3743,3.68099,-0.668556,-3.42636,5.52772,-1.23863,-0.405148,0.665698,1.06479,-0.0251586,-0.48849,-0.847741,1.4814,-5.36764,-0.405219,-1.51485,-3.88226,-5.12764,-5.33767,-4.3365,-1.173,0.417418,0.415356 10185.4,10138.4,9247.93,3.11727,0.196163,-2.018,0.721283,-2.5075,-1.06349,0.331823,-1.2182,-4.01712,4.78444,0.452166,-2.16432,0.55673,1.61447,1.16718,1.44415,0.569846,-0.812131,-8.14324,-2.91296,2.43154,-1.45218,-0.730675,-1.0947,-2.25658,-3.52675,-0.361214,1.09266 10188,10139,9248.05,1.52249,-1.16117,-2.4591,-2.41492,-0.35832,-7.48161,-0.0490082,-2.1421,-3.52013,0.903896,-0.958215,-5.8036,-2.36788,-0.368615,-1.88998,-1.40466,-1.28791,-4.79995,-5.58563,-3.57656,4.13739,-0.274441,1.53352,2.93946,-1.96753,-6.76034,-1.87752,-0.324793 10186.8,10142.9,9249.23,2.29541,-0.414867,0.263844,-2.42527,-9.23597,-12.7958,-5.40665,-1.3296,-0.255947,1.05195,-3.09731,-3.83996,-4.40177,-0.0123634,-1.79533,-2.22933,-1.59891,-1.58539,-4.29444,-3.24283,2.73497,0.939395,2.25632,3.98042,0.672842,-4.87272,-3.0871,0.140664 10183.8,10146.3,9250.93,1.04007,-0.107056,-0.719832,-5.17314,-6.41206,-13.4527,-3.51115,-1.82372,-1.0661,0.164654,-4.87432,-3.16371,-3.16216,0.547311,-2.31938,-3.32366,-2.59406,-3.07878,1.07584,0.135595,-0.15385,-0.198986,-1.76614,-0.364142,-1.44816,-3.17832,-0.666637,0.539005 10182.5,10148.1,9252.57,1.58315,0.552138,-2.38854,1.84879,-2.25441,-6.8381,0.208721,-2.73312,-3.19332,-2.49192,-4.21087,0.445019,0.0651566,2.67403,-0.780414,-2.43461,-3.10543,1.48742,-0.123359,0.0321366,-2.00728,-1.30717,-5.02137,-5.05394,-3.39985,-0.233706,2.10556,1.51466 10182.7,10149.6,9253.33,0.671616,-1.8801,-5.19861,1.6691,-0.386439,-6.73637,0.390118,-1.36276,-2.8229,-3.74619,-1.53148,0.15594,0.934737,1.96014,-1.35363,-0.924511,-3.00858,0.653744,-1.84706,-3.59509,-0.247233,0.962108,-1.40552,-3.28119,-2.22432,0.0626129,2.48273,0.969888 10182.9,10150.9,9252.01,0.0166707,-2.52456,-5.48285,2.26653,-2.03587,-6.50283,-1.00325,0.264499,-1.46362,-0.822672,-1.11829,0.403605,-0.734484,-0.382999,-0.186567,1.24812,-2.13095,1.80897,-2.82131,-6.15356,2.54337,2.39696,2.51379,2.41699,0.307725,-0.195503,-0.252349,-0.890546 10182.1,10151,9248.33,-1.21698,-1.52567,-2.334,0.102378,3.74418,-1.36756,3.51501,1.50357,-1.80774,-0.855037,-2.71284,0.0746735,-1.2904,-2.37263,-0.326812,1.37779,0.0811662,-2.04277,0.452769,-4.37491,4.60025,0.785458,0.944597,2.57121,-0.443829,-1.9031,-1.78376,-2.25217 10180.2,10149.4,9243.85,-0.498632,0.815261,-1.05027,1.32586,2.65892,-5.17029,-0.588453,1.63481,-3.33979,4.4087,-1.26981,2.01576,-3.03953,-3.66687,1.33091,1.62961,0.568999,0.53543,0.477935,-1.78405,3.91722,-1.12653,-3.07327,-2.27103,-2.21119,-0.0469714,-3.05949,-3.83303 10176.1,10146.3,9240.54,-0.464849,1.25223,-1.14736,-0.645201,4.96922,-0.805424,1.85313,1.43677,-1.45072,6.22509,1.54511,2.89442,-3.56094,-4.35854,-0.476689,0.39343,-0.929162,-1.07774,0.941846,-0.57756,0.363373,-1.13491,-1.30865,-3.06369,-1.8739,2.47973,-3.19611,-5.38414 10169.3,10142.4,9238.91,2.28739,1.91951,-0.759834,1.17008,-1.10807,0.137649,-1.76481,-0.427729,-0.592675,2.50623,0.607717,4.10404,-2.20382,-5.11375,1.80008,0.383348,-3.40396,4.33491,0.605228,-0.0871236,0.185566,0.480246,2.74078,1.48145,2.07534,4.96863,-2.65852,-5.78272 10162.1,10139,9238.14,2.03262,2.32633,0.46709,-2.26524,5.80967,5.85587,5.67759,0.185696,-0.246666,-0.787877,-0.201738,0.61348,-0.542043,-3.51173,0.345287,-0.426571,-4.01566,0.315299,2.10005,-0.391753,2.39343,1.28396,3,4.99164,5.3145,2.31592,0.0224444,-4.14279 10158.4,10136.9,9237.31,2.77556,2.83113,1.37245,1.19159,2.19923,-2.0116,3.1913,1.03754,-0.929092,0.870894,1.00256,-0.624392,-0.561338,-2.99529,2.23674,0.823539,-1.63024,3.75817,0.298891,-1.18515,4.54738,1.25951,1.91277,3.57793,5.44217,0.785618,0.025315,-3.27161 10158.5,10135.5,9236.37,0.0672571,0.761886,2.35427,-0.889999,6.73976,-1.98269,8.45302,1.1398,0.0604089,-1.15193,1.32222,-2.47069,0.131408,-3.48238,-0.669944,0.753279,3.07189,-2.04262,0.174304,-2.32107,2.83224,0.708328,3.23848,0.984911,2.384,-1.28385,-0.548071,-3.32946 10160.6,10134.8,9236.46,-0.783525,0.239203,0.00548465,1.88108,6.83171,-2.89703,7.27976,-2.71585,-1.47417,2.12383,-1.04536,-1.14095,0.145875,-4.3962,-0.139564,0.781551,3.40043,-0.28834,-0.343608,-2.36391,0.0938093,-0.36295,1.0276,-0.578692,-0.619797,-0.489157,-1.92106,-4.163 10166.1,10135,9239.02,0.124276,1.29463,-1.44975,3.21172,2.53479,-3.38317,-0.20102,-4.72755,-2.14129,5.53743,-1.24849,0.994366,0.436372,-3.09635,2.19121,1.13794,1.52365,3.0586,0.622146,-0.699363,0.103461,0.316277,-1.73095,-0.195395,0.490618,1.44514,-2.50878,-3.62472 10175.6,10136.9,9243.9,1.67228,1.70099,-0.125799,2.04051,6.74509,2.05118,7.82124,-3.08565,-1.70842,3.37127,-0.160655,1.32998,0.57087,-1.46351,1.80831,-0.585194,-0.267853,0.719624,2.12333,-0.931791,2.61407,0.519467,-1.78038,1.70819,2.66646,1.47407,-2.48388,-2.6294 10184.4,10140.5,9249.09,4.05746,1.49391,3.1491,4.74869,1.42089,-7.65297,4.6083,-1.50292,-0.681543,0.792377,-1.54194,2.19467,-1.449,-2.54459,5.38937,-0.0662613,0.683022,6.46847,-1.151,-2.09676,5.40097,0.0884146,-0.584039,0.411805,2.87021,2.70096,-3.69024,-2.72328 10185.2,10143.8,9252.71,2.20708,-1.9117,6.2705,-1.38994,9.88462,0.984595,14.8745,1.09177,3.01497,-6.59006,-3.06879,0.864155,-0.352553,-2.42934,1.6214,-0.899998,2.90809,-2.62154,-0.748965,-1.78716,3.1828,-0.76616,1.51574,-1.80336,0.759499,1.08543,-1.48814,-0.830864 10176.5,10145.2,9254.8,3.08758,-1.24415,2.30133,1.5123,4.9996,-2.25743,5.71269,0.326257,0.862459,-5.32366,-2.15784,1.98295,-0.769376,-3.24456,1.73394,-1.18022,0.303592,1.19388,-1.18318,1.1848,-0.484859,-3.12715,-2.31674,-4.16244,-1.41399,2.32149,-1.0187,-1.70219 10164.6,10145.4,9256.92,1.59078,-1.06701,-0.557541,-2.88977,3.22953,-0.245042,-0.474481,0.0498212,-1.16809,-8.33134,-0.306573,0.38113,0.242976,-2.39828,-1.29092,-1.68013,-0.127576,-1.94114,1.03024,1.7825,-1.44807,-2.86352,-4.13379,-1.78466,1.5241,1.16147,-0.513496,-2.30027 10156.4,10145.9,9260.21,0.0333157,-1.40254,-1.63643,-2.63202,2.15792,2.8366,-1.32406,-2.25364,-4.61227,-7.74587,-1.005,0.107792,-0.131513,-2.0428,-1.28031,-1.65736,-0.0589992,-0.767749,0.0451012,-1.23948,0.334266,-2.05544,-5.74107,1.40617,2.47259,0.129519,-1.22605,-3.50154 10152.5,10145.2,9264.25,-2.23854,-3.34598,0.871046,-4.48776,-5.12246,-0.367558,-7.49548,-3.04105,-2.99035,-3.84367,-2.67766,1.19195,0.695189,-1.99211,2.38266,0.800284,2.92667,1.82052,-0.796218,-1.82753,3.43662,1.60186,-2.49788,2.02216,2.59346,0.975508,-0.397427,-2.78437 10148.6,10141.1,9267.56,-4.64613,-5.4569,3.80281,-6.22039,0.554038,5.00519,-0.395733,-3.04225,0.570141,-6.95862,-4.49105,-0.00732036,3.78285,-2.09066,1.46914,-0.873643,3.95228,-2.08532,2.8568,0.749314,1.78963,1.02579,-0.808831,-1.60113,-1.17483,0.544949,1.95805,-1.27827 10142.4,10134.6,9268.73,-4.02228,-5.3818,4.39201,-6.57399,-2.68308,-0.146626,-0.297909,-1.28233,3.72363,-10.5635,-3.46562,-0.498293,3.92457,-1.10422,0.725311,-0.888612,3.1725,-1.82837,4.64182,1.32637,-0.56378,0.781271,3.29557,-0.557202,-0.712584,0.587691,2.76212,1.05325 10137.8,10128,9266.83,-2.98689,-3.62614,2.49614,-3.78405,5.33483,-3.24499,-1.4797,-1.49474,0.75769,-13.0722,-3.57543,-1.73535,1.13307,-2.81826,-2.67056,-2.75063,-0.407379,-1.38965,7.67619,2.2374,-2.93415,-2.1994,0.956463,-2.25511,-4.42128,-0.889014,2.30781,-0.144069 10139.6,10121.2,9261.84,-1.19244,-2.09691,-1.17019,-2.92359,1.84257,-9.64131,-8.2266,-2.48032,-2.29368,-7.41116,-3.60172,0.404837,-2.31741,-3.52505,-1.14341,-1.1367,-2.22469,2.93998,5.91064,0.841518,-1.68308,-1.06298,-0.398387,-1.68239,-3.53445,0.38234,1.02165,-0.403129 10146.2,10113.8,9255.3,-3.35595,-3.34535,-1.74811,-10.4556,3.60927,-0.776329,-3.08604,-1.29687,0.835023,-5.76979,-1.7646,-2.22816,-1.31439,-0.382083,-1.73312,-0.792276,0.206848,-4.1992,4.29806,-0.830575,-1.71405,1.40452,2.00247,0.106559,-0.768805,-1.08451,1.11784,1.22578 10152.4,10107.8,9249.87,-2.49869,-3.87311,-1.98238,-6.90342,-1.23671,2.90852,2.97754,-0.581043,2.81778,-2.71728,-1.21684,-5.07044,0.497485,2.01224,-0.365556,-1.64542,1.17956,-3.76085,-0.573467,-2.58111,-2.12663,0.378165,4.18795,1.24581,-1.36196,-2.87649,0.482267,1.63454 10154.8,10107.2,9247.27,-4.01788,-5.39388,-1.72161,-10.3153,-0.251037,-1.57831,1.61553,1.18147,5.7765,-0.599766,-1.22598,-10.0294,0.895145,2.02015,-4.45992,-2.58818,2.98391,-9.45103,-1.41902,-1.29446,-0.55725,-0.180421,6.94249,-0.594659,-3.53394,-6.50742,1.38112,1.51458 10153,10112.2,9246.76,-3.24249,-5.01072,-2.02956,-7.46567,0.0264794,-1.5224,-3.31193,1.53111,5.32332,2.5335,0.40251,-7.05633,-0.711568,2.89381,-5.39998,-1.36446,2.04786,-7.02942,-4.53297,-0.88262,-0.357391,0.595822,6.5409,-2.84395,-2.64994,-5.7378,1.39939,2.97985 10148.7,10119,9246.16,-3.96002,-4.42756,-3.26432,-8.69557,4.03628,0.616301,-3.92147,2.76458,1.652,2.17356,4.22927,-4.5247,-2.33417,3.89508,-5.29918,-0.309883,-0.288513,-8.36711,-3.09529,-0.126421,-1.8539,2.38545,3.61409,-1.26649,0.429596,-4.19612,1.45711,3.95651 10145,10125.2,9244.17,-1.75695,-0.511195,-1.73883,-3.34742,-1.26592,5.24499,-3.03549,2.78645,-2.1334,0.220919,5.88292,0.160927,-1.7455,5.37331,-1.59599,1.91312,-0.631146,-3.16886,-2.94994,0.34822,-3.01289,2.84951,0.356135,3.47859,4.18276,-0.12287,0.984563,3.64398 10143.1,10130.2,9241.27,-1.71615,1.12867,1.04805,-6.57347,2.41341,16.2593,7.00371,0.924589,-2.71609,-6.2656,3.57183,0.37743,1.96421,5.66573,-2.3041,2.26799,0.668846,-8.32571,2.30148,2.66333,-1.75615,2.71555,1.44408,6.00224,4.85886,0.685304,3.03234,2.82015 10140.7,10134.4,9239.05,-1.25992,2.46902,-0.556969,-2.76672,5.45596,12.4649,8.36959,-2.49709,-3.8708,-1.40646,1.38854,1.37064,2.12007,3.84209,0.459629,2.15086,-1.24194,-4.15365,4.52043,5.4809,0.876317,0.656659,-1.01116,2.09458,1.65028,2.77599,3.21635,0.381243 10133.6,10137.8,9238.32,-2.22442,1.37094,-0.787327,-1.05469,3.55443,5.14715,-0.0509983,-0.0905216,0.72894,3.96149,2.38061,1.75467,3.09083,4.18358,2.79613,3.29833,0.325666,-0.671704,6.07566,7.72379,3.13564,0.655668,-2.59152,-1.76199,1.58102,4.45884,3.34631,0.480564 10121.1,10140.7,9238.2,-2.17367,-0.866588,-2.79273,0.692199,10.1863,9.97874,6.04483,2.66482,1.76948,2.61332,1.9281,-1.1243,5.03132,3.85731,-0.443337,0.284932,-0.868815,-3.31091,8.51065,6.49177,2.23459,-1.67042,-3.77735,-2.781,-0.902713,1.50205,4.04064,0.197185 10110.8,10144,9237.47,0.303664,0.966366,-2.65365,4.69141,3.98147,5.09796,4.57488,3.26927,0.562439,5.41174,1.92471,-1.15766,3.6349,2.42314,-0.0874924,-0.0560302,-1.22366,1.9914,3.44357,1.69106,1.98031,-1.32375,-0.576816,-1.03349,0.269332,-0.300454,3.28264,-0.458562 10110.3,10147.7,9235.48,1.28867,0.940385,2.1165,-0.581377,-0.643187,-2.16313,1.69237,2.47912,1.37859,3.32286,1.26412,-0.720553,2.36863,-1.25903,0.0706914,0.944374,2.2859,0.229574,1.5842,-0.12766,4.43122,1.34327,3.34673,-0.404948,2.87655,-1.67866,3.04869,-0.25307 10116.7,10150.7,9232.33,0.394714,-0.833445,4.94793,-6.11826,9.22151,2.99358,11.1041,1.15853,2.93899,0.397365,0.0221406,-0.0976144,-1.13452,-3.42557,-3.72862,0.476803,3.69054,-8.12164,2.48493,0.363106,3.87676,0.504363,0.972674,-1.44388,2.15926,-0.828986,1.75931,-0.549928 10121.4,10152.8,9229.14,1.29508,-0.757006,3.12597,-1.6729,7.62364,-0.936804,6.48918,-1.03742,1.86227,-0.262351,-0.75051,2.31301,-4.8422,-4.5034,-2.66476,0.578808,1.27532,-2.04282,3.45288,3.01897,0.564668,-1.21876,-3.06331,-2.70583,0.257935,3.52846,-1.56111,-1.5308 10121.6,10152.4,9226.86,0.677648,0.378414,1.31475,-2.61018,4.91454,0.37514,2.86121,-0.193973,1.93324,-4.63591,1.10695,3.14457,-2.96694,-2.19304,-2.99025,0.50097,0.165722,-0.200595,6.85438,4.63234,-2.47705,0.342532,-1.30419,-0.141339,1.63084,4.32707,-1.19328,0.76139 10120.5,10149.2,9225.49,0.499478,1.88224,-2.14427,-2.77288,10.6927,1.71766,6.49787,0.43981,0.0705592,-5.13201,2.57263,1.48076,-1.20267,-0.591255,-4.74193,-1.79266,-1.46188,-3.42451,8.04316,3.54243,-2.30088,0.0710442,-2.83238,0.653942,0.240506,0.904871,0.430945,1.6283 10121.2,10144.8,9224.89,1.35965,2.80608,-1.94166,1.75583,0.26227,-8.26437,0.567312,1.6259,1.60009,0.0627174,2.62631,2.65738,-1.31444,1.36503,-0.138702,-0.303116,1.07964,0.805711,0.6712,-0.0379901,0.596301,1.49046,-2.9437,-0.0854658,1.7116,1.14138,0.19577,2.11315 10121.7,10140,9224.64,-0.625981,1.46152,0.571473,-0.708952,-3.97306,-7.60183,3.54876,2.52756,3.43643,-3.37318,1.25185,1.95327,-0.430742,1.99167,1.38528,0.439469,3.35733,-3.21518,-3.33649,-3.33716,1.63613,2.87364,0.216347,-1.19264,2.34646,1.38095,0.250252,2.26893 10117.5,10135.7,9223.59,-0.644241,3.50756,1.18011,1.32346,-4.09529,-1.15572,8.91836,0.864807,0.810206,-4.21922,0.85698,1.54667,-0.984211,1.49262,0.424346,0.272079,0.55043,-3.11065,-4.92549,-5.21789,0.616593,0.933381,0.453042,-0.907799,0.816878,0.888407,-1.07882,0.897744 10109,10134,9221.44,1.24811,3.97674,3.11247,-1.16572,-9.20759,1.26864,10.07,0.861166,0.629341,-5.07074,1.84156,0.554677,0.501606,2.3508,-1.99158,1.42546,-0.0624237,-4.75601,-4.11731,-5.27973,3.12042,0.927954,2.01431,1.91643,2.26937,-2.42322,-1.85499,2.11246 10103,10135.6,9219.87,2.2046,4.10281,1.87105,-2.44462,-1.81059,2.73657,16.517,1.49188,0.862687,-1.50652,2.91423,-2.27191,-0.311967,3.16828,-6.05317,-0.647296,-0.600809,-9.86797,-3.317,-4.05579,3.51099,-1.77799,-1.17227,0.17711,-2.12588,-5.86398,-2.08211,1.43944 10103.9,10138.7,9220.3,3.77174,5.49059,1.2637,1.03751,-12.6254,-6.24364,0.90728,3.65224,3.71822,2.59825,4.31988,1.86088,-2.62582,4.43061,-1.00461,2.10803,1.47555,-3.28777,-8.18549,-4.31695,2.95113,-1.34785,0.676274,-1.38936,-3.04336,-1.37001,-2.35773,2.00922 10108.6,10140.8,9221.82,-0.70593,3.90046,-1.14247,-3.0764,-1.47295,-1.10809,-0.510284,3.79285,2.60078,-1.28697,3.77566,2.32766,-3.54475,2.99719,-1.20306,1.33262,-0.719923,-9.06449,-7.33119,-4.80493,-0.721145,-2.4024,1.79362,-1.97223,-5.04385,0.0875954,-1.73778,0.950888 10113.1,10142.1,9223.55,-1.06377,0.843971,-1.44889,-5.32939,2.69029,-3.83385,-5.63119,0.535717,-1.61039,-5.59267,1.26514,2.05707,-3.31026,-0.958826,1.33732,1.46551,-3.13585,-9.66605,-6.00234,-4.35532,-0.26599,-0.831562,2.98878,0.128679,-2.54674,-0.278737,-3.58409,-1.324 10120.7,10142.9,9227.01,3.56995,1.04759,3.75113,-1.7421,5.12807,3.1454,2.38504,-1.62768,-2.93793,-5.71266,-0.530001,2.84448,-2.04436,-1.31251,2.17243,2.11298,-0.867238,-7.66197,-6.87331,-3.32769,-0.373459,-0.116178,2.03689,0.379397,-0.00605166,-0.182103,-4.1657,-1.22794 10135.1,10142.1,9232.63,4.13322,3.14571,5.42112,-9.50857,6.61076,-1.5265,-1.3563,-0.229734,-0.953633,-2.39287,0.0907423,-2.25912,-2.95494,-0.622513,-0.878638,3.11006,2.20909,-12.7591,-4.65267,-0.652931,-0.508727,-0.484787,-1.43884,-3.89903,-1.68783,-1.20607,-1.47415,-0.30987 10150.6,10139.9,9237.26,7.08686,7.1115,3.05908,-7.31514,-2.75139,-6.15754,-6.75994,1.34201,0.583247,1.72791,0.0586144,-1.05549,-2.23348,1.35232,0.957745,3.9225,0.27845,-7.28043,-8.71747,-3.21629,1.12263,-1.08286,-3.72117,-4.10901,-0.817087,-0.319549,-0.171801,1.86899 10161.3,10137.9,9238.2,5.45348,5.872,0.0360833,-8.71486,1.68904,-1.57501,-9.84544,2.70784,2.39605,-1.45535,-0.548901,-2.93743,2.31592,2.21738,-0.0678836,1.75621,-1.90485,-7.83172,-5.34721,-0.902631,2.89369,0.938874,1.08004,0.946796,3.39736,-3.2386,1.23533,3.43628 10168.7,10135,9236.89,1.9988,3.16081,-0.959961,-1.65775,15.8147,12.2058,-6.43511,1.69639,2.59198,-2.06327,-0.47323,-4.35241,3.77438,3.79233,-2.16153,-2.08622,-2.56136,-3.89096,-0.736348,5.49778,-0.475583,0.770127,3.05002,3.17719,3.81221,-4.99556,1.59718,3.01185 10178.3,10131.2,9237.28,0.818385,-0.233269,1.46873,6.63122,10.9706,17.5879,-3.54675,0.677416,3.72244,0.655626,-0.201865,-1.16835,1.57109,5.42876,-0.444523,-1.12764,-0.256929,5.62565,-1.99386,6.4084,-2.47406,1.18593,3.2834,3.0293,3.51573,-2.53776,0.959038,3.23253 10193.3,10130.2,9242.16,-2.48525,-2.35837,2.98987,5.98816,11.4719,15.9039,-4.84232,-0.825315,2.54659,1.43064,-0.659643,-2.96556,0.571285,2.41784,-2.00371,-0.757574,1.41844,6.37057,1.42823,7.71148,-4.93994,-1.54988,-0.232174,-1.34349,-1.26249,-2.05601,1.26179,0.464125 10210.2,10133.3,9250.5,-0.302459,-1.69801,0.843368,2.30597,6.15326,11.0157,-5.9274,-1.05244,-1.68469,-0.278629,-0.694935,-0.891837,1.23651,-0.21345,-0.305015,-0.0987808,0.160233,4.91775,0.166271,3.92353,-3.88399,-2.55526,0.198425,-0.923912,-1.86728,-0.552523,1.22445,1.15572 10221,10137.3,9258.6,-1.56339,-0.256664,0.840544,-1.61826,11.0061,14.4706,-2.59098,0.449882,-1.65171,-1.89163,-1.35949,-1.40198,3.60618,0.270121,-1.02351,-1.1912,0.778059,-0.110922,0.867721,2.27546,-5.20223,-2.14642,1.17716,-1.36266,-2.51971,-1.10085,2.42789,2.32548 10222.9,10141.6,9264.61,-4.74868,-0.212232,1.05283,-1.29221,10.744,4.75459,-2.81401,0.644295,0.850172,0.179994,-3.01777,-4.30435,2.71079,-1.12735,-1.29174,-2.07496,1.34575,1.0376,2.5823,1.95702,-4.5778,-1.28586,-0.494008,-4.39926,-5.46478,-2.40477,1.70545,-0.546783 10222.5,10148.7,9269.02,-3.49502,-0.678579,-0.213247,8.06515,8.4472,0.736921,12.8231,-0.680516,1.09355,1.44143,-3.62765,-2.08929,0.194595,-2.35671,-0.392866,-2.86869,-0.655593,6.76095,0.52286,-1.94996,-0.69629,-1.94695,-3.05311,-3.36287,-5.8798,-2.04553,-0.962602,-2.08692 10226.3,10155.2,9271.48,-1.96969,-0.131236,-7.34816,10.3469,1.43629,-18.1274,6.28789,-1.94889,-4.21799,9.10578,-0.96868,-0.513386,-5.07894,-4.75252,3.07715,-1.21549,-4.62974,12.6049,-2.11208,-4.5134,4.07597,-2.26695,-5.31607,-0.080814,-4.75562,0.0499323,-2.60796,-2.05158 10230.1,10151.7,9270.27,-0.441668,1.99564,-2.24149,10.4542,-4.09391,-6.45561,-1.77752,0.712394,-1.02642,8.25875,2.54249,4.31177,-1.67116,1.28898,3.90167,2.27301,-0.292013,13.1856,-3.31394,-4.23242,0.509949,-0.582218,-1.55254,1.54596,0.383257,3.15094,0.659781,3.83919 10224.9,10138.7,9266.49,4.67287,5.1299,-1.26323,13.4301,-10.2745,-9.49416,-12.2719,-1.18436,-2.87586,6.16837,2.83569,6.07774,-2.8315,2.00898,6.40272,2.01559,-1.86315,15.8694,-4.72684,-3.25468,-2.65905,-3.311,-6.24296,-4.21139,-3.70695,4.80612,0.395122,1.76566 10212.8,10131.4,9265.67,3.01888,4.86272,2.80549,9.41976,5.08199,16.7307,3.01517,-1.39232,-0.901598,-3.17761,2.70511,2.89126,0.206015,2.09237,1.79821,0.427067,-0.286912,4.97158,1.88506,1.52106,-4.78901,-3.10639,-5.19696,-1.88352,-1.17405,1.76068,1.66502,-0.462334 10205.3,10137.3,9271.29,5.0191,6.44861,-1.029,10.2232,1.46143,6.79866,-7.1328,-3.52906,-8.32347,-3.93806,2.03961,4.301,-3.73195,-3.92217,6.44854,2.90593,-2.49697,11.4551,-0.562561,1.57056,0.711111,-0.350636,-4.25263,3.76126,3.75639,3.70316,-1.79131,-3.47622 10205.7,10147.7,9278.59,5.83546,6.36501,-0.202118,7.16455,-12.9828,-12.4607,-27.3389,-3.33415,-9.60681,-6.26496,-0.539386,6.78879,-3.91681,-6.10831,9.8609,6.12423,0.502419,17.71,-2.72276,0.90307,5.89102,4.35576,1.47131,6.87862,9.08531,6.44279,-3.45175,-1.92878 10205.4,10153.7,9279.43,2.61204,3.79426,2.8599,4.2373,-6.30104,-6.55433,-17.9117,-2.30217,-4.33352,-8.56342,-2.54108,4.06241,-0.221565,-2.25183,3.87958,2.42384,1.7425,10.0636,-0.274803,1.38918,2.9688,2.49859,1.85002,3.57782,5.56749,4.25356,-1.57246,0.769565 10198.3,10155.2,9271.53,1.79363,-0.436721,3.46418,1.17919,-6.21503,-12.0337,-14.7144,-0.753172,-0.422946,-10.0673,-1.05729,0.16841,0.00393219,0.329848,3.06417,0.641188,1.13987,4.50086,-1.96838,-0.158451,2.22687,1.01485,-0.617827,-1.82684,0.837829,1.35672,-0.969077,2.83866 10187,10154.7,9258.9,0.357944,-3.85399,-0.403587,-0.905802,-6.94279,-16.6984,-17.7781,-0.22625,-1.87358,-4.80273,-0.208291,-3.41762,-1.38116,-0.435891,4.56144,1.47257,0.881539,4.31043,-2.35524,-0.63135,2.49929,2.73787,-0.3439,-0.967951,0.479767,-1.25236,-0.198644,2.70849 10175.5,10150.8,9245.55,-2.22289,-4.64417,-1.57873,-3.37822,-3.35046,-9.88201,-14.3071,0.168661,-0.756661,-2.69992,-1.57269,-4.61371,-0.741804,-0.794809,1.95045,1.34471,1.90438,0.670421,-1.36383,-0.0207592,1.95603,4.44548,1.70081,0.896225,1.96219,-2.68814,1.37985,1.21966 10163.9,10144.5,9233.39,-1.0609,-3.6573,-1.22008,-1.66234,-8.72059,-9.8591,-9.71449,-0.237702,2.4907,-0.383432,-2.45784,-2.52105,-0.451308,-0.95008,0.101755,0.998499,0.0147502,0.763548,-2.08901,-0.286814,2.08671,3.24587,1.98374,-1.03823,1.41551,-1.64013,0.866956,-0.452541 10152.5,10140.9,9224.11,1.58528,-1.3177,-2.21666,-0.770113,-12.1162,-14.2306,-0.877621,-0.372338,1.62768,2.76293,-0.69447,0.389726,-2.24466,-0.492948,-1.07534,1.2119,-2.84085,1.62365,-4.58137,-3.47859,2.38127,-0.58689,-1.20067,-5.12188,-1.38938,0.191315,-1.00868,-0.231626 10144.9,10141,9218.45,2.9188,-0.174985,-4.58083,-6.94645,-12.0718,-23.1781,-6.27315,-0.364715,-3.24703,1.70145,0.993811,-0.598274,-3.56103,-0.759525,0.496704,2.46032,-1.89983,0.597576,-2.01394,-2.93857,4.73883,-0.682548,-1.34504,-3.70636,-1.23983,0.0550942,-2.01066,1.58053 10141.8,10139.7,9215.32,1.06474,0.421951,-5.29652,-9.2234,8.36446,-5.7284,0.960531,-0.909556,-4.90704,0.770291,1.54135,-5.62095,-2.20122,-1.09503,-2.35206,-0.974175,-1.0101,-7.23319,3.01594,0.768168,2.39478,-1.32615,-1.6404,1.53725,-1.51813,-3.97654,-1.7665,0.833795 10141.4,10134.3,9214.23,0.86273,1.35397,-0.657898,-4.72598,2.71892,1.93911,-8.71178,0.127278,0.812447,5.14689,3.34014,-5.47575,-0.124804,-2.70815,-0.541837,-0.600256,1.53834,-3.53843,0.0605411,2.43643,0.689316,0.936364,1.45495,3.58725,0.917646,-4.12549,-2.16127,-1.91164 10145.6,10128.8,9217.09,0.035273,1.26692,3.11502,-4.96307,-6.78084,1.02172,-8.79811,2.69846,4.94751,11.3598,6.51275,-2.0705,0.657905,-2.59061,-0.35795,1.18908,3.42851,-3.05799,-3.41004,0.806424,0.399374,2.92706,4.4301,0.273598,0.553543,-1.76552,-0.755718,-3.46001 10157.5,10128.8,9225.31,0.248702,0.312336,2.57768,-4.36878,-7.1619,-0.049009,-3.2758,2.7151,1.99544,11.1247,7.80862,3.2311,1.05086,1.13953,0.117826,1.5885,2.6575,-2.74279,-2.82058,-0.206648,1.25493,1.71967,2.81266,-4.13773,-2.45207,2.50385,0.789243,-0.268176 10170.7,10133.1,9236.11,-2.23675,-0.885477,2.34602,-6.30375,3.19378,12.3402,5.26964,2.51006,1.86666,4.33237,6.63528,4.85198,3.48519,8.46812,-2.52066,-0.634166,3.57125,-6.40349,1.46869,0.818123,-1.68738,1.2743,1.91738,-0.951766,-0.403311,4.63843,3.18061,7.04436 10176.7,10136.2,9243.78,0.782244,0.338989,-0.179665,0.677035,-11.8864,-9.98092,-16.6014,-0.0876104,-1.39338,0.511794,2.05749,5.37285,2.64871,7.7119,4.8232,-1.23349,2.56586,8.98335,0.643413,1.73431,-0.63479,2.49537,-0.600719,2.26345,1.69812,6.71431,2.31721,8.10433 10176.8,10136.6,9245.84,-3.20567,1.13405,3.92668,-1.78597,-0.236073,-2.19382,-11.4115,3.08973,1.33702,-3.27145,0.727769,-0.100717,5.38921,8.19297,0.492232,-2.20151,5.25989,3.6589,4.08819,2.21554,-1.32513,3.54291,0.119275,3.23854,3.862,2.19948,5.28701,6.25834 10178.4,10137.4,9245.74,-5.53585,0.420645,5.85295,-4.47724,14.54,12.4497,8.36972,4.99424,2.57479,-4.3639,0.677018,-2.6813,6.67898,7.5884,-5.54187,-1.3688,4.05586,-6.15054,4.2909,-0.899213,-1.24567,1.90686,-0.469126,1.72139,5.00978,-1.65339,6.96518,3.71489 10184.8,10141.1,9247.89,-4.95644,-1.91401,3.7243,-7.95873,7.49028,6.40526,5.31843,3.53676,4.4376,-3.95261,0.746514,-2.92295,5.17495,5.09822,-5.56387,2.13589,1.74219,-7.51099,1.13636,-2.24892,-0.712168,1.40767,0.401594,-0.663717,6.22808,-1.51586,5.59537,1.86444 10195.1,10147.9,9253.27,-3.98,-3.06823,-2.05534,-6.10099,3.83685,4.55708,3.92119,0.928846,2.49159,0.0763172,1.14792,-2.88509,3.3624,3.14131,-4.76678,1.53759,-2.49281,-5.00974,0.3227,-1.57677,-2.36177,0.558465,1.76223,-0.153596,3.21585,-0.248642,3.44061,1.09292 10206.6,10155.3,9259.98,-4.64998,-1.64546,-4.6585,-6.92405,-1.23826,-1.4651,-7.80907,2.03872,0.322905,5.35637,2.9557,-1.90346,0.941137,2.90995,-2.25745,1.6362,-2.73525,-3.06893,0.361893,-0.410406,-1.95298,3.18373,4.96997,3.18307,2.09522,2.29277,1.29516,1.46329 10215.1,10159.8,9265.65,-5.64262,-2.22323,-2.32616,-8.62966,1.24852,3.53986,-7.11813,2.5704,-0.221435,0.41167,0.765415,-1.44792,2.10023,1.14341,-1.90736,0.761342,-0.0657556,-6.90094,4.60419,2.00852,-1.1143,4.44335,7.23913,4.6059,2.18355,1.92624,1.0442,1.06642 10218.9,10161,9269.98,-5.54728,-2.69742,0.623383,-4.54971,5.62832,12.115,1.60837,0.527375,0.225195,-4.35554,-1.09064,-1.69716,2.68584,-2.42078,-3.28377,-0.48855,1.46337,-7.59929,7.41232,3.78152,-1.52786,1.12019,5.14455,0.902689,0.791392,0.171231,1.01653,-2.1951 10225.1,10161.4,9274.87,-4.18459,-1.40959,4.0543,-3.78563,4.56469,13.1486,7.4468,1.32559,4.01602,-4.26528,2.47676,-0.706977,1.49841,-2.44619,-4.48237,0.314642,3.21848,-7.78537,6.45365,2.67192,-0.518631,-0.579868,3.1551,-3.30298,0.42352,0.385421,1.09082,-3.38628 10238.6,10163.7,9281.72,0.163978,0.29531,1.39945,-1.88245,0.770367,3.01996,6.47156,0.843119,3.05229,-2.89342,3.69162,1.01002,0.156961,-1.63668,-1.88068,0.459627,0.572044,-3.8789,6.07964,1.73877,1.04155,-0.952277,-0.352698,-3.89818,-1.13337,1.63306,0.655322,-3.05775 10252.3,10168.8,9289.58,1.69242,0.803041,0.969081,-1.57571,10.1963,10.1486,9.01137,-0.23779,2.45598,-11.8335,0.764195,0.347471,0.63322,0.818036,-2.67947,-0.48707,-0.0121974,-5.92175,4.75178,1.31186,-0.59319,-0.865273,-2.13114,-0.629395,-0.22624,0.187864,0.687159,-1.38416 10258.4,10175.1,9296.44,0.693656,-1.47018,1.57507,-4.07861,13.9151,7.913,3.87705,-2.41045,1.40643,-18.8401,-3.38044,-3.78137,0.444306,-0.142111,-3.19856,-0.633983,1.26609,-6.96487,4.03731,1.86282,-0.255938,0.885239,0.576534,4.16798,1.48633,-2.91027,0.44246,-1.26861 10259.2,10179.7,9301.13,-1.11281,-2.9356,3.48279,-4.07376,14.5961,4.75668,2.95063,-2.50321,1.99968,-15.2573,-3.94817,-6.19421,0.994523,-0.409685,-3.36826,-1.30752,2.89435,-7.11783,2.3961,1.75016,-0.287404,0.839505,2.32354,3.16514,0.431073,-4.23834,0.224613,-1.13459 10258.9,10180.8,9303.2,-3.70956,-2.93593,3.76222,-6.98265,14.1006,4.36509,3.13521,0.524873,3.4745,-8.19672,-0.812591,-7.54285,2.87285,0.165482,-4.34303,-3.00502,3.10194,-11.8146,3.48326,1.87454,-2.39007,-1.71717,-0.0308325,-3.00344,-3.10099,-5.07511,0.999296,-0.291248 10259.7,10178.9,9302.61,-2.50722,-0.863499,1.6361,-7.29671,5.65875,7.35687,6.74534,2.86707,2.5541,-4.10002,1.92641,-4.21325,3.79643,1.11564,-2.85299,-3.384,0.718232,-13.5344,2.15514,-0.378278,-3.09826,-4.48668,-4.09564,-6.07121,-4.62941,-4.63714,1.35609,1.33932 10264.3,10176.2,9300.58,-1.50986,-0.476834,0.153861,-9.03392,2.34462,9.76008,11.2624,0.958254,-0.70443,-6.3101,0.886002,-3.04957,4.20237,0.687347,-2.59931,-4.30057,-0.344332,-15.3463,3.30618,0.212706,-1.83037,-5.39362,-6.37009,-5.79293,-5.6463,-5.17005,1.45394,1.2199 10270.2,10175.5,9299.06,-1.8193,-1.62584,1.49621,-15.2891,-0.19176,0.694336,7.97111,-0.906134,-1.88497,-6.47048,-0.900237,-3.70282,1.23614,0.322582,-3.93212,-3.45866,1.71962,-16.8955,0.58688,-0.409914,-0.259588,-2.68512,-3.64588,-3.35838,-4.51583,-4.19392,0.240148,0.159851 10270.2,10179.6,9298.63,-1.90388,-3.42457,3.36972,-15.5947,6.83754,-2.72512,7.96959,-1.26132,-2.35887,-7.13988,-3.00989,-4.84946,-1.32472,-2.90407,-7.21556,-3.99747,1.63284,-18.121,1.49353,-0.486008,-0.289734,-2.44221,-2.61409,-4.74746,-6.81336,-4.22186,-0.397997,-3.01155 10263.1,10186.3,9296.94,0.1046,-2.95923,0.55802,-3.53552,11.956,6.06043,20.0157,-0.175478,-1.81809,-1.77528,-2.10279,-0.283075,-3.48288,-4.09089,-6.41457,-3.4926,-1.98205,-11.2644,1.51324,-2.56718,2.01317,-3.17178,-3.03644,-4.28621,-6.82533,-2.57386,-0.732198,-4.52782 10250.3,10186.7,9289.82,0.787893,-2.63004,-4.83671,4.59987,9.90165,5.11396,20.1712,-1.49013,-0.900383,3.2704,-1.38302,1.01612,-3.51797,-3.65748,-2.01906,-2.31487,-4.58178,-0.663723,4.99631,0.0846666,6.20019,-1.32911,-0.366123,-0.708005,-3.05462,-1.4169,-1.33549,-4.03837 10229.6,10174.2,9276.51,2.92922,1.43172,-8.45959,7.92191,9.82817,0.906035,15.1761,-5.66535,-4.80598,8.92318,-1.50732,0.863702,-4.19618,-1.72605,1.43049,-1.60336,-7.78679,7.9456,2.20311,0.976306,4.6808,-2.0774,-1.41618,1.52784,-1.00485,0.251303,-2.51818,-3.24837 10203.9,10154.8,9263.01,1.97737,4.88419,1.86761,-1.89071,16.8831,21.8027,18.6752,-2.85592,-0.407409,1.1857,1.57668,2.90834,1.42619,5.01683,-2.88862,1.13125,-1.02838,-3.77013,-1.83294,-0.874118,-1.82318,-1.06152,0.617181,1.34269,3.38069,1.15764,1.12216,1.38647 10184.5,10141.2,9256.68,5.24597,7.64832,2.18557,1.58328,4.92602,9.28816,-0.0172234,-2.70209,-2.36954,2.63625,2.45988,6.65341,1.30855,2.45772,0.884071,4.15289,-0.306199,0.501745,-3.91598,-0.843063,-3.78083,-0.751671,-0.908618,-0.353576,1.46737,4.59599,1.10914,-1.05414 10178.9,10140.4,9258.57,8.5511,8.38576,-0.704081,10.0442,3.87995,9.53107,4.06474,-2.33977,-3.33414,3.45052,0.769206,8.44243,0.151836,-0.110094,2.50423,3.89258,-1.86971,4.86933,-2.34618,0.208276,-3.54318,-0.382483,-0.444637,3.17545,1.86638,6.31308,-0.0788599,-2.11239 10182.7,10148,9263.52,7.664,6.75263,-0.540997,5.42972,-5.04193,-7.98425,-8.29464,-0.166299,-0.588527,3.31557,0.500806,4.72146,-2.51571,-1.43305,5.52369,5.671,1.03703,8.03067,0.0463032,4.16527,0.993743,2.27,2.01907,5.48701,6.28587,6.50446,-0.915646,-0.555951 10185.6,10156.6,9266.64,4.26252,2.60407,3.65205,1.35764,1.93964,-1.71464,3.62386,0.664968,2.07164,-1.84774,-1.41728,2.03742,-1.93901,-0.955849,2.55509,2.24827,3.4143,2.08534,1.52467,4.36357,2.40504,-0.149419,1.87333,2.56701,3.76988,3.58853,-0.290298,1.53656 10182.8,10164.1,9266.99,3.44774,1.00051,3.58435,5.06036,-3.20427,-1.32409,2.16178,-1.24869,0.986594,2.68824,-3.10496,3.75494,-3.03899,-1.36189,2.85639,-0.797041,2.25309,6.84226,-1.01807,1.45026,1.64915,-1.77668,1.47461,1.32051,0.0174875,3.15498,-1.91103,0.915561 10177.6,10169.5,9265.47,2.97062,0.742454,2.19308,3.39405,-10.2555,-6.11354,-8.35604,-2.29312,-0.492631,4.2024,-2.46282,2.85236,-2.05854,-1.07623,3.34902,-1.67951,1.43015,9.72371,1.0556,1.2093,0.0329592,0.933345,2.62882,4.14907,1.43657,2.25242,-2.21302,0.424466 10175.1,10171.1,9262.53,2.78573,0.66686,2.0545,2.76769,-2.38316,1.38611,1.33538,-1.98843,-1.22362,0.719734,-1.48276,0.571928,-0.303568,1.13172,0.533248,-2.57485,0.218063,4.75694,4.12677,1.25451,-2.29974,1.77459,2.18864,5.66448,2.31972,-0.197648,-0.423422,1.24127 10176.1,10170.7,9258.49,5.31438,0.737423,2.23937,7.15555,-6.03862,-6.93885,2.59027,-2.08985,-1.82474,1.76361,-1.51506,2.40133,-2.94977,1.13326,2.34185,-1.4691,-0.319475,6.55378,0.151184,-0.820336,-1.03183,0.737373,1.0173,1.60097,0.120988,0.706961,-1.06361,1.61191 10177.1,10171.1,9253.43,5.27989,0.124242,0.594136,6.40228,-14.4792,-17.9873,-7.83873,-2.70593,-2.84279,6.19952,-1.02819,4.22035,-3.89328,-0.655654,4.6427,-0.543649,-0.312946,7.67303,-3.34568,-2.99026,0.892734,0.193866,0.437901,-1.37172,-2.06494,3.10779,-2.09072,0.969194 10175,10171.9,9247.28,2.27598,-1.11333,-0.371999,2.70022,-5.44405,-1.24932,2.95574,-2.54561,-3.07604,2.81372,-0.48024,4.11824,2.04907,-0.370621,1.24343,-2.71039,-1.27809,-0.906837,-1.29061,-4.80376,-0.177684,-0.68347,-0.0356975,0.976652,-2.58184,2.60538,-0.53245,1.0079 10170.6,10171.1,9240.98,0.484599,0.0646839,-1.51326,2.89899,-3.4319,-0.213982,2.47953,-0.834731,-2.00581,5.72898,0.227883,2.67222,2.27602,0.0505934,1.31844,-2.26552,-2.6972,-0.975391,-0.869576,-3.70984,-1.26158,-0.292123,-0.590846,2.58737,-1.84822,1.62378,-0.526111,-0.491878 10166.9,10167.6,9236.09,0.964725,-0.0392702,-0.079079,4.19696,-8.77705,-7.3393,-5.33084,1.7816,1.00552,6.00308,-0.645333,1.80016,-0.345783,0.537513,3.29513,-0.258503,-1.94323,3.02276,-2.07851,-0.708951,-0.985472,0.42465,-0.0047685,-0.0149723,-1.37113,0.550535,-0.779034,-0.484969 10166.1,10161.5,9233.6,-0.598547,-1.76595,-1.06041,-0.952044,-3.22733,-6.25839,-1.71002,3.5389,3.14678,2.52469,-0.94774,-0.697306,-1.82073,1.8162,-0.398189,-0.0962201,-1.17773,-3.11075,-1.86249,-0.148137,-0.912351,0.0729367,0.372787,-1.52491,-1.99794,-1.67208,0.753712,1.02245 10167.9,10154.5,9233.85,1.32924,-0.579085,-4.09528,3.27081,-6.78357,-9.38603,-3.06915,1.95927,0.70163,2.46784,-0.635142,0.854662,-1.03664,2.44479,0.381434,0.976493,-2.1874,1.35415,-3.25712,-1.85514,0.202589,0.286026,0.720155,0.627719,-0.687001,-0.872865,1.21871,2.25385 10170.4,10147.3,9236.23,1.55419,0.655793,-3.90119,3.65032,-6.92144,-3.81534,-0.829364,1.59907,-0.150104,0.588015,0.212751,1.04803,3.09472,3.79829,-0.218751,1.11779,-1.55055,0.933332,-1.25266,-2.59487,0.647035,1.39731,2.58953,2.8589,1.80309,-1.43261,2.52993,2.79953 10171.9,10139.7,9239.22,2.16966,0.513128,-2.93705,2.73804,-10.8601,-4.50483,3.76187,1.03924,-0.676839,-1.4866,-1.19577,1.6866,5.98311,3.12642,0.0885709,0.9896,-0.594518,0.533618,0.379411,-3.82145,2.32664,2.22298,3.60721,3.05218,2.2889,-1.98702,2.79897,1.35025 10172.4,10133.5,9242.05,0.627291,0.905709,1.39363,2.99372,-15.425,-9.09382,2.11414,1.04226,2.10526,-4.39506,-2.77953,2.15891,6.66724,1.70369,-0.372333,1.40462,2.59187,2.26874,-0.378224,-3.69675,3.0335,2.25396,3.10192,0.0429504,0.10951,-0.799702,2.66794,-0.282681 10173.8,10130.2,9245.36,-1.33644,1.42161,3.11004,3.93858,-17.0646,-12.116,1.67239,1.94826,5.54306,-3.85205,-1.5475,2.52019,4.33814,1.15019,-0.541069,1.99129,3.05378,4.25369,-2.76731,-2.80645,1.85733,0.988299,2.88783,-1.97077,-2.83768,1.85125,2.84766,0.389147 10176.4,10130.9,9250,-3.53503,0.391503,-0.270572,1.95882,-15.1875,-18.5758,-1.42497,2.28845,5.40786,-2.12974,1.20821,0.911564,0.2788,0.0689856,-0.00271805,2.01928,-0.20812,3.23848,-1.98612,0.0245125,0.488358,-1.18054,1.47019,-3.47437,-4.6287,2.11498,2.20934,0.993318 10178.8,10135.9,9255.56,-3.20255,-0.268054,-3.48033,2.47099,-11.3536,-16.9308,2.01776,1.40976,1.56328,0.853625,1.89586,1.47109,-1.50849,0.167668,0.627511,1.41809,-4.21425,2.05546,-2.39209,-0.416193,0.276633,-1.50971,-0.820011,-1.25927,-1.76,0.153711,0.431209,1.48315 10181.2,10144.1,9260.31,-2.49125,-0.613263,-3.86482,0.287362,-9.17309,-14.1157,3.48478,0.196793,-1.25386,2.83848,0.198147,-0.0165582,0.471677,-0.139327,-0.216901,-0.966032,-5.2193,-1.40546,-0.977273,-1.2574,1.78779,0.134179,-1.72164,0.653388,0.313432,-3.37716,-0.587605,0.861387 10186.6,10151.1,9263.12,-0.0358474,0.714951,-5.47328,-0.875177,-17.5089,-13.8361,0.471247,0.643912,-2.41975,9.9458,0.993041,0.803296,-0.226386,0.0668295,2.19176,-1.16819,-4.40868,0.69383,-3.38706,-3.58218,3.07732,2.10253,1.79789,2.06744,1.83904,-2.15516,-1.67344,0.661882 10193.4,10152.2,9264.85,-2.78688,1.85556,-1.96216,-7.27433,-5.61022,0.625161,3.91544,2.78407,0.13042,8.01854,3.573,-2.43853,-1.07905,0.148792,-1.48277,-2.3792,0.378784,-7.05144,-1.06108,-1.76148,0.135824,1.71393,3.80312,-1.43656,0.702495,-1.95731,-0.703674,-0.33177 10196.9,10148.7,9267.46,1.41437,4.41491,0.0330121,-0.96198,-19.7539,-11.561,-5.49424,1.03618,-0.588315,13.1158,4.11913,1.82776,-4.02743,-1.24038,4.49417,2.16391,1.61464,5.33203,-6.2827,-3.22771,2.42673,4.53812,5.27571,1.95384,4.83592,2.15944,-2.23414,-0.0179182 10195.1,10146.6,9271.67,-0.599083,4.08109,5.56207,-0.651956,-1.899,4.41751,8.64946,-0.00765143,1.65381,7.40697,3.13743,0.528221,-1.17274,-0.333192,-1.34405,0.810869,3.04978,-1.96585,-3.00608,-1.02587,-0.427114,2.63482,2.33223,1.44749,2.70602,-0.508442,-0.782524,0.838544 10190.6,10149.1,9275.95,0.560997,3.32623,0.00253245,1.6273,-9.62681,-9.32197,-7.13248,-1.74244,-2.26773,10.279,2.01853,1.79006,-2.32577,-1.861,2.70102,2.63733,-0.668516,4.89049,-2.56801,1.67809,-0.682542,1.07859,-0.730879,1.04436,0.219305,1.04839,-1.30085,-0.204558 10188,10153.1,9277.72,-1.05102,1.4439,-1.2902,0.37219,3.61058,7.8905,-0.13638,-0.797121,-3.203,3.7144,-0.467361,1.43319,1.01941,-0.964803,1.27849,1.32106,-0.71757,-0.281666,1.82319,4.43107,-2.93419,-0.102775,-2.79816,1.60946,-0.350934,0.837113,0.975085,-0.206216 10189.3,10155.8,9275.17,1.71247,1.79065,-0.806826,4.2591,-1.07113,5.08033,-3.80833,-1.05846,-3.93516,4.86697,-2.48519,4.41458,1.0147,-2.04319,5.76698,3.04901,0.621182,6.18537,-0.471514,3.74338,0.0954557,1.78055,-2.23478,4.29533,3.28968,4.08665,-0.45381,-1.12752 10190.8,10155.9,9267.91,0.0885688,1.62773,3.97676,0.475719,6.50171,12.0036,4.17355,0.0800788,0.877184,4.13283,-1.66529,2.3731,1.22312,-1.52431,1.32333,1.30085,4.02821,0.00402446,-0.278254,3.83144,-0.00616006,1.70507,0.14686,2.05675,3.75234,3.42709,-1.13997,-2.28219 10186.5,10152.6,9257.34,-0.152071,1.1051,2.98089,-3.26014,-3.23874,0.545145,-3.74253,0.650653,4.32612,4.55661,-0.349067,0.443991,-1.54712,-2.37082,1.08068,1.11666,3.19332,0.114235,-4.77887,1.03262,0.526047,1.57427,1.96416,-1.21359,2.2522,2.81775,-2.19914,-3.20958 10175.9,10146,9246.33,-2.37365,-0.801223,1.8448,-4.49245,2.73452,3.45587,0.665856,0.804743,7.15539,-1.25789,-1.25952,-2.70716,-1.07845,-2.04441,-1.93328,-1.35806,1.5978,-5.1161,-5.79834,-0.925826,-2.80177,-1.15512,-1.39234,-4.88988,-2.71874,-0.727928,-1.17586,-2.55528 10163.6,10137.3,9237.87,-0.803469,-2.78044,-0.895544,-1.96323,-0.541223,-3.95959,-1.23923,0.0489646,5.82687,-0.842944,-2.20839,-1.37161,-0.868195,-0.366623,-0.326653,-0.542204,-0.442138,-3.06811,-5.05951,-1.77693,-2.56412,-2.0747,-5.18551,-5.90628,-3.59607,-1.51359,-1.0358,-0.0442413 10154.4,10129.1,9233.99,1.23915,-3.76005,-2.64612,0.723829,-3.148,-4.96491,0.57486,-0.202117,2.21428,-0.386009,-2.61213,0.591537,-0.420445,2.51457,0.848114,0.0155665,-2.8099,-0.688955,-1.65728,-1.68576,-0.314736,-2.37588,-7.30164,-5.93878,-1.09582,-1.08092,-1.23666,3.04974 10147.7,10124.3,9234.84,0.130569,-3.33534,-5.30783,0.228073,-1.79103,-2.90284,1.72325,0.336059,-1.67646,0.805152,-2.51359,-1.68843,-1.08056,2.79024,0.667811,-0.918425,-5.25023,-0.613583,-1.21144,-3.86108,1.12026,-2.87087,-6.96217,-3.74878,-0.871173,-1.99148,-1.4983,3.13726 10141.9,10125,9238.34,-2.3342,-3.74514,-6.28736,0.247636,2.71253,3.12847,7.57994,-0.0401623,-2.07147,0.481455,-3.97685,-4.46362,-0.415913,1.42821,-0.575486,-2.68041,-4.57327,-2.24353,-2.60028,-5.84863,0.625916,-3.42977,-3.6369,-0.844099,-3.5874,-4.64335,-0.985747,1.2717 10139.9,10130.2,9242.19,-1.31024,-4.72475,-7.14762,0.73153,1.45053,-5.53508,5.90136,-2.31863,0.194991,0.488804,-6.97821,-4.41928,-2.29074,-1.35009,0.919216,-2.89533,-3.25509,-0.799203,-1.99553,-4.14064,2.04707,-1.98553,-0.137078,-0.0166083,-4.9352,-5.40326,-1.67739,-1.42035 10146.2,10135.6,9246.04,1.48702,-3.36982,-6.22071,1.74719,2.56435,-13.0074,1.99705,-3.21561,2.91416,0.844878,-6.7988,-2.16439,-5.4962,-1.85975,2.13575,-1.59383,-2.91884,1.52462,-1.3314,-1.85117,3.6544,-0.430522,0.692754,-0.840642,-3.31251,-2.33908,-3.05762,-2.1983 10158.1,10136.1,9250.8,0.841737,-2.49661,-1.39476,-1.47649,15.6927,0.965199,10.869,-0.546861,4.02682,-3.15137,-2.65822,-1.05518,-4.77058,0.229656,-2.58261,-1.60934,-0.689737,-5.44364,-0.234473,-1.95479,2.60062,-0.769404,0.484685,-2.21476,-2.21659,-0.527818,-2.3356,-0.631119 10167.2,10131.4,9256.17,1.43756,-1.64599,0.0828565,1.10643,1.09851,-8.71597,-1.14743,1.16785,1.24835,1.69522,0.678389,1.91657,-5.73395,-1.26925,0.618759,0.671225,0.99422,2.5392,-3.14056,-3.00047,3.39733,-0.267724,0.865602,-1.72338,-1.28093,1.59131,-3.58079,-1.60917 10168.5,10125.9,9259.95,0.111755,-1.49369,1.18289,-0.284048,-1.52165,-7.82514,1.91577,2.83987,1.30957,4.34859,2.31828,0.547347,-5.35341,-2.95714,0.120479,-0.07344,1.25038,0.863374,-1.97606,-2.63292,2.99367,-1.51317,-0.192761,-1.94301,-2.34527,-0.816782,-4.15688,-3.69083 10164.7,10123.5,9260.03,2.54631,0.123647,1.85441,0.291179,-2.26534,-5.622,0.403256,2.75151,1.92159,5.45502,4.02912,0.277333,-3.49437,-2.59529,1.68451,1.03176,0.611114,1.05444,-1.37086,-0.762577,2.09659,-3.15435,-1.66892,-4.18628,-2.03484,-0.59484,-4.5361,-4.06338 10160.7,10123.9,9256.02,4.16394,1.15842,1.00215,-1.41089,3.00077,3.69915,2.12147,1.50602,1.11373,3.7783,5.12886,1.27055,-1.0735,0.163066,0.715848,1.75274,0.248762,-1.87449,-2.70607,-0.0821427,-0.982237,-3.91753,-0.603176,-5.15131,-1.55797,1.9122,-2.63806,-2.45448 10157.6,10124.8,9249.1,1.13904,0.752742,1.28292,-3.44794,5.87463,13.5955,-3.90547,0.053564,0.392376,-2.17549,4.02652,0.800942,2.14933,0.991305,-1.00534,1.93346,1.74799,-4.3887,-2.62983,2.12002,-3.97726,-2.37985,1.92724,-3.91126,-1.80145,3.29901,0.515867,-2.07875 10155.9,10125.9,9241.01,-1.21278,1.24353,0.0902419,-1.38693,3.90257,17.0687,-1.7671,-0.621263,-0.743581,-3.56603,3.19768,0.515647,2.83626,-0.394058,-0.965446,2.53295,1.02968,-3.73706,-0.646373,4.19926,-3.90665,0.100245,2.07717,0.65145,-0.4389,3.45695,1.30478,-2.26372 10156.9,10129,9233.19,-0.519545,3.45514,-0.128203,0.470911,-4.34917,11.6069,-5.37302,-0.249794,0.0908138,-1.64961,3.7305,0.887725,1.28233,-0.50548,0.651175,4.68216,0.481759,0.131141,2.83721,7.4517,-1.51906,2.02591,0.478488,2.8447,3.96564,4.21205,0.0189546,-1.26083 10160.2,10134.9,9226.61,0.334619,3.63902,-1.33005,0.500933,-0.0390483,15.3466,3.49804,-1.22599,-0.443012,-1.29729,1.85728,0.83413,0.663791,1.08815,-1.61332,2.35978,-1.91003,-1.54128,7.06018,8.52392,-0.0931056,-0.631766,-1.8937,1.21041,3.92464,3.0125,0.582016,-0.0552563 10165.1,10142,9222.12,-0.0501124,2.72845,-2.35233,0.461804,-3.24106,3.89637,-4.4752,-1.7395,-0.658087,1.46568,0.74815,1.9358,-1.37579,1.26993,0.248403,2.1501,-1.97865,2.84403,4.93078,6.34449,2.55208,-1.66616,-1.28941,-0.85475,2.44335,3.28626,0.575625,0.0867697 10169,10147.2,9219.92,-2.57524,1.55278,1.64717,-0.408592,2.78686,3.93608,-3.35557,-1.05071,0.358949,-1.71793,1.23509,0.730307,-0.807758,0.469476,-0.799756,2.26666,1.42763,2.57756,3.31921,4.24278,2.32673,-1.92157,-0.625841,-1.7385,0.55312,2.469,0.416022,0.102824 10167.7,10149.8,9219.39,-2.61236,0.265041,4.14099,-1.10443,5.68968,5.75872,0.437178,-1.27371,-1.44794,-5.50529,0.962099,-1.7594,-0.014506,-1.47838,-2.10998,2.88166,2.32266,2.31558,3.04189,2.76494,1.13588,-2.76241,-2.5749,-1.37983,-0.132212,1.62609,0.00182996,-0.567092 10161.2,10151.5,9219.88,-1.00231,0.225002,2.94421,2.03312,-0.355979,4.16591,-0.636307,-0.980578,-3.17075,-4.4683,-0.0413473,-0.96548,-0.194949,-0.798368,-1.08568,3.94015,1.20872,6.21739,0.493017,0.663456,-1.20346,-2.76074,-4.99576,-0.484664,1.27829,1.87168,-0.0347963,-0.649195 10155.5,10153.9,9220.83,-0.939771,0.647249,0.0634509,3.2582,-1.62031,4.0693,-0.997477,-0.169163,-4.01209,-4.20755,-1.14083,-0.040949,0.676499,1.0769,-0.637069,2.85891,0.53402,4.18699,0.666861,0.369829,-2.63692,-0.336214,-3.73798,1.47577,2.81105,-0.292838,0.0270106,-0.151526 10154.1,10157.5,9221.67,-1.65802,1.59847,-3.57612,1.52401,6.37221,4.48866,-1.46299,-0.915699,-6.98915,-0.340048,-0.952717,-2.18866,-0.811792,-0.642645,-0.622625,-0.300884,-1.00057,-1.15759,2.44751,2.6773,-1.823,1.29837,-1.91591,2.49204,1.93197,-3.59974,-1.91245,-2.4109 10154.4,10160.7,9221.98,-0.583463,-0.108757,-4.6507,-0.0693877,5.35637,4.425,-6.56889,-1.82597,-8.57191,2.85503,-1.05825,-2.33955,-3.22781,-4.76081,2.05753,-0.861931,-1.83229,-0.124382,0.503483,2.18131,1.30665,2.42826,0.824233,3.84653,2.09007,-3.3925,-4.31649,-3.96112 10153.4,10159.2,9221.68,-2.76485,-4.09131,-2.87698,-1.10712,12.5336,12.9839,-4.34652,-1.87041,-6.50663,-1.43881,-2.78497,-4.09349,-3.27711,-7.58611,-0.918956,-2.43732,-1.68029,-2.93885,1.37614,1.00354,-0.202025,0.252735,-1.35224,2.14941,-1.22668,-3.85694,-3.91196,-5.39514 10153.1,10150.6,9221.82,-3.95579,-6.11602,-1.95691,-0.571033,7.36799,2.23424,-8.23593,-1.15065,-2.89936,-3.34966,-3.42278,-4.92737,-4.22729,-7.57776,-1.53936,-2.4826,-0.485854,-2.05301,1.35048,0.235875,-0.851581,0.299046,-3.65228,0.452501,-2.53126,-4.14097,-3.0318,-6.032 10156.5,10138.1,9224.22,-1.72219,-4.81284,-2.04034,3.64429,-3.40667,-8.21149,-2.06758,-0.247629,0.240041,0.844032,-2.55693,-2.29071,-5.62686,-4.10255,0.955484,-2.58578,-0.573095,1.96046,-2.89531,-2.47853,1.00662,1.59082,-2.31097,1.60096,-0.355857,-3.59741,-2.54995,-3.16362 10162.5,10126.5,9229.66,-1.48624,-2.31864,-1.19917,5.07688,-2.15075,-4.48733,6.81643,1.19375,3.4529,3.66948,-1.49639,-1.71619,-5.51437,-1.29231,-0.407537,-4.604,-2.54282,0.0824236,-5.27449,-4.81883,0.767691,-1.39492,-2.55861,-0.325428,-1.75464,-3.59903,-1.89829,-0.732932 10167.7,10118.7,9237.56,-1.06333,-0.880843,-0.709075,2.8371,-10.0447,-10.4348,-2.5904,3.18465,5.97115,6.33779,-0.55058,-1.01646,-4.14332,-1.6247,-0.0193591,-4.01402,-3.73144,0.38443,-5.50468,-6.41294,-0.295721,-3.62009,-2.70822,-3.1355,-4.45086,-2.10376,-1.79258,-1.22716 10172.5,10116.9,9247.18,1.551,0.130326,-0.490568,5.87654,-14.5436,-8.35183,-0.790109,3.39107,4.7174,8.28156,-0.0057788,2.6686,-1.84943,-1.48071,1.03911,-4.0934,-3.48936,2.7605,-6.22541,-8.72046,-2.487,-3.9855,-3.15508,-4.85806,-6.30628,-0.1826,-2.22861,-1.91313 10179.7,10122.6,9257.78,1.5355,1.00586,-2.46594,5.55739,-10.6179,-9.89219,1.01847,2.02002,1.55047,10.3651,1.59035,2.3257,-3.02423,-0.681756,0.379055,-4.13859,-2.86252,2.65539,-7.09955,-8.4785,-1.80811,-2.44766,-3.84586,-6.08215,-4.18234,0.309597,-3.66089,-1.78168 10188.9,10134.4,9267.84,0.423127,-1.44673,-6.16369,2.54558,-3.2605,-10.2788,1.93481,-0.460125,-1.55478,7.53447,1.04311,-2.037,-5.33297,-0.715827,-0.912315,-4.00679,-5.27357,1.32517,-7.02947,-5.6844,2.49,-1.1701,-4.14164,-4.46692,0.160721,-1.23591,-5.46575,-0.678645 10196.3,10145.5,9275.21,0.204833,-4.851,-9.24744,3.38063,-3.90706,-1.89916,-0.318999,-3.05687,-4.83175,3.88926,-1.68472,-4.52857,-6.76493,0.053409,0.356074,-2.44354,-9.25902,3.95243,-8.99635,-3.68403,4.07743,-1.41439,-4.06526,0.784286,2.50666,-1.59161,-6.31937,0.0761621 10200.4,10148.5,9278.92,-3.06966,-5.752,-6.27773,-0.452092,4.18213,13.2473,-12.0757,-4.47092,-6.49884,-5.96616,-4.08975,-9.08064,-3.65565,-1.03612,-1.9757,-2.79369,-8.22081,-3.13926,-2.68074,1.98539,-1.47914,-4.27865,-6.82097,-0.0420558,-2.72616,-3.80964,-3.69263,-2.81706 10202.3,10144.3,9279.66,1.7621,-1.2767,-1.87182,1.61337,-6.80859,14.4514,-16.815,-2.07514,-4.63562,0.0307544,-1.49074,-2.29138,-1.18636,-1.08621,1.86862,0.689509,-4.2555,-0.913166,-4.04706,-1.13903,-2.95495,-1.4359,-3.45987,4.36607,0.619825,-1.53464,-2.06409,-2.58631 10201.6,10141.5,9277.89,2.73427,2.11183,3.79277,1.71546,-5.8859,13.3557,-11.3022,2.79327,2.37116,13.2011,3.98285,0.966107,0.039656,-0.715821,2.85166,2.34242,2.77476,-0.0888099,-4.98538,-3.4432,-1.83877,3.57211,2.68075,7.05565,6.45616,-1.54302,-1.24469,-1.49869 10196,10143.8,9273.55,-2.52737,0.202188,7.08167,-4.89952,6.71679,10.6699,0.756855,5.54471,7.25909,13.9583,6.39787,-2.37566,0.745793,-1.45474,-1.09404,0.910205,7.21143,-6.92492,-3.24203,-2.89701,-0.543452,6.07649,7.33376,6.57894,6.15484,-4.40884,0.0587056,-1.11052 10186.2,10147.8,9267.63,-4.31786,0.145523,8.74123,-1.12372,3.61382,5.90919,-2.20636,4.87121,7.93339,10.8223,5.77747,-1.02016,1.70524,-1.23974,-1.99873,1.22043,7.18349,-2.02393,-4.52471,-1.19367,-1.87015,5.60664,6.92162,5.30532,3.03549,-3.16865,1.33872,-1.3693 10178.3,10151.3,9262.07,-1.01371,-0.36759,7.07326,3.03463,-3.67644,6.41668,1.01659,3.32806,5.69645,6.11989,4.17302,3.13986,4.40199,0.31144,-2.58094,-0.0539033,4.16067,1.49299,-3.2753,-1.39228,-2.172,3.33149,4.19598,3.46064,0.616277,-0.818505,3.98959,0.698301 10177.2,10154.3,9257.94,2.09186,0.0766925,2.17884,5.08344,-13.9717,-0.882929,-3.84368,2.86526,4.57806,7.77504,4.75117,6.29349,4.58116,4.04706,1.06485,0.914494,1.84175,7.12093,-3.92066,-3.04038,-1.76589,1.29071,2.74094,1.46176,1.98937,3.12251,5.09485,3.84087 10179.4,10155.4,9254.74,0.187596,-0.882072,-0.665652,4.15319,-3.56212,6.25634,3.46947,2.99756,3.30879,0.859046,5.1349,3.91232,5.90056,6.60019,0.839946,-0.162343,-0.484405,2.65509,-1.8674,-3.50916,-5.10299,-1.60522,1.28388,-0.0295086,1.05,2.81748,5.21994,5.53563 10178.8,10153.1,9251.26,-1.91139,-0.154839,-0.832651,7.32065,-8.14661,3.20829,-4.61065,3.9011,1.20806,1.29028,6.11631,4.24084,4.66918,7.38927,3.1094,1.72009,-0.436683,6.06925,-3.83738,-3.64103,-8.35166,-0.222316,1.74303,3.43329,2.82215,3.91599,3.2218,6.05878 10175,10149.2,9246.46,-3.00223,-0.829219,2.18951,8.12634,-8.29635,3.98254,-2.55022,3.58933,0.0476173,2.00734,2.85452,5.13863,4.39434,5.86178,1.57419,0.321093,2.11151,4.62819,-0.677836,-1.98205,-7.44972,1.36379,2.52895,5.12261,2.10196,3.15929,2.77152,6.16477 10170.8,10147.7,9240.32,-2.09934,-1.33891,3.77143,6.49402,-6.43302,-0.0826344,0.87837,1.12061,0.421557,1.06025,-1.52903,5.64507,3.68263,3.49536,1.25096,-1.4957,2.92854,4.60413,2.40658,-0.645265,-3.32217,0.987715,2.60908,1.94117,-0.424246,2.85508,2.71473,4.88469 10167.3,10148.7,9234.04,-1.71112,-2.89318,3.67043,1.66277,3.35424,4.57631,10.1924,-0.35173,1.35064,-5.80931,-1.82085,3.64176,4.57117,2.2882,0.924739,-2.41648,2.22467,2.19365,5.80375,-0.426137,-2.32705,-0.919332,2.09081,-2.34116,-2.25007,1.71251,3.40172,3.5108 10165.7,10149.1,9229.23,-1.45001,-3.05548,2.45599,-0.349391,3.71978,4.53119,5.144,-0.0754888,2.20722,-6.90377,0.948441,2.13514,3.08117,1.83942,2.86791,-0.010419,2.66035,5.23219,5.6626,-0.804354,-2.37724,-1.67323,0.673861,-3.53649,-1.59081,1.76997,2.75549,2.29186 10167.4,10147.1,9226.8,-1.49928,-2.70714,1.88393,-0.842721,-0.225431,3.25531,1.41947,0.140255,3.21042,-3.88608,1.41104,1.86088,-0.091131,0.642157,1.94581,0.307133,3.18746,6.22574,4.30938,-1.01513,-1.1936,-1.8575,-0.588364,-1.42784,-2.08205,1.85519,1.46316,1.06047 10171.1,10143.9,9226.48,-2.01672,-2.40053,3.06391,-0.0599903,-8.34303,2.94718,-5.04409,-0.199276,4.0892,-3.68083,-0.226057,2.75547,-0.686676,-0.843757,0.670264,-0.458086,3.08212,7.11729,2.84836,0.933537,-1.50789,-1.59001,0.179663,0.0589795,-2.55704,3.42709,0.775783,0.360096 10175,10140.6,9227.89,-1.34782,-2.60865,2.14445,1.39294,-10.3608,4.5868,-8.2559,-1.78039,0.356678,-10.0047,-3.28868,2.87133,1.85333,-3.67234,1.53223,-1.27653,0.113475,6.97877,4.49731,3.38158,-3.24882,-2.09817,-0.213742,-0.816136,-3.92766,4.36792,1.46638,-0.25462 10179,10139.5,9231.01,-0.683001,-1.14693,0.835389,1.45465,-4.93888,6.92044,-3.2459,-1.76518,-2.11784,-11.5638,-3.99539,3.25477,2.97649,-3.54233,2.62301,-0.286071,-1.99677,5.44349,5.35012,2.55683,-3.04093,-1.82791,-1.42661,0.583625,-2.6178,3.43693,2.29735,-0.308687 10185.5,10142.2,9235.77,-0.0852919,0.0218383,0.522022,1.091,-4.00515,-0.71681,-2.72016,-1.24891,-1.4593,-5.53454,-2.81228,2.98724,1.40275,-1.35994,4.37674,1.00841,-2.02092,6.34309,4.01241,0.223476,0.719167,-0.617158,-1.79277,2.19906,-0.00915837,1.60933,1.1106,-0.276707 10194.7,10147.7,9242.28,-0.507821,-1.45713,1.82236,1.06383,0.990703,1.16431,3.40878,-1.35424,0.436421,-3.7364,-2.82733,0.844561,2.18188,1.42103,2.14788,-1.48658,-0.956157,3.31294,2.03859,-1.09837,2.11718,-0.147919,0.113767,0.665977,1.0134,-0.758268,0.662046,1.48327 10202.3,10153,9250.68,-0.953894,-1.28733,1.09826,0.183582,-2.63676,-4.1377,-2.89907,-0.851983,3.07691,-0.452803,-2.18838,0.00930997,2.87142,4.0314,0.911046,-1.55443,1.18147,4.24956,-2.48362,-1.23019,1.72571,2.11001,5.29268,-0.281886,3.31927,-0.100871,1.85826,4.09941 10205.4,10156.4,9259.89,-1.27754,0.134823,0.181405,0.430733,3.94306,1.54036,2.99815,-1.16285,4.70226,-4.24342,-1.81256,1.00154,4.93307,6.24027,-1.59843,-1.48742,2.34844,2.10305,-2.00905,-0.662325,0.626241,1.17997,6.74123,-1.67701,1.35772,0.491316,4.32271,6.53414 10204.9,10157.9,9267.94,0.0906612,2.16352,-0.379486,5.42194,2.73054,2.84047,-1.4914,-1.83181,4.02307,-5.15449,-0.262248,3.79351,5.21678,7.80905,0.384689,1.27337,2.9796,6.90988,1.28339,2.20996,-0.91791,-0.163496,3.78903,-1.75168,-0.655347,2.9127,4.88667,7.66747 10203.5,10159,9273.39,2.81598,1.22437,-0.368556,7.79675,3.42922,7.94279,4.57077,-0.708312,0.0968463,-6.10539,0.906129,5.55489,5.11842,8.21484,-0.0671665,1.22889,2.37144,6.24544,4.97372,3.9233,-2.49967,0.267274,-0.310124,1.09266,-0.410233,4.04567,4.74621,8.0612 10203.2,10162.2,9275.77,5.91857,0.355765,0.897437,11.4606,-3.5509,6.21936,2.57301,-0.0103725,-3.12789,-4.93913,0.601331,6.94209,5.77388,6.93334,1.15761,0.716978,2.28439,10.4648,4.58557,4.39511,-2.76356,2.73426,-1.51427,4.03252,2.99548,5.47757,3.66414,6.66569 10203.5,10167.2,9275.21,3.60261,-0.370029,0.212296,6.53742,-1.17501,1.39057,4.60494,-1.59955,-3.36286,-6.83681,-0.619753,2.05525,7.21718,4.0699,-0.311278,-1.80144,1.07578,6.02142,4.81799,3.05296,-1.94492,1.84126,-1.66326,1.40391,1.77364,2.95825,3.1993,3.61198 10203.2,10169.7,9272.52,1.94895,1.27875,-0.411546,7.45768,-3.75161,0.551798,7.13428,-3.82068,-2.61405,-4.51085,-0.839975,-0.654388,7.59238,3.63367,1.11679,-0.895324,0.0589114,6.72608,0.605615,-0.28023,-1.84675,-0.134175,-0.468956,-1.06577,2.10307,1.19208,2.14254,2.35948 10201,10166,9269.14,-0.454618,0.774031,2.06017,2.8462,-0.622985,0.18548,5.53147,-2.50822,-2.46147,-4.96779,0.0109421,-5.95039,4.88549,1.45711,-1.36876,0.21175,1.58667,0.959389,-1.72767,-0.999701,-1.91612,-0.271218,-0.271307,-3.60937,2.2528,-2.81471,1.29832,0.342989 10196.9,10158.5,9266.51,1.16537,-1.9421,4.60098,6.66208,-8.91079,-4.05041,0.977918,-0.375912,-2.52562,-2.44083,-1.83608,-5.04574,0.870179,-2.88837,0.903319,2.45464,2.77487,7.13809,-7.32993,-2.29902,0.410437,1.61472,1.76486,-2.68616,2.88565,-3.79142,-0.830458,-1.20118 10194.1,10152.5,9265.18,-4.11534,-5.864,4.81522,5.05616,0.145339,-4.93641,2.59855,0.656712,1.10696,-4.83177,-6.68192,-7.2593,-1.01756,-6.50992,-0.623669,0.165413,3.83811,5.84041,-5.84841,-0.103661,1.98729,0.416145,1.34348,-6.16515,-2.67871,-5.57128,-1.65554,-3.26762 10194.1,10148.4,9264.07,-6.59722,-4.92656,-2.01588,3.7417,0.726794,-18.2936,5.15057,-0.276157,1.50739,-0.538248,-8.52874,-4.00362,-4.55022,-5.27015,0.604573,-0.930054,-0.109161,8.19838,-8.17669,-2.1092,4.17484,-1.56197,-1.02102,-5.8341,-5.50376,-1.7134,-2.50895,-3.06608 10193.9,10142,9261.25,-7.62788,-2.98611,1.9356,-1.40885,17.3716,4.06957,22.1809,1.39972,5.64224,-7.94302,-5.59134,-1.45901,0.439725,1.11211,-6.73411,-3.11746,1.4598,-4.78344,-2.09513,-0.404037,0.473396,-4.22587,-2.43839,-5.70551,-5.26427,-0.515338,1.20082,0.113119 10190.4,10132.9,9256.55,-0.061965,0.47587,-3.01478,1.28661,-2.15014,-14.2047,7.89898,0.463674,0.911903,2.0883,-1.64338,3.11185,-2.21723,0.781415,-1.37312,0.396228,-1.38267,3.09944,-1.8496,-1.29836,2.6087,-3.15966,-2.03297,-3.33185,-3.23065,2.92606,0.328003,-0.0324179 10185,10126,9252.36,-0.460313,1.71643,-3.7396,-2.47922,-1.49725,-15.3645,-1.80975,0.715758,-0.981069,-0.691494,-0.794101,-0.106849,-2.08179,-0.30971,-1.53311,0.428815,-0.320026,-0.221114,2.28648,0.175576,3.04606,-1.33911,-0.290353,-5.37868,-3.63253,0.919151,0.306196,-0.421839 10178.6,10124.8,9251.04,-1.00256,1.33259,-4.2472,-1.03971,2.95821,-4.55752,1.84476,0.117356,-4.36831,-4.27268,-1.02576,-0.886254,0.661063,-0.0446314,-0.718596,-0.508343,-2.00182,-0.337999,2.57329,-0.613947,2.18595,0.685998,2.2221,-1.4549,-2.89677,-0.0111036,1.2411,0.83044 10170.8,10127.6,9252.97,-1.71108,0.0714348,-2.91875,-0.0818013,10.0027,5.28964,4.84662,0.115636,-5.97389,-2.97492,0.466922,-1.16018,3.14319,-0.484977,-0.73996,-1.40938,-2.86898,-1.18229,2.85098,1.59393,-0.709864,0.769892,0.0526875,0.667581,-4.09633,-0.130706,2.87503,0.28772 10163.4,10130.8,9256.69,-0.0482655,-0.561906,-4.41924,-1.93638,1.00001,-3.80859,-6.74655,-0.693966,-6.90741,3.83606,-0.443929,0.133173,1.32042,-4.12952,2.21239,-0.401666,-2.83084,1.48444,3.60821,4.7162,0.0479322,1.57325,-2.9423,0.781086,-3.57562,1.01359,1.5974,-1.03302 10159.1,10132.9,9259.9,0.830676,1.38376,-3.59798,1.88876,1.90766,6.33722,1.16568,-1.88109,-5.49532,7.56995,-3.97276,2.47056,-1.10217,-4.02745,0.530141,-1.80729,-2.44923,1.11112,6.04583,5.79514,-1.61378,0.146823,-4.31812,1.65679,-0.82556,0.385538,-1.6035,-0.921055 10159.8,10135.2,9260.63,-0.16576,1.00018,-5.12473,0.442361,0.505831,-5.64864,-2.63413,-2.52592,-5.46478,4.95174,-4.3147,0.782684,-5.73615,-4.82371,0.266276,-1.86669,-4.0481,-1.31822,9.03428,5.18538,0.835431,-1.04748,-4.21294,1.0615,-0.105573,-1.22812,-5.24566,-3.63422 10165.2,10138.1,9258.46,0.205477,-0.680098,-4.46762,5.26891,1.18115,-1.68502,7.13137,-1.22722,-4.01706,-1.7858,-0.511666,3.55446,-3.85553,-2.43205,1.3525,-0.694302,-4.16672,-0.729833,7.26617,2.38627,0.742375,-2.04911,-3.24066,2.72775,2.10783,0.115275,-4.78462,-4.34396 10171.6,10139.6,9254.61,-1.51268,-2.23477,-5.13237,-3.29461,-0.317239,-10.5071,-7.94002,1.87205,-2.15615,-2.57627,4.52526,1.46446,-2.39092,-3.68309,1.44927,1.27351,-2.10555,-3.67494,7.0263,3.64847,0.370668,0.612656,-2.452,4.76347,5.31087,1.21101,-2.18927,-4.86589 10174.6,10139.6,9250.85,-0.380976,0.430706,-4.77251,1.24603,3.57465,-3.14504,-10.8805,1.4131,-3.82203,6.1265,4.05681,1.86576,-2.69539,-3.84931,0.571097,0.0445532,-3.61574,1.0929,5.45496,4.67637,-2.69117,0.376736,-3.44843,8.26613,5.44059,2.39248,-1.35143,-3.43895 10173.2,10141.8,9247.9,-0.967231,0.660605,-0.333774,0.682442,10.1733,9.80472,-4.02844,0.296976,-2.0856,1.70749,0.105393,-0.302007,-2.02762,-1.68176,-2.57321,-1.85542,-2.20576,-3.56605,7.81712,4.57148,-0.717533,0.00661063,0.070936,7.88567,3.00205,-0.188925,-1.30646,-0.417109 10169.8,10147.8,9245.05,1.57911,1.89614,-1.23894,5.44327,1.1255,2.7455,0.888702,-2.69789,-2.29535,1.37374,-2.16695,0.277041,-2.61632,-0.168021,1.19527,-0.966804,-1.39634,2.02717,6.13068,1.74285,2.61838,-0.673957,2.42798,5.71141,1.0237,-0.190537,-2.48355,-0.424022 10166.9,10152.4,9241.4,1.48812,1.56883,0.00439658,-1.99079,-5.3945,-7.45076,-2.79497,-1.09824,0.438405,1.08335,0.567998,-2.12211,0.537132,0.235065,2.13962,0.850241,2.33283,0.11668,5.71046,0.316621,2.37782,1.5783,4.38674,4.44102,2.85837,-0.867284,0.197126,-0.632035 10166,10149.9,9237.21,3.10346,3.20745,-0.0787972,3.26164,-1.99167,1.15174,7.73898,0.388067,-1.3872,7.93093,2.89628,-0.846609,2.95243,1.10786,0.0356645,-0.191303,-1.48335,3.06518,0.833731,-2.48298,-2.62814,-0.329278,-0.0454046,4.84244,1.50962,-0.571214,2.28968,0.0896905 10169.4,10141.9,9233.72,1.54047,2.79665,0.872984,0.435893,0.341067,4.50191,6.31086,2.24353,0.0763229,5.33021,2.30696,-1.94916,2.28551,1.6759,-3.55737,-0.57595,-3.31446,-1.28349,0.109544,-0.911539,-3.08755,0.149125,-2.57658,2.65457,-0.759677,-1.72314,1.73795,1.22082 10175.5,10134.5,9231.85,3.08721,1.31195,-0.463831,-2.78365,-16.0641,-12.4959,-7.90321,1.44639,2.2521,2.09953,-0.628689,0.674957,-0.991746,0.999703,0.501374,1.08647,-1.9555,-0.457535,-1.969,0.140249,0.679574,4.05153,-1.26929,2.9472,1.23177,0.0460567,-1.18548,1.19414 10178.5,10132.3,9231.94,4.8578,-0.156201,-1.83619,3.45539,-10.5983,-4.40534,-3.25278,-1.48511,1.7839,1.07398,-3.79721,3.44697,-0.661031,-0.19397,1.51898,-2.78611,-1.58924,-1.02247,-4.03291,-0.779814,-2.72459,1.42865,-4.44874,1.96164,0.024013,0.769821,-1.68183,-1.09525 10176,10135.5,9234.24,3.98434,-2.9881,-1.82932,-3.45496,-4.37718,-1.32479,-6.81161,0.242295,3.63988,0.773917,-2.92089,1.50769,1.03257,-1.29175,0.607123,-3.32519,0.794345,-7.2134,-4.18473,-2.11878,-3.48641,2.04926,-1.83971,2.5711,1.8547,-0.444122,0.204744,-0.633906 10170.3,10141.1,9238.24,4.5574,-1.21766,-1.92884,-3.3891,-4.53289,-3.61119,-11.1428,0.87067,2.52674,6.28098,-0.916225,0.833349,-0.285056,-2.02874,2.83162,-0.822357,0.836116,-2.02452,-4.36166,-2.46534,-2.40599,3.53798,0.439996,2.8824,2.66576,-0.190266,-0.411649,-0.335746 10164.8,10146.9,9241.73,1.14271,0.21175,2.54403,-5.97996,8.86795,9.92082,0.583279,0.92891,3.1377,1.52082,0.653327,-2.04189,-0.909795,-1.88382,-1.45444,-1.72465,2.94817,-6.9659,0.661566,-0.779148,-2.33549,3.61435,1.90115,-0.709103,0.572663,-2.44443,-1.61985,-1.24632 10161.8,10151.9,9242.42,0.429305,-0.24402,1.54324,-0.758714,1.99988,2.30697,-0.150645,-1.67843,-0.372931,2.68223,0.974669,-2.18675,-3.69726,-3.84373,0.315076,-1.61503,2.02219,-0.439987,1.5067,0.347441,-0.468043,1.85512,2.51346,-3.61534,-1.61311,-1.68631,-4.32277,-3.31289 10160.6,10154.5,9240.5,-1.6783,-2.7916,3.79283,-1.46484,1.8842,7.0456,3.61276,-2.08564,-1.14902,-3.90469,1.00738,-2.71903,-1.12392,-2.56102,-0.564502,-1.26929,2.87817,-3.80446,2.16188,1.69189,-0.17359,-0.806729,4.45158,-4.99401,-1.9224,-2.1335,-3.41399,-1.5215 10158.8,10152.9,9238.94,-1.26294,-1.55708,2.47997,-0.37092,-5.35681,-1.99801,-4.61673,-3.19995,-3.63982,-3.59422,0.268397,-1.15304,1.21312,-1.94008,2.37467,0.463918,1.03699,-0.249188,1.94821,3.1095,0.656428,-1.26258,5.17342,-2.5293,-0.911564,-0.727538,-1.60047,-0.657086 10157.1,10148.4,9241.47,-0.729297,1.90628,1.50273,8.02209,4.5029,7.25435,-0.943104,-3.87229,-5.15977,-0.605295,-0.786266,-0.00624273,3.2036,-0.99694,1.83674,-0.424322,-0.759934,4.69506,3.12589,4.93905,-1.14094,-2.37706,0.896838,-1.15642,-2.07425,-0.341439,0.651623,-1.90525 10159.3,10145.1,9249.53,-3.61489,-0.368775,4.8318,0.654323,13.8953,20.2332,9.01061,0.740005,1.06482,-1.98312,1.43178,-2.39481,5.44965,2.23927,-2.07082,1.84445,3.36316,-2.3874,5.82791,5.13504,0.331121,1.17574,4.11636,2.46863,2.53744,-2.31289,3.73605,1.261 10166.4,10146.2,9260.39,-0.690065,-0.196533,2.57149,3.28245,1.26863,3.07282,2.3288,0.343504,0.7493,7.7189,2.47287,-2.19401,1.83016,1.49389,2.04941,5.57015,1.68587,7.37325,4.33035,3.86901,3.21355,1.31074,4.30838,4.34097,4.14204,-0.792683,1.91579,1.4487 10174.6,10153.3,9268.63,0.973864,0.288282,4.67663,-0.604468,1.35396,1.77193,6.1612,0.928573,3.56181,0.301872,1.61496,-1.94891,1.37811,1.784,-0.829802,4.5252,2.98522,2.05165,3.03006,0.33278,4.9167,0.692046,4.78248,3.89965,4.1223,-1.28055,0.902128,2.44014 10179.4,10165.9,9270.91,0.383028,0.372248,2.91142,5.26445,-4.52355,-0.481389,-1.47582,-0.0802922,4.09074,-3.4789,-1.84054,-0.641665,1.60157,2.15213,-0.406849,1.24052,1.05589,7.69175,-4.79723,-3.42058,1.48542,-2.69221,-0.604027,-2.8823,-1.41943,-0.386671,1.59434,1.71786 10180.9,10180.3,9268.76,-7.39108,-4.07938,1.96913,5.84801,-1.99672,13.1344,-8.45676,2.45664,8.74322,0.00440195,-3.70354,-4.02376,5.09873,7.07674,-2.94009,-6.27334,-2.18896,9.06615,-15.5002,-6.518,-12.659,-9.2251,-8.78964,-16.0646,-15.2285,-1.36974,7.28841,2.96689 \ No newline at end of file diff --git a/nipype/testing/data/jsongrabber.txt b/nipype/testing/data/jsongrabber.txt index 4554d7beb4..c81d99fa2a 100644 --- a/nipype/testing/data/jsongrabber.txt +++ b/nipype/testing/data/jsongrabber.txt @@ -1 +1 @@ -{"param2": 4, "param1": "exampleStr"} \ No newline at end of file +{"param2": 4, "param1": "exampleStr"} diff --git a/nipype/testing/data/realign_json.json b/nipype/testing/data/realign_json.json index 12a5b41a0a..5bf1936476 100644 --- a/nipype/testing/data/realign_json.json +++ b/nipype/testing/data/realign_json.json @@ -31,4 +31,4 @@ "write_mask": null, "write_which": null, "write_wrap": null -} \ No newline at end of file +} diff --git a/nipype/testing/data/smri_ants_registration_settings.json b/nipype/testing/data/smri_ants_registration_settings.json index 54f27908e4..53f33e33e2 100644 --- a/nipype/testing/data/smri_ants_registration_settings.json +++ b/nipype/testing/data/smri_ants_registration_settings.json @@ -177,4 +177,4 @@ ], "dimension": 3, "collapse_output_transforms": false -} \ No newline at end of file +} diff --git a/nipype/testing/data/tbss_dir/do_not_delete.txt b/nipype/testing/data/tbss_dir/do_not_delete.txt index a1df420e34..9c5c450dfa 100644 --- a/nipype/testing/data/tbss_dir/do_not_delete.txt +++ b/nipype/testing/data/tbss_dir/do_not_delete.txt @@ -1 +1 @@ -This file has to be here because git ignores empty folders. \ No newline at end of file +This file has to be here because git ignores empty folders. diff --git a/nipype/utils/spm_flat_config.m b/nipype/utils/spm_flat_config.m index 8e46914667..6e489251b2 100644 --- a/nipype/utils/spm_flat_config.m +++ b/nipype/utils/spm_flat_config.m @@ -36,4 +36,4 @@ else objlist = {objlist{:} astruct}; end -end \ No newline at end of file +end diff --git a/nipype/workflows/data/ecc.sch b/nipype/workflows/data/ecc.sch index a7de1f2b0b..b9e8d8c3c3 100644 --- a/nipype/workflows/data/ecc.sch +++ b/nipype/workflows/data/ecc.sch @@ -3,7 +3,7 @@ setscale 4 setoption smoothing 6 setoption paramsubset 1 0 0 0 0 0 0 1 1 1 1 1 1 clear U -clear UA +clear UA clear UB clear US clear UP @@ -53,7 +53,7 @@ clear U setrow UG 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 optimise 7 UG 0.0 0.0 0.0 0.0 0.0 0.0 0.0 abs 2 sort U -copy U UG +copy U UG # 1mm scale setscale 1 setoption smoothing 2 diff --git a/nipype/workflows/data/hmc.sch b/nipype/workflows/data/hmc.sch index 08f3e76e85..aeabcae29a 100644 --- a/nipype/workflows/data/hmc.sch +++ b/nipype/workflows/data/hmc.sch @@ -2,7 +2,7 @@ setscale 4 setoption smoothing 6 clear U -clear UA +clear UA clear UB clear US clear UP @@ -51,7 +51,7 @@ clear U setrow UG 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 optimise 7 UG 0.0 0.0 0.0 0.0 0.0 0.0 0.0 abs 2 sort U -copy U UG +copy U UG # 1mm scale setscale 1 setoption smoothing 2 From 08e4d660dc58d4d7f0d4b379f80023e9dbcf08ee Mon Sep 17 00:00:00 2001 From: miykael Date: Fri, 5 Jan 2018 16:28:26 +0100 Subject: [PATCH 086/365] STY: correct for tailing spaces and newline at end of file --- .dockerignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index c44710d14e..fb4be03ec9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -34,4 +34,4 @@ Vagrantfile .mailmap # Previous coverage results -.coverage \ No newline at end of file +.coverage From d0dd3e14bcf4f4c465b23c864dc18abaf9ff5cbf Mon Sep 17 00:00:00 2001 From: miykael Date: Fri, 5 Jan 2018 17:00:13 +0100 Subject: [PATCH 087/365] STY: correct for newline at end of file --- nipype/testing/data/README | 2 +- nipype/testing/data/spminfo | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/testing/data/README b/nipype/testing/data/README index 825acd11e2..550854c57e 100644 --- a/nipype/testing/data/README +++ b/nipype/testing/data/README @@ -3,4 +3,4 @@ in the doctests of nipype. For verion 0.3 of nipype, we're using Traits and for input files, the code checks to confirm the assigned files actually exist. It doesn't matter what the files are, or even if they contain "real data", only that they exist. Again, these files -are only meant to serve as documentation in the doctests. \ No newline at end of file +are only meant to serve as documentation in the doctests. diff --git a/nipype/testing/data/spminfo b/nipype/testing/data/spminfo index a24b0a57c4..32317debc4 100644 --- a/nipype/testing/data/spminfo +++ b/nipype/testing/data/spminfo @@ -6,9 +6,9 @@ try, end; spm_path = spm('dir'); fprintf(1, 'NIPYPE %s', spm_path); - + ,catch ME, fprintf(2,'MATLAB code threw an exception:\n'); fprintf(2,'%s\n',ME.message); if length(ME.stack) ~= 0, fprintf(2,'File:%s\nName:%s\nLine:%d\n',ME.stack.file,ME.stack.name,ME.stack.line);, end; -end; \ No newline at end of file +end; From adf002610d936a8d7a355fa4b25c17b886153979 Mon Sep 17 00:00:00 2001 From: miykael Date: Fri, 5 Jan 2018 20:15:01 +0100 Subject: [PATCH 088/365] STY: delets heading newline in textfiles --- doc/users/caching_tutorial.rst | 1 - doc/users/sphinx_ext.rst | 1 - nipype/refs.py | 1 - 3 files changed, 3 deletions(-) diff --git a/doc/users/caching_tutorial.rst b/doc/users/caching_tutorial.rst index 8cd51917a2..4d648277bd 100644 --- a/doc/users/caching_tutorial.rst +++ b/doc/users/caching_tutorial.rst @@ -1,4 +1,3 @@ - .. _caching: =========================== diff --git a/doc/users/sphinx_ext.rst b/doc/users/sphinx_ext.rst index 02832ef7f8..9e6732a2ef 100644 --- a/doc/users/sphinx_ext.rst +++ b/doc/users/sphinx_ext.rst @@ -1,4 +1,3 @@ - .. _sphinx_ext: Sphinx extensions diff --git a/nipype/refs.py b/nipype/refs.py index 12e435316e..3b4d394136 100644 --- a/nipype/refs.py +++ b/nipype/refs.py @@ -1,4 +1,3 @@ - # Use duecredit (duecredit.org) to provide a citation to relevant work to # be cited. This does nothing, unless the user has duecredit installed, # And calls this with duecredit (as in `python -m duecredit script.py`): From e3dffeec697d97bc731e8c498bfd4fa1bc433f12 Mon Sep 17 00:00:00 2001 From: miykael Date: Fri, 5 Jan 2018 20:28:34 +0100 Subject: [PATCH 089/365] STY: adds newline to end of file --- nipype/workflows/fmri/fsl/tests/test_preprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/workflows/fmri/fsl/tests/test_preprocess.py b/nipype/workflows/fmri/fsl/tests/test_preprocess.py index ac9960514c..4f382bdc1a 100644 --- a/nipype/workflows/fmri/fsl/tests/test_preprocess.py +++ b/nipype/workflows/fmri/fsl/tests/test_preprocess.py @@ -22,4 +22,4 @@ def test_create_featreg_preproc(): # test methods assert wf.get_node('extractref') - assert wf._get_dot() \ No newline at end of file + assert wf._get_dot() From c347e822a6fc1e970dab9428f1056d4fa19bf337 Mon Sep 17 00:00:00 2001 From: miykael Date: Fri, 5 Jan 2018 22:58:30 +0100 Subject: [PATCH 090/365] STY: correcting W503 - line break before binary operator --- nipype/algorithms/tests/test_compcor.py | 4 ++-- nipype/pipeline/engine/workflows.py | 4 ++-- nipype/workflows/rsfmri/fsl/tests/test_resting.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nipype/algorithms/tests/test_compcor.py b/nipype/algorithms/tests/test_compcor.py index 9407e6ef0d..455e994f6e 100644 --- a/nipype/algorithms/tests/test_compcor.py +++ b/nipype/algorithms/tests/test_compcor.py @@ -162,8 +162,8 @@ def run_cc(self, ccinterface, expected_components, expected_header='CompCor'): num_got_timepoints = len(components_data) assert num_got_timepoints == self.fake_data.shape[3] for index, timepoint in enumerate(components_data): - assert (len(timepoint) == ccinterface.inputs.num_components - or len(timepoint) == self.fake_data.shape[3]) + assert (len(timepoint) == ccinterface.inputs.num_components or + len(timepoint) == self.fake_data.shape[3]) assert timepoint[:2] == expected_components[index] return ccresult diff --git a/nipype/pipeline/engine/workflows.py b/nipype/pipeline/engine/workflows.py index d58424fcd5..f2ad13cddf 100644 --- a/nipype/pipeline/engine/workflows.py +++ b/nipype/pipeline/engine/workflows.py @@ -209,8 +209,8 @@ def connect(self, *args, **kwargs): if not destnode._check_inputs(dest): not_found.append(['in', destnode.name, dest]) if not (hasattr(srcnode, '_interface') and - ('.io' in str(srcnode._interface.__class__) - or any(['.io' in str(val) for val in + ('.io' in str(srcnode._interface.__class__) or + any(['.io' in str(val) for val in srcnode._interface.__class__.__bases__]))): if isinstance(source, tuple): # handles the case that source is specified diff --git a/nipype/workflows/rsfmri/fsl/tests/test_resting.py b/nipype/workflows/rsfmri/fsl/tests/test_resting.py index 68e62d7ee8..c176d49ed6 100644 --- a/nipype/workflows/rsfmri/fsl/tests/test_resting.py +++ b/nipype/workflows/rsfmri/fsl/tests/test_resting.py @@ -83,8 +83,8 @@ def test_create_resting_preproc(self, mock_node, mock_realign_wf): with open(expected_file, 'r') as components_file: components_data = [line.split() for line in components_file] num_got_components = len(components_data) - assert (num_got_components == self.num_noise_components - or num_got_components == self.fake_data.shape[3]) + assert (num_got_components == self.num_noise_components or + num_got_components == self.fake_data.shape[3]) first_two = [row[:2] for row in components_data[1:]] assert first_two == [['-0.5172356654', '-0.6973053243'], ['0.2574722644', '0.1645270737'], From 862d71792137cbd0727b968cfaa960e808532488 Mon Sep 17 00:00:00 2001 From: miykael Date: Fri, 5 Jan 2018 23:07:31 +0100 Subject: [PATCH 091/365] STY: correcting W191 - indentation contains tabs --- nipype/utils/tests/test_cmd.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nipype/utils/tests/test_cmd.py b/nipype/utils/tests/test_cmd.py index 315d55441f..776c5a5c11 100644 --- a/nipype/utils/tests/test_cmd.py +++ b/nipype/utils/tests/test_cmd.py @@ -84,12 +84,12 @@ def test_list_nipy_interfacesp(self): assert stderr.getvalue() == '' assert stdout.getvalue() == \ """Available Interfaces: - ComputeMask - EstimateContrast - FitGLM - FmriRealign4d - Similarity - SpaceTimeRealigner +\tComputeMask +\tEstimateContrast +\tFitGLM +\tFmriRealign4d +\tSimilarity +\tSpaceTimeRealigner """ def test_run_4d_realign_without_arguments(self): From f9f98b211e039fd8fd52ca76ebf342b62e2071ee Mon Sep 17 00:00:00 2001 From: miykael Date: Fri, 5 Jan 2018 23:57:39 +0100 Subject: [PATCH 092/365] STY: correcting W391 - blank line at end of file --- nipype/algorithms/tests/test_confounds.py | 1 - nipype/algorithms/tests/test_modelgen.py | 1 - nipype/algorithms/tests/test_normalize_tpms.py | 1 - nipype/algorithms/tests/test_overlap.py | 1 - nipype/caching/tests/test_memory.py | 1 - nipype/interfaces/brainsuite/brainsuite.py | 1 - nipype/interfaces/fsl/fix.py | 1 - nipype/interfaces/fsl/tests/test_base.py | 1 - nipype/interfaces/fsl/tests/test_dti.py | 1 - nipype/interfaces/fsl/tests/test_maths.py | 3 --- nipype/interfaces/fsl/tests/test_model.py | 2 -- nipype/interfaces/fsl/tests/test_utils.py | 1 - nipype/interfaces/tests/test_io.py | 3 --- nipype/pipeline/engine/tests/test_join.py | 2 -- nipype/pipeline/plugins/slurm.py | 1 - nipype/pipeline/plugins/tests/test_callback.py | 1 - nipype/scripts/__init__.py | 1 - nipype/utils/draw_gantt_chart.py | 1 - nipype/utils/tests/test_cmd.py | 1 - nipype/workflows/smri/freesurfer/autorecon3.py | 1 - nipype/workflows/smri/freesurfer/recon.py | 4 ---- nipype/workflows/smri/niftyreg/groupwise.py | 1 - 22 files changed, 31 deletions(-) diff --git a/nipype/algorithms/tests/test_confounds.py b/nipype/algorithms/tests/test_confounds.py index 8c2626457e..3f5b21ed55 100644 --- a/nipype/algorithms/tests/test_confounds.py +++ b/nipype/algorithms/tests/test_confounds.py @@ -73,4 +73,3 @@ def test_outliers(): in_data[0] += 10 assert is_outlier(in_data) == 1 - diff --git a/nipype/algorithms/tests/test_modelgen.py b/nipype/algorithms/tests/test_modelgen.py index 3c9ec4096b..f3f7a37aa7 100644 --- a/nipype/algorithms/tests/test_modelgen.py +++ b/nipype/algorithms/tests/test_modelgen.py @@ -153,4 +153,3 @@ def test_modelgen_sparse(tmpdir): assert len(res.outputs.session_info[0]['regress']) == 2 npt.assert_almost_equal(res.outputs.session_info[0]['regress'][0]['val'][0], 0.016675298129743384) npt.assert_almost_equal(res.outputs.session_info[1]['regress'][1]['val'][5], 0.007671459162258378) - diff --git a/nipype/algorithms/tests/test_normalize_tpms.py b/nipype/algorithms/tests/test_normalize_tpms.py index 5d0fc5c47b..a65cc66770 100644 --- a/nipype/algorithms/tests/test_normalize_tpms.py +++ b/nipype/algorithms/tests/test_normalize_tpms.py @@ -51,4 +51,3 @@ def test_normalize_tpms(tmpdir): assert np.allclose(normdata, mapdata[i]) assert np.allclose(sumdata[sumdata > 0.0], 1.0) - diff --git a/nipype/algorithms/tests/test_overlap.py b/nipype/algorithms/tests/test_overlap.py index e0ec5bcfcb..6c2df79bdd 100644 --- a/nipype/algorithms/tests/test_overlap.py +++ b/nipype/algorithms/tests/test_overlap.py @@ -41,4 +41,3 @@ def check_close(val1, val2): check_close(res.outputs.jaccard, 0.99705) check_close(res.outputs.roi_voldiff, np.array([0.0063086, -0.0025506, 0.0])) - diff --git a/nipype/caching/tests/test_memory.py b/nipype/caching/tests/test_memory.py index 50f56d4700..a33cec9491 100644 --- a/nipype/caching/tests/test_memory.py +++ b/nipype/caching/tests/test_memory.py @@ -40,4 +40,3 @@ def test_caching(tmpdir): assert results.outputs.output1 == [1, 1] finally: config.set('execution', 'stop_on_first_rerun', old_rerun) - diff --git a/nipype/interfaces/brainsuite/brainsuite.py b/nipype/interfaces/brainsuite/brainsuite.py index 60141bcb00..75078c8a96 100644 --- a/nipype/interfaces/brainsuite/brainsuite.py +++ b/nipype/interfaces/brainsuite/brainsuite.py @@ -1621,4 +1621,3 @@ def l_outputs(self): outputs[key] = name return outputs - diff --git a/nipype/interfaces/fsl/fix.py b/nipype/interfaces/fsl/fix.py index cd4aacfedb..1840c143de 100644 --- a/nipype/interfaces/fsl/fix.py +++ b/nipype/interfaces/fsl/fix.py @@ -297,4 +297,3 @@ def _list_outputs(self): outputs = self.output_spec().get() outputs['cleaned_functional_file'] = self._get_cleaned_functional_filename(self.inputs.artifacts_list_file) return outputs - diff --git a/nipype/interfaces/fsl/tests/test_base.py b/nipype/interfaces/fsl/tests/test_base.py index 030306e929..916f8e7826 100644 --- a/nipype/interfaces/fsl/tests/test_base.py +++ b/nipype/interfaces/fsl/tests/test_base.py @@ -77,4 +77,3 @@ def test_gen_fname(args, desired_name): else: desired = os.path.join(pth, desired_name["file"]) assert fname == desired - diff --git a/nipype/interfaces/fsl/tests/test_dti.py b/nipype/interfaces/fsl/tests/test_dti.py index dab4d825ae..751340941b 100644 --- a/nipype/interfaces/fsl/tests/test_dti.py +++ b/nipype/interfaces/fsl/tests/test_dti.py @@ -399,4 +399,3 @@ def test_distancemap(create_files_in_directory): mapper.inputs.local_max_file = "max.nii" assert mapper.cmdline == \ "distancemap --out=%s --in=a.nii --localmax=max.nii" % os.path.join(newdir, "a_dstmap.nii") - diff --git a/nipype/interfaces/fsl/tests/test_maths.py b/nipype/interfaces/fsl/tests/test_maths.py index 408a74712f..4d3c6ad03d 100644 --- a/nipype/interfaces/fsl/tests/test_maths.py +++ b/nipype/interfaces/fsl/tests/test_maths.py @@ -438,6 +438,3 @@ def test_tempfilt(create_files_in_directory_plus_output_type): filt = fsl.TemporalFilter(in_file="a.nii", highpass_sigma=64) assert filt.cmdline == \ "fslmaths a.nii -bptf 64.000000 -1.000000 {}".format(os.path.join(testdir, "a_filt{}".format(out_ext))) - - - diff --git a/nipype/interfaces/fsl/tests/test_model.py b/nipype/interfaces/fsl/tests/test_model.py index b2e3f8571c..fbfd3bbb05 100644 --- a/nipype/interfaces/fsl/tests/test_model.py +++ b/nipype/interfaces/fsl/tests/test_model.py @@ -63,5 +63,3 @@ def test_MultipleRegressDesign(tmpdir): """ for ii in ["mat", "con", "fts", "grp"]: assert tmpdir.join('design.'+ii).read() == eval("design_"+ii+"_expected_content") - - diff --git a/nipype/interfaces/fsl/tests/test_utils.py b/nipype/interfaces/fsl/tests/test_utils.py index 66b91cf96f..46a6f4a2f0 100644 --- a/nipype/interfaces/fsl/tests/test_utils.py +++ b/nipype/interfaces/fsl/tests/test_utils.py @@ -302,4 +302,3 @@ def test_swapdims(create_files_in_directory_plus_output_type): # Test that we can set an output name swap.inputs.out_file = "b.nii" assert swap.cmdline == "fslswapdim a.nii x y z b.nii" - diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index ff56c9ec9d..40420c05c6 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -437,6 +437,3 @@ def test_jsonsink(tmpdir, inputs_attributes): data = simplejson.load(f) assert data == expected_data - - - diff --git a/nipype/pipeline/engine/tests/test_join.py b/nipype/pipeline/engine/tests/test_join.py index a77745eb03..33438cdacf 100644 --- a/nipype/pipeline/engine/tests/test_join.py +++ b/nipype/pipeline/engine/tests/test_join.py @@ -578,5 +578,3 @@ def nested_wf(i, name='smallwf'): # there should be six nodes in total assert len(result.nodes()) == 6, \ "The number of expanded nodes is incorrect." - - diff --git a/nipype/pipeline/plugins/slurm.py b/nipype/pipeline/plugins/slurm.py index e5b797da5d..cd397f8d3b 100644 --- a/nipype/pipeline/plugins/slurm.py +++ b/nipype/pipeline/plugins/slurm.py @@ -131,4 +131,3 @@ def _submit_batchtask(self, scriptfile, node): self._pending[taskid] = node.output_dir() logger.debug('submitted sbatch task: %d for node %s' % (taskid, node._id)) return taskid - diff --git a/nipype/pipeline/plugins/tests/test_callback.py b/nipype/pipeline/plugins/tests/test_callback.py index 7212ff7302..0c1927e619 100644 --- a/nipype/pipeline/plugins/tests/test_callback.py +++ b/nipype/pipeline/plugins/tests/test_callback.py @@ -107,4 +107,3 @@ def test_callback_multiproc_exception(tmpdir): assert n.name == 'f_node' assert so.statuses[0][1] == 'start' assert so.statuses[1][1] == 'exception' - diff --git a/nipype/scripts/__init__.py b/nipype/scripts/__init__.py index 8b13789179..e69de29bb2 100644 --- a/nipype/scripts/__init__.py +++ b/nipype/scripts/__init__.py @@ -1 +0,0 @@ - diff --git a/nipype/utils/draw_gantt_chart.py b/nipype/utils/draw_gantt_chart.py index 8731aa32eb..fc78f49ea5 100644 --- a/nipype/utils/draw_gantt_chart.py +++ b/nipype/utils/draw_gantt_chart.py @@ -545,4 +545,3 @@ def generate_gantt_chart(logfile, cores, minute_scale=10, #save file with open(logfile + '.html', 'w' if PY3 else 'wb') as html_file: html_file.write(html_string) - diff --git a/nipype/utils/tests/test_cmd.py b/nipype/utils/tests/test_cmd.py index 776c5a5c11..d68e10bfa4 100644 --- a/nipype/utils/tests/test_cmd.py +++ b/nipype/utils/tests/test_cmd.py @@ -134,4 +134,3 @@ def test_run_4d_realign_help(self): assert stderr.getvalue() == '' assert "Run FmriRealign4d" in stdout.getvalue() - diff --git a/nipype/workflows/smri/freesurfer/autorecon3.py b/nipype/workflows/smri/freesurfer/autorecon3.py index 651c417f16..25115a8ba0 100644 --- a/nipype/workflows/smri/freesurfer/autorecon3.py +++ b/nipype/workflows/smri/freesurfer/autorecon3.py @@ -954,4 +954,3 @@ def out_aseg(in_aparcaseg, in_aseg, out_file): ar3_wf.connect([(qcache_wf, outputspec, [('outputspec.' + output, output)])]) return ar3_wf, ar3_outputs - diff --git a/nipype/workflows/smri/freesurfer/recon.py b/nipype/workflows/smri/freesurfer/recon.py index 1835f3dfd4..eec6856578 100644 --- a/nipype/workflows/smri/freesurfer/recon.py +++ b/nipype/workflows/smri/freesurfer/recon.py @@ -575,7 +575,3 @@ def completemethod(datasinked_files, subject_id): (completion, postds_outputspec, [('subject_id', 'subject_id')])]) return reconall - - - - diff --git a/nipype/workflows/smri/niftyreg/groupwise.py b/nipype/workflows/smri/niftyreg/groupwise.py index d222395223..0cbd88d304 100644 --- a/nipype/workflows/smri/niftyreg/groupwise.py +++ b/nipype/workflows/smri/niftyreg/groupwise.py @@ -390,4 +390,3 @@ def create_groupwise_average(name="atlas_creation", ]) return workflow - From fba83f104a1fd9196a2a5db25b467437d0eb4ae5 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 00:27:56 +0100 Subject: [PATCH 093/365] STY: correcting F402 - import 'op' from line 52 shadowed by loop variable --- nipype/pipeline/engine/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index 96ba23cd3d..ddd73e1e8a 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -296,8 +296,8 @@ def _write_detailed_dot(graph, dotfilename): if outport not in outports: outports.append(outport) outputstr = '{OUT' - for op in sorted(outports): - outputstr += '| %s' % (replacefunk(op), op) + for ops in sorted(outports): + outputstr += '| %s' % (replacefunk(ops), ops) outputstr += '}' srcpackage = '' if hasattr(n, '_interface'): From 8b663956e8ce20e6dbc3e5182a12766604bff620 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 00:50:24 +0100 Subject: [PATCH 094/365] STY: correcting of two F811 (not all) - redefinition of unused 'fsl' / 'open' --- examples/fmri_spm_auditory.py | 1 - nipype/interfaces/fsl/tests/test_preprocess.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fmri_spm_auditory.py b/examples/fmri_spm_auditory.py index 33c03f8bf0..caf044d47e 100755 --- a/examples/fmri_spm_auditory.py +++ b/examples/fmri_spm_auditory.py @@ -23,7 +23,6 @@ import nipype.interfaces.spm as spm # spm import nipype.interfaces.fsl as fsl # fsl import nipype.interfaces.matlab as mlab # how to run matlab -import nipype.interfaces.fsl as fsl # fsl import nipype.interfaces.utility as util # utility import nipype.pipeline.engine as pe # pypeline engine import nipype.algorithms.modelgen as model # model specification diff --git a/nipype/interfaces/fsl/tests/test_preprocess.py b/nipype/interfaces/fsl/tests/test_preprocess.py index 3d75d514a6..ece8b76c29 100644 --- a/nipype/interfaces/fsl/tests/test_preprocess.py +++ b/nipype/interfaces/fsl/tests/test_preprocess.py @@ -3,7 +3,7 @@ from builtins import str # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -from builtins import open, open +from builtins import open import os from copy import deepcopy From 920ff31f67bbcbd7fd21f530ec6d48c93e536b30 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 01:48:03 +0100 Subject: [PATCH 095/365] STY: correction of F841 - local variable 'xyz' is assigned to but never used --- doc/sphinxext/ipython_console_highlighting.py | 1 - doc/sphinxext/numpy_ext/docscrape.py | 3 +-- examples/fmri_ants_openfmri.py | 4 ---- nipype/algorithms/metrics.py | 4 +--- nipype/algorithms/misc.py | 6 +++--- nipype/algorithms/tests/test_mesh_ops.py | 1 - nipype/interfaces/cmtk/cmtk.py | 2 -- nipype/interfaces/dipy/reconstruction.py | 2 -- nipype/interfaces/dipy/simulate.py | 2 +- nipype/interfaces/elastix/registration.py | 1 - nipype/interfaces/freesurfer/model.py | 1 - nipype/interfaces/fsl/model.py | 1 - nipype/interfaces/matlab.py | 2 +- nipype/interfaces/mrtrix/convert.py | 3 --- nipype/interfaces/mrtrix/tensors.py | 2 -- nipype/interfaces/nipy/model.py | 1 - nipype/pipeline/engine/tests/test_join.py | 2 -- nipype/pipeline/engine/utils.py | 2 +- nipype/pipeline/plugins/lsf.py | 1 - nipype/pipeline/plugins/pbs.py | 1 - nipype/sphinxext/plot_workflow.py | 2 +- nipype/tests/test_nipype.py | 2 +- nipype/utils/logger.py | 2 +- nipype/utils/tests/test_filemanip.py | 3 +-- nipype/utils/tests/test_provenance.py | 1 - nipype/workflows/dmri/camino/connectivity_mapping.py | 1 - nipype/workflows/dmri/connectivity/group_connectivity.py | 2 +- nipype/workflows/dmri/dipy/denoise.py | 1 - nipype/workflows/dmri/fsl/epi.py | 1 - nipype/workflows/dmri/fsl/utils.py | 1 - tools/checkspecs.py | 3 +-- 31 files changed, 14 insertions(+), 47 deletions(-) diff --git a/doc/sphinxext/ipython_console_highlighting.py b/doc/sphinxext/ipython_console_highlighting.py index 6720056dc8..4960f9fcc3 100644 --- a/doc/sphinxext/ipython_console_highlighting.py +++ b/doc/sphinxext/ipython_console_highlighting.py @@ -59,7 +59,6 @@ class IPythonConsoleLexer(Lexer): def get_tokens_unprocessed(self, text): pylexer = PythonLexer(**self.options) - tblexer = PythonTracebackLexer(**self.options) curcode = '' insertions = [] diff --git a/doc/sphinxext/numpy_ext/docscrape.py b/doc/sphinxext/numpy_ext/docscrape.py index a4ff432715..5f5982b863 100644 --- a/doc/sphinxext/numpy_ext/docscrape.py +++ b/doc/sphinxext/numpy_ext/docscrape.py @@ -443,7 +443,7 @@ def __init__(self, func, role='func', doc=None, config={}): argspec = inspect.formatargspec(*argspec) argspec = argspec.replace('*', '\*') signature = '%s%s' % (func_name, argspec) - except TypeError as e: + except TypeError: signature = '%s()' % func_name self['Signature'] = signature @@ -459,7 +459,6 @@ def __str__(self): out = '' func, func_name = self.get_func() - signature = self['Signature'].replace('*', '\*') roles = {'func': 'function', 'meth': 'method'} diff --git a/examples/fmri_ants_openfmri.py b/examples/fmri_ants_openfmri.py index ee6ddee3f9..c30bc0f00a 100755 --- a/examples/fmri_ants_openfmri.py +++ b/examples/fmri_ants_openfmri.py @@ -203,8 +203,6 @@ def create_reg_workflow(name='registration'): Concatenate the affine and ants transforms into a list """ - pickfirst = lambda x: x[0] - merge = pe.Node(niu.Merge(2), iterfield=['in2'], name='mergexfm') register.connect(convert2itk, 'itk_transform', merge, 'in2') register.connect(reg, 'composite_transform', merge, 'in1') @@ -414,8 +412,6 @@ def create_fs_reg_workflow(name='registration'): Concatenate the affine and ants transforms into a list """ - pickfirst = lambda x: x[0] - merge = Node(Merge(2), iterfield=['in2'], name='mergexfm') register.connect(convert2itk, 'itk_transform', merge, 'in2') register.connect(reg, 'composite_transform', merge, 'in1') diff --git a/nipype/algorithms/metrics.py b/nipype/algorithms/metrics.py index 23963de679..76f37a84f7 100644 --- a/nipype/algorithms/metrics.py +++ b/nipype/algorithms/metrics.py @@ -298,8 +298,6 @@ def _run_interface(self, runtime): data1 = data1.astype(np.min_scalar_type(max1)) data2 = nii2.get_data().astype(np.min_scalar_type(max1)) data2[np.logical_or(data1 < 0, np.isnan(data1))] = 0 - max2 = data2.max() - maxlabel = max(max1, max2) if isdefined(self.inputs.mask_volume): maskdata = nb.load(self.inputs.mask_volume).get_data() @@ -630,7 +628,7 @@ class Similarity(BaseInterface): def __init__(self, **inputs): try: package_check('nipy') - except Exception as e: + except Exception: self._have_nipy = False super(Similarity, self).__init__(**inputs) diff --git a/nipype/algorithms/misc.py b/nipype/algorithms/misc.py index a16507bf36..c6b91b1a7a 100644 --- a/nipype/algorithms/misc.py +++ b/nipype/algorithms/misc.py @@ -410,10 +410,10 @@ def merge_csvs(in_list): for idx, in_file in enumerate(in_list): try: in_array = np.loadtxt(in_file, delimiter=',') - except ValueError as ex: + except ValueError: try: in_array = np.loadtxt(in_file, delimiter=',', skiprows=1) - except ValueError as ex: + except ValueError: with open(in_file, 'r') as first: header_line = first.readline() @@ -424,7 +424,7 @@ def merge_csvs(in_list): in_file, delimiter=',', skiprows=1, usecols=list(range(1, n_cols)) ) - except ValueError as ex: + except ValueError: in_array = np.loadtxt( in_file, delimiter=',', skiprows=1, usecols=list(range(1, n_cols - 1))) if idx == 0: diff --git a/nipype/algorithms/tests/test_mesh_ops.py b/nipype/algorithms/tests/test_mesh_ops.py index d5fbc56825..53eec75b69 100644 --- a/nipype/algorithms/tests/test_mesh_ops.py +++ b/nipype/algorithms/tests/test_mesh_ops.py @@ -32,7 +32,6 @@ def test_ident_distances(tmpdir): @pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed") def test_trans_distances(tmpdir): - tempdir = tmpdir.strpath from ...interfaces.vtkbase import tvtk in_surf = example_data('surf01.vtk') diff --git a/nipype/interfaces/cmtk/cmtk.py b/nipype/interfaces/cmtk/cmtk.py index 2f29bbb2e2..2da8a3a003 100644 --- a/nipype/interfaces/cmtk/cmtk.py +++ b/nipype/interfaces/cmtk/cmtk.py @@ -146,7 +146,6 @@ def create_endpoints_array(fib, voxelSize): n = len(fib) endpoints = np.zeros((n, 2, 3)) endpointsmm = np.zeros((n, 2, 3)) - pc = -1 # Computation for each fiber for i, fi in enumerate(fib): @@ -756,7 +755,6 @@ def create_nodes(roi_file, resolution_network_file, out_filename): gp = nx.read_graphml(resolution_network_file) roi_image = nb.load(roi_file, mmap=NUMPY_MMAP) roiData = roi_image.get_data() - nROIs = len(gp.nodes()) for u, d in gp.nodes(data=True): G.add_node(int(u), **d) xyz = tuple(np.mean(np.where(np.flipud(roiData) == int(d["dn_correspondence_id"])), axis=1)) diff --git a/nipype/interfaces/dipy/reconstruction.py b/nipype/interfaces/dipy/reconstruction.py index d10e51dede..763de075b6 100644 --- a/nipype/interfaces/dipy/reconstruction.py +++ b/nipype/interfaces/dipy/reconstruction.py @@ -324,7 +324,6 @@ def _run_interface(self, runtime): img = nb.load(self.inputs.in_file) imref = nb.four_to_three(img)[0] - affine = img.affine if isdefined(self.inputs.in_mask): msk = nb.load(self.inputs.in_mask).get_data() @@ -332,7 +331,6 @@ def _run_interface(self, runtime): msk = np.ones(imref.shape) data = img.get_data().astype(np.float32) - hdr = imref.header.copy() gtab = self._get_gradient_table() resp_file = np.loadtxt(self.inputs.response) diff --git a/nipype/interfaces/dipy/simulate.py b/nipype/interfaces/dipy/simulate.py index f008948c97..a2fe7c688b 100644 --- a/nipype/interfaces/dipy/simulate.py +++ b/nipype/interfaces/dipy/simulate.py @@ -287,7 +287,7 @@ def _compute_voxel(args): signal, _ = multi_tensor( gtab, args['mevals'], S0=args['S0'], angles=args['sticks'], fractions=ffs, snr=snr) - except Exception as e: + except Exception: pass return signal.tolist() diff --git a/nipype/interfaces/elastix/registration.py b/nipype/interfaces/elastix/registration.py index 5038447465..aa02b392a7 100644 --- a/nipype/interfaces/elastix/registration.py +++ b/nipype/interfaces/elastix/registration.py @@ -70,7 +70,6 @@ def _list_outputs(self): out_dir = op.abspath(self.inputs.output_path) - opts = ['WriteResultImage', 'ResultImageFormat'] regex = re.compile(r'^\((\w+)\s(.+)\)$') outputs['transform'] = [] diff --git a/nipype/interfaces/freesurfer/model.py b/nipype/interfaces/freesurfer/model.py index e2eba23196..71de48d786 100644 --- a/nipype/interfaces/freesurfer/model.py +++ b/nipype/interfaces/freesurfer/model.py @@ -1311,7 +1311,6 @@ def _gen_filename(self, name): avg_directory = os.path.join(self.inputs.subjects_dir, avg_subject) if not os.path.isdir(avg_directory): fs_home = os.path.abspath(os.environ.get('FREESURFER_HOME')) - avg_home = os.path.join(fs_home, 'subjects', 'fsaverage') return avg_subject elif name == 'out_file': return self._list_outputs()[name] diff --git a/nipype/interfaces/fsl/model.py b/nipype/interfaces/fsl/model.py index f130c01679..53f745082e 100644 --- a/nipype/interfaces/fsl/model.py +++ b/nipype/interfaces/fsl/model.py @@ -766,7 +766,6 @@ def _list_outputs(self): varcopes = [] zstats = [] tstats = [] - neffs = [] for i in range(numtcons): copes.append(self._gen_fname( 'cope%d.nii' % (base_contrast + i), cwd=pth)) diff --git a/nipype/interfaces/matlab.py b/nipype/interfaces/matlab.py index 0d8aa29e16..f7d27cf455 100644 --- a/nipype/interfaces/matlab.py +++ b/nipype/interfaces/matlab.py @@ -25,7 +25,7 @@ def get_matlab_command(): resource_monitor=False, terminal_output='allatonce').run() matlab_path = res.runtime.stdout.strip() - except Exception as e: + except Exception: return None return matlab_cmd diff --git a/nipype/interfaces/mrtrix/convert.py b/nipype/interfaces/mrtrix/convert.py index eb34de974e..bbfca852f2 100644 --- a/nipype/interfaces/mrtrix/convert.py +++ b/nipype/interfaces/mrtrix/convert.py @@ -86,8 +86,6 @@ def read_mrtrix_streamlines(in_file, header, as_generator=True): bytesize = pt_cols * 4 def points_per_track(offset): - n_streams = 0 - n_points = 0 track_points = [] iflogger.info('Identifying the number of points per tract...') all_str = fileobj.read() @@ -95,7 +93,6 @@ def points_per_track(offset): pts = np.ndarray(shape=(num_triplets, pt_cols), dtype='f4', buffer=all_str) nonfinite_list = np.where(np.isfinite(pts[:, 2]) == False) nonfinite_list = list(nonfinite_list[0])[0:-1] # Converts numpy array to list, removes the last value - nonfinite_list_bytes = [offset + x * bytesize for x in nonfinite_list] for idx, value in enumerate(nonfinite_list): if idx == 0: track_points.append(nonfinite_list[idx]) diff --git a/nipype/interfaces/mrtrix/tensors.py b/nipype/interfaces/mrtrix/tensors.py index 025d45b2e5..0d493e982d 100644 --- a/nipype/interfaces/mrtrix/tensors.py +++ b/nipype/interfaces/mrtrix/tensors.py @@ -236,9 +236,7 @@ def _gen_outfilename(self): def concat_files(bvec_file, bval_file, invert_x, invert_y, invert_z): bvecs = np.loadtxt(bvec_file) bvals = np.loadtxt(bval_file) - flip = False if np.shape(bvecs)[0] > np.shape(bvecs)[1]: - flip = True bvecs = np.transpose(bvecs) if invert_x: bvecs[0, :] = -bvecs[0, :] diff --git a/nipype/interfaces/nipy/model.py b/nipype/interfaces/nipy/model.py index 58c07b5b95..ca8669faae 100644 --- a/nipype/interfaces/nipy/model.py +++ b/nipype/interfaces/nipy/model.py @@ -285,7 +285,6 @@ def _run_interface(self, runtime): self._z_maps = [] for contrast_def in self.inputs.contrasts: name = contrast_def[0] - _ = contrast_def[1] contrast = np.zeros(len(reg_names)) for i, reg_name in enumerate(reg_names): diff --git a/nipype/pipeline/engine/tests/test_join.py b/nipype/pipeline/engine/tests/test_join.py index 33438cdacf..0dce4307e7 100644 --- a/nipype/pipeline/engine/tests/test_join.py +++ b/nipype/pipeline/engine/tests/test_join.py @@ -198,8 +198,6 @@ def test_node_joinsource(tmpdir): """Test setting the joinsource to a Node.""" tmpdir.chdir() - # Make the workflow. - wf = pe.Workflow(name='test') # the iterated input node inputspec = pe.Node(IdentityInterface(fields=['n']), name='inputspec') inputspec.iterables = [('n', [1, 2])] diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index ddd73e1e8a..62fb2a8d73 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -90,7 +90,7 @@ def _write_inputs(node): if type(val) == str: try: func = create_function_from_source(val) - except RuntimeError as e: + except RuntimeError: lines.append("%s.inputs.%s = '%s'" % (nodename, key, val)) else: funcname = [name for name in func.__globals__ diff --git a/nipype/pipeline/plugins/lsf.py b/nipype/pipeline/plugins/lsf.py index 5ee0483221..dfaacb42d8 100644 --- a/nipype/pipeline/plugins/lsf.py +++ b/nipype/pipeline/plugins/lsf.py @@ -65,7 +65,6 @@ def _submit_batchtask(self, scriptfile, node): cmd = CommandLine('bsub', environ=dict(os.environ), resource_monitor=False, terminal_output='allatonce') - path = os.path.dirname(scriptfile) bsubargs = '' if self._bsub_args: bsubargs = self._bsub_args diff --git a/nipype/pipeline/plugins/pbs.py b/nipype/pipeline/plugins/pbs.py index 6154abad74..fecfba37be 100644 --- a/nipype/pipeline/plugins/pbs.py +++ b/nipype/pipeline/plugins/pbs.py @@ -52,7 +52,6 @@ def _is_pending(self, taskid): terminal_output='allatonce', resource_monitor=False, ignore_exception=True).run() - stderr = result.runtime.stderr errmsg = 'Unknown Job Id' # %s' % taskid success = 'Job has finished' if success in e: # Fix for my PBS diff --git a/nipype/sphinxext/plot_workflow.py b/nipype/sphinxext/plot_workflow.py index 8876a6878d..46ccad7a01 100644 --- a/nipype/sphinxext/plot_workflow.py +++ b/nipype/sphinxext/plot_workflow.py @@ -521,7 +521,7 @@ def render_figures(code, code_path, output_dir, output_base, context, graph2use=graph2use, simple_form=simple_form) shutil.move(src, img_path) - except Exception as err: + except Exception: raise GraphError(traceback.format_exc()) img.formats.append(fmt) diff --git a/nipype/tests/test_nipype.py b/nipype/tests/test_nipype.py index 05aa1abf86..a81910b4d2 100644 --- a/nipype/tests/test_nipype.py +++ b/nipype/tests/test_nipype.py @@ -4,7 +4,7 @@ def test_nipype_info(): exception_not_raised = True try: get_info() - except Exception as e: + except Exception: exception_not_raised = False assert exception_not_raised diff --git a/nipype/utils/logger.py b/nipype/utils/logger.py index 4604cc4145..259eb4f8aa 100644 --- a/nipype/utils/logger.py +++ b/nipype/utils/logger.py @@ -128,7 +128,7 @@ def logdebug_dict_differences(self, dold, dnew, prefix=""): # tuples, we might need to cast them into the same type # as the last resort. And lets try to be more generic same = old.__class__(new) == old - except Exception as e: + except Exception: same = False if not same: msgs += ["%s: %r != %r" diff --git a/nipype/utils/tests/test_filemanip.py b/nipype/utils/tests/test_filemanip.py index d50bef355a..029bfa7320 100644 --- a/nipype/utils/tests/test_filemanip.py +++ b/nipype/utils/tests/test_filemanip.py @@ -165,7 +165,6 @@ def test_recopy(_temp_analyze_files): orig_img, orig_hdr = _temp_analyze_files pth, fname = os.path.split(orig_img) img_link = os.path.join(pth, 'imglink.img') - hdr_link = os.path.join(pth, 'imglink.hdr') new_img = os.path.join(pth, 'newfile.img') new_hdr = os.path.join(pth, 'newfile.hdr') copyfile(orig_img, img_link) @@ -299,7 +298,7 @@ def touch(fname): os.unlink(dependencies[0]) try: check_depends(targets, dependencies) - except OSError as e: + except OSError: pass else: assert False, "Should raise OSError on missing dependency" diff --git a/nipype/utils/tests/test_provenance.py b/nipype/utils/tests/test_provenance.py index ce35a95aac..78ef23f77f 100644 --- a/nipype/utils/tests/test_provenance.py +++ b/nipype/utils/tests/test_provenance.py @@ -17,7 +17,6 @@ def test_provenance(): results = CommandLine('echo hello').run() ps.add_results(results) provn = ps.g.get_provn() - prov_json = ps.g.serialize(format='json') assert 'echo hello' in provn def test_provenance_exists(tmpdir): diff --git a/nipype/workflows/dmri/camino/connectivity_mapping.py b/nipype/workflows/dmri/camino/connectivity_mapping.py index d0d2a1c820..17b9f1d6bc 100644 --- a/nipype/workflows/dmri/camino/connectivity_mapping.py +++ b/nipype/workflows/dmri/camino/connectivity_mapping.py @@ -248,7 +248,6 @@ def create_connectivity_pipeline(name="connectivity"): giftiLabels = pe.Node(interface=util.Merge(2), name="GiftiLabels") niftiVolumes = pe.Node(interface=util.Merge(3), name="NiftiVolumes") fiberDataArrays = pe.Node(interface=util.Merge(4), name="FiberDataArrays") - gpickledNetworks = pe.Node(interface=util.Merge(1), name="NetworkFiles") """ Since we have now created all our nodes, we can define our workflow and start making connections. diff --git a/nipype/workflows/dmri/connectivity/group_connectivity.py b/nipype/workflows/dmri/connectivity/group_connectivity.py index 9efd45bf50..3ecef6c0bc 100644 --- a/nipype/workflows/dmri/connectivity/group_connectivity.py +++ b/nipype/workflows/dmri/connectivity/group_connectivity.py @@ -71,7 +71,7 @@ def concatcsv(in_files): first.close() for in_file in in_files: file_to_read = open(in_file, 'r') - scrap_first_line = file_to_read.readline() + file_to_read.readline() # scrap first line for line in file_to_read: out_file.write(line) return out_name diff --git a/nipype/workflows/dmri/dipy/denoise.py b/nipype/workflows/dmri/dipy/denoise.py index fb0cbc7a8c..a3c83521d4 100644 --- a/nipype/workflows/dmri/dipy/denoise.py +++ b/nipype/workflows/dmri/dipy/denoise.py @@ -113,7 +113,6 @@ def bg_mask(in_file, in_mask, out_file=None): hdr = im.header.copy() hdr.set_data_dtype(np.uint8) hdr.set_xyzt_units('mm') - imdata = im.get_data() msk = nb.load(in_mask, mmap=NUMPY_MMAP).get_data() msk = 1 - binary_dilation(msk, structure=np.ones((20, 20, 20))) nb.Nifti1Image(msk.astype(np.uint8), im.affine, hdr).to_filename(out_file) diff --git a/nipype/workflows/dmri/fsl/epi.py b/nipype/workflows/dmri/fsl/epi.py index 44b0bd9402..5c1be569f8 100644 --- a/nipype/workflows/dmri/fsl/epi.py +++ b/nipype/workflows/dmri/fsl/epi.py @@ -693,7 +693,6 @@ def _cat_logs(in_files): if fext == '.gz': name, _ = os.path.splitext(name) out_file = os.path.abspath('./%s_ecclog.log' % name) - out_str = '' with open(out_file, 'wb') as totallog: for i, fname in enumerate(in_files): totallog.write('\n\npreprocessing %d\n' % i) diff --git a/nipype/workflows/dmri/fsl/utils.py b/nipype/workflows/dmri/fsl/utils.py index d2ea118a9a..90b4ece048 100644 --- a/nipype/workflows/dmri/fsl/utils.py +++ b/nipype/workflows/dmri/fsl/utils.py @@ -370,7 +370,6 @@ def recompose_xfm(in_bval, in_xfms): import os.path as op bvals = np.loadtxt(in_bval) - out_matrix = np.array([np.eye(4)] * len(bvals)) xfms = iter([np.loadtxt(xfm) for xfm in in_xfms]) out_files = [] diff --git a/tools/checkspecs.py b/tools/checkspecs.py index a30c5d0bbb..95c748e52a 100644 --- a/tools/checkspecs.py +++ b/tools/checkspecs.py @@ -190,7 +190,6 @@ def test_specs(self, uri): # Make a shorter version of the uri that omits the package name for # titles - uri_short = re.sub(r'^%s\.' % self.package_name, '', uri) allowed_keys = ['desc', 'genfile', 'xor', 'requires', 'desc', 'nohash', 'argstr', 'position', 'mandatory', 'copyfile', 'usedefault', 'sep', 'hash_files', @@ -206,7 +205,7 @@ def test_specs(self, uri): with warnings.catch_warnings(): warnings.simplefilter("ignore") classinst = sys.modules[uri].__dict__[c] - except Exception as inst: + except Exception: continue if not issubclass(classinst, BaseInterface): From 9adf3109841d89bf0f4417497b01fdf33abcd2ca Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 01:58:24 +0100 Subject: [PATCH 096/365] STY: correction of F999 - xyz be undefined, or defined from star imports: interfaces.freesurfer --- nipype/testing/decorators.py | 2 +- nipype/workflows/smri/freesurfer/ba_maps.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nipype/testing/decorators.py b/nipype/testing/decorators.py index 35de0cbf00..eea15536f7 100644 --- a/nipype/testing/decorators.py +++ b/nipype/testing/decorators.py @@ -5,7 +5,7 @@ Extend numpy's decorators to use nipype's gui and data labels. """ -from numpy.testing.decorators import * +from numpy.testing.decorators import knownfailureif, skipif from nibabel.data import DataError diff --git a/nipype/workflows/smri/freesurfer/ba_maps.py b/nipype/workflows/smri/freesurfer/ba_maps.py index 05f1ec8efe..ef211f49b5 100644 --- a/nipype/workflows/smri/freesurfer/ba_maps.py +++ b/nipype/workflows/smri/freesurfer/ba_maps.py @@ -3,7 +3,7 @@ import os from ....interfaces.utility import Function, IdentityInterface from ....pipeline import engine as pe # pypeline engine -from ....interfaces.freesurfer import * +from ....interfaces.freesurfer import Label2Label, Label2Annot, ParcellationStats from ....interfaces.io import DataGrabber from ....interfaces.utility import Merge From 67b2a0778ef26d2b4d7ba043a187117eea09c9f5 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:06:47 +0100 Subject: [PATCH 097/365] STY: correction of E129 - visually indented line with same indent as next logical line --- nipype/interfaces/spm/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/spm/model.py b/nipype/interfaces/spm/model.py index 8ddc06a9b0..a62d0f8ef8 100644 --- a/nipype/interfaces/spm/model.py +++ b/nipype/interfaces/spm/model.py @@ -259,7 +259,7 @@ def _list_outputs(self): betas = [vbeta.fname[0] for vbeta in spm['SPM'][0, 0].Vbeta[0]] if ('Bayesian' in self.inputs.estimation_method.keys() or - 'Bayesian2' in self.inputs.estimation_method.keys()): + 'Bayesian2' in self.inputs.estimation_method.keys()): outputs['labels'] = os.path.join(pth, 'labels.{}'.format(outtype)) outputs['SDerror'] = glob(os.path.join(pth, 'Sess*_SDerror*')) From ea91c746a36285fcf362e6f99004b25d16424ee2 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:12:19 +0100 Subject: [PATCH 098/365] STY: correction of E266 - too many leading '#' for block comment --- nipype/workflows/smri/freesurfer/autorecon2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/workflows/smri/freesurfer/autorecon2.py b/nipype/workflows/smri/freesurfer/autorecon2.py index 4ef83a835e..8f8ba879f8 100644 --- a/nipype/workflows/smri/freesurfer/autorecon2.py +++ b/nipype/workflows/smri/freesurfer/autorecon2.py @@ -516,7 +516,7 @@ def create_AutoRecon2(name="AutoRecon2", longitudinal=False, ('brain', 'in_brain')])]) - ## TODO: halt workflow for bad euler number + # TODO: halt workflow for bad euler number euler_number = pe.Node(EulerNumber(), name="Euler_Number") hemi_wf.connect([(fix_topology, euler_number, [('out_file', 'in_file')]), From 149322e6066750a92114e7c4114e6bda19ebbe09 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:13:18 +0100 Subject: [PATCH 099/365] STY: correction of E271 - multiple spaces after keyword --- nipype/pipeline/plugins/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/pipeline/plugins/__init__.py b/nipype/pipeline/plugins/__init__.py index 34d3abdebc..bbe2f3b558 100644 --- a/nipype/pipeline/plugins/__init__.py +++ b/nipype/pipeline/plugins/__init__.py @@ -20,4 +20,4 @@ from .slurm import SLURMPlugin from .slurmgraph import SLURMGraphPlugin -from . import semaphore_singleton +from . import semaphore_singleton From 4123f96e5283edb73620b8a09f5aaccac2192fe4 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:14:38 +0100 Subject: [PATCH 100/365] STY: correction of E714 - test for object identity should be 'is not' --- nipype/interfaces/bids_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/bids_utils.py b/nipype/interfaces/bids_utils.py index 0259a80352..ba6ca3e2c8 100644 --- a/nipype/interfaces/bids_utils.py +++ b/nipype/interfaces/bids_utils.py @@ -98,7 +98,7 @@ def __init__(self, infields=None, **kwargs): "anat": {"modality": "anat"}} # If infields is empty, use all BIDS entities - if not infields is None and have_pybids: + if infields is not None and have_pybids: bids_config = join(dirname(gb.__file__), 'config', 'bids.json') bids_config = json.load(open(bids_config, 'r')) infields = [i['name'] for i in bids_config['entities']] From 2bd5af0d0fbc3af2dbcc866495f0b4941bf8d67e Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:16:46 +0100 Subject: [PATCH 101/365] STY: correction of E125 - continuation line with same indent as next logical line --- nipype/interfaces/spm/preprocess.py | 2 +- nipype/pipeline/engine/nodes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/spm/preprocess.py b/nipype/interfaces/spm/preprocess.py index 0eebf3c6b8..0862e22b7c 100644 --- a/nipype/interfaces/spm/preprocess.py +++ b/nipype/interfaces/spm/preprocess.py @@ -259,7 +259,7 @@ def _list_outputs(self): if resliced_all: outputs['realigned_files'] = [] for idx, imgf in enumerate( - filename_to_list(self.inputs.in_files)): + filename_to_list(self.inputs.in_files)): realigned_run = [] if isinstance(imgf, list): for i, inner_imgf in enumerate(filename_to_list(imgf)): diff --git a/nipype/pipeline/engine/nodes.py b/nipype/pipeline/engine/nodes.py index 5b972a7692..9b101fa61a 100644 --- a/nipype/pipeline/engine/nodes.py +++ b/nipype/pipeline/engine/nodes.py @@ -222,7 +222,7 @@ def n_procs(self): if self._n_procs is not None: return self._n_procs elif hasattr(self._interface.inputs, 'num_threads') and isdefined( - self._interface.inputs.num_threads): + self._interface.inputs.num_threads): return self._interface.inputs.num_threads else: return 1 From 52b7f7f72fadfea46ab2d1b56ad8f5ce2782851f Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:17:59 +0100 Subject: [PATCH 102/365] STY: correction of E222 - multiple spaces after operator --- nipype/interfaces/spm/model.py | 2 +- nipype/workflows/smri/freesurfer/autorecon1.py | 2 +- nipype/workflows/smri/freesurfer/autorecon2.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/spm/model.py b/nipype/interfaces/spm/model.py index a62d0f8ef8..4ab96a4693 100644 --- a/nipype/interfaces/spm/model.py +++ b/nipype/interfaces/spm/model.py @@ -273,7 +273,7 @@ def _list_outputs(self): if 'Classical' in self.inputs.estimation_method.keys(): outputs['residual_image'] = os.path.join(pth, 'ResMS.{}'.format(outtype)) - outputs['RPVimage'] = os.path.join(pth, + outputs['RPVimage'] = os.path.join(pth, 'RPV.{}'.format(outtype)) if self.inputs.write_residuals: outputs['residual_images'] = glob(os.path.join(pth, 'Res_*')) diff --git a/nipype/workflows/smri/freesurfer/autorecon1.py b/nipype/workflows/smri/freesurfer/autorecon1.py index 6ced37b1ee..62bd4437df 100644 --- a/nipype/workflows/smri/freesurfer/autorecon1.py +++ b/nipype/workflows/smri/freesurfer/autorecon1.py @@ -244,7 +244,7 @@ def createTemplate(in_files, out_file): if stop: bias_correction.inputs.stop = stop if shrink: - bias_correction.inputs.shrink = shrink + bias_correction.inputs.shrink = shrink bias_correction.inputs.no_rescale = True bias_correction.inputs.out_file = 'orig_nu.mgz' diff --git a/nipype/workflows/smri/freesurfer/autorecon2.py b/nipype/workflows/smri/freesurfer/autorecon2.py index 8f8ba879f8..acd6c6d97f 100644 --- a/nipype/workflows/smri/freesurfer/autorecon2.py +++ b/nipype/workflows/smri/freesurfer/autorecon2.py @@ -69,7 +69,7 @@ def create_AutoRecon2(name="AutoRecon2", longitudinal=False, if stop: intensity_correction.inputs.stop = stop if shrink: - intensity_correction.inputs.shrink = shrink + intensity_correction.inputs.shrink = shrink intensity_correction.inputs.distance = distance add_to_header_nu = pe.Node(AddXFormToHeader(), name="Add_XForm_to_NU") From 0a754e0725fc31ac54492f2d54bf96211ffab13d Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:19:49 +0100 Subject: [PATCH 103/365] STY: correction of E228 - missing whitespace around modulo operator --- nipype/interfaces/afni/utils.py | 4 ++-- nipype/pipeline/engine/tests/test_join.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 3e03adda92..922e6fd05c 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -407,7 +407,7 @@ class Bucket(AFNICommand): def _format_arg(self, name, spec, value): if name == 'in_file': - return spec.argstr%(' '.join([i[0]+"'"+i[1]+"'" for i in value])) + return spec.argstr % (' '.join([i[0] + "'" + i[1] + "'" for i in value])) return super(Bucket, self)._format_arg(name, spec, value) class CalcInputSpec(AFNICommandInputSpec): @@ -639,7 +639,7 @@ class CatMatvec(AFNICommand): def _format_arg(self, name, spec, value): if name == 'in_file': - return spec.argstr%(' '.join([i[0]+' -'+i[1] for i in value])) + return spec.argstr % (' '.join([i[0] + ' -' + i[1] for i in value])) return super(CatMatvec, self)._format_arg(name, spec, value) diff --git a/nipype/pipeline/engine/tests/test_join.py b/nipype/pipeline/engine/tests/test_join.py index 0dce4307e7..8b8608b248 100644 --- a/nipype/pipeline/engine/tests/test_join.py +++ b/nipype/pipeline/engine/tests/test_join.py @@ -560,7 +560,7 @@ def nested_wf(i, name='smallwf'): joinfield='n', name='join') #define and connect nested workflow - wf = pe.Workflow(name='wf_%d'%i[0]) + wf = pe.Workflow(name='wf_%d' % i[0]) wf.connect(inputspec, 'n', pre_join, 'input1') wf.connect(pre_join, 'output1', join, 'n') return wf From 41cf6ae6dc366bdb293f57c258b9473c22d3a2b4 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:21:41 +0100 Subject: [PATCH 104/365] STY: correction of E713 - test for membership should be 'not in' --- nipype/interfaces/dcm2nii.py | 2 +- nipype/interfaces/fsl/model.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py index 22e9375609..88ed4b1f52 100644 --- a/nipype/interfaces/dcm2nii.py +++ b/nipype/interfaces/dcm2nii.py @@ -171,7 +171,7 @@ def _parse_stdout(self, stdout): out_file = val if out_file: - if not out_file in files: + if out_file not in files: files.append(out_file) last_added_file = out_file continue diff --git a/nipype/interfaces/fsl/model.py b/nipype/interfaces/fsl/model.py index 53f745082e..9cbee3fd3d 100644 --- a/nipype/interfaces/fsl/model.py +++ b/nipype/interfaces/fsl/model.py @@ -200,9 +200,9 @@ def _create_ev_files( ev_parameters['ev_num'] = num_evs[0] ev_parameters['ev_name'] = name ev_parameters['tempfilt_yn'] = do_tempfilter - if not 'basisorth' in ev_parameters: + if 'basisorth' not in ev_parameters: ev_parameters['basisorth'] = 1 - if not 'basisfnum' in ev_parameters: + if 'basisfnum' not in ev_parameters: ev_parameters['basisfnum'] = 1 try: ev_parameters['fsldir'] = os.environ['FSLDIR'] From 2a7350749d0574884190b17aaa599ea4dca862a2 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:23:54 +0100 Subject: [PATCH 105/365] STY: correction of E202 - whitespace before ')' --- nipype/interfaces/ants/tests/test_resampling.py | 2 +- nipype/interfaces/fsl/aroma.py | 2 +- nipype/workflows/smri/freesurfer/autorecon3.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index 509ebfe844..a34f138ee5 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -9,7 +9,7 @@ @pytest.fixture() def change_dir(request): orig_dir = os.getcwd() - filepath = os.path.dirname( os.path.realpath( __file__ ) ) + filepath = os.path.dirname( os.path.realpath( __file__)) datadir = os.path.realpath(os.path.join(filepath, '../../../testing/data')) os.chdir(datadir) diff --git a/nipype/interfaces/fsl/aroma.py b/nipype/interfaces/fsl/aroma.py index fb8dc82bd8..f654e8bdc3 100644 --- a/nipype/interfaces/fsl/aroma.py +++ b/nipype/interfaces/fsl/aroma.py @@ -64,7 +64,7 @@ class ICA_AROMAOutputSpec(TraitedSpec): aggr_denoised_file = File(exists=True, desc='if generated: aggressively denoised volume') nonaggr_denoised_file = File(exists=True, - desc='if generated: non aggressively denoised volume' ) + desc='if generated: non aggressively denoised volume') out_dir = Directory(exists=True, desc='directory contains (in addition to the denoised files): ' 'melodic.ica + classified_motion_components + ' diff --git a/nipype/workflows/smri/freesurfer/autorecon3.py b/nipype/workflows/smri/freesurfer/autorecon3.py index 25115a8ba0..7afaa06469 100644 --- a/nipype/workflows/smri/freesurfer/autorecon3.py +++ b/nipype/workflows/smri/freesurfer/autorecon3.py @@ -339,7 +339,7 @@ def create_AutoRecon3(name="AutoRecon3", qcache=False, plugin_args=None, intrinsic curvature index. """ parcellation_stats_white = pe.Node( - ParcellationStats(), name="Parcellation_Stats_{0}_White".format(hemisphere) ) + ParcellationStats(), name="Parcellation_Stats_{0}_White".format(hemisphere)) parcellation_stats_white.inputs.mgz = True parcellation_stats_white.inputs.th3 = th3 parcellation_stats_white.inputs.tabular_output = True From f74b57fb381307086694b4fb3b54d4c57f882d75 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:27:08 +0100 Subject: [PATCH 106/365] STY: correction of E201 - whitespace after '{' --- .../interfaces/ants/tests/test_resampling.py | 2 +- nipype/interfaces/freesurfer/utils.py | 4 +-- nipype/workflows/smri/freesurfer/utils.py | 26 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index a34f138ee5..c51d497794 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -9,7 +9,7 @@ @pytest.fixture() def change_dir(request): orig_dir = os.getcwd() - filepath = os.path.dirname( os.path.realpath( __file__)) + filepath = os.path.dirname(os.path.realpath(__file__)) datadir = os.path.realpath(os.path.join(filepath, '../../../testing/data')) os.chdir(datadir) diff --git a/nipype/interfaces/freesurfer/utils.py b/nipype/interfaces/freesurfer/utils.py index a5568ebbcb..d3eb7b611d 100644 --- a/nipype/interfaces/freesurfer/utils.py +++ b/nipype/interfaces/freesurfer/utils.py @@ -1743,7 +1743,7 @@ class MRIsInflateInputSpec(FSTraitedSpec): hash_files=False, keep_extension=True, desc="Output file for MRIsInflate") # optional - out_sulc = File( exists=False, + out_sulc = File(exists=False, xor=['no_save_sulc'], desc="Output sulc file") no_save_sulc = traits.Bool(argstr='-no-save-sulc', @@ -1796,7 +1796,7 @@ class SphereInputSpec(FSTraitedSpecOpenMP): desc="Seed for setting random number generator") magic = traits.Bool(argstr="-q", desc="No documentation. Direct questions to analysis-bugs@nmr.mgh.harvard.edu") - in_smoothwm = File( exists=True, copyfile=True, + in_smoothwm = File(exists=True, copyfile=True, desc="Input surface required when -q flag is not selected") diff --git a/nipype/workflows/smri/freesurfer/utils.py b/nipype/workflows/smri/freesurfer/utils.py index 6ee04c9673..838333b093 100644 --- a/nipype/workflows/smri/freesurfer/utils.py +++ b/nipype/workflows/smri/freesurfer/utils.py @@ -422,19 +422,19 @@ def mkdir_p(path): raise def getdefaultconfig(exitonfail=False, rb_date="2014-08-21"): - config = { 'custom_atlas' : None, - 'cw256' : False, - 'field_strength' : '1.5T', - 'fs_home' : checkenv(exitonfail), - 'longitudinal' : False, - 'long_base' : None, - 'openmp' : None, - 'plugin_args' : None, - 'qcache' : False, - 'queue' : None, - 'recoding_file' : None, - 'src_subject_id' : 'fsaverage', - 'th3' : True} + config = {'custom_atlas' : None, + 'cw256' : False, + 'field_strength' : '1.5T', + 'fs_home' : checkenv(exitonfail), + 'longitudinal' : False, + 'long_base' : None, + 'openmp' : None, + 'plugin_args' : None, + 'qcache' : False, + 'queue' : None, + 'recoding_file' : None, + 'src_subject_id' : 'fsaverage', + 'th3' : True} config['src_subject_dir'] = os.path.join(config['fs_home'], 'subjects', config['src_subject_id']) From d0bbf3bb911d8651a14e36f87f607fa39d09a02c Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:29:05 +0100 Subject: [PATCH 107/365] STY: correction of E211 - whitespace before '(' --- nipype/interfaces/fsl/preprocess.py | 2 +- nipype/interfaces/petpvc.py | 6 +++--- nipype/scripts/crash_files.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nipype/interfaces/fsl/preprocess.py b/nipype/interfaces/fsl/preprocess.py index 4ffeead842..4f2e77c698 100644 --- a/nipype/interfaces/fsl/preprocess.py +++ b/nipype/interfaces/fsl/preprocess.py @@ -1023,7 +1023,7 @@ def write_config(self, configfile): try: fid = open(configfile, 'w+') except IOError: - print ('unable to create config_file %s' % (configfile)) + print('unable to create config_file %s' % (configfile)) for item in list(self.inputs.get().items()): fid.write('%s\n' % (item)) diff --git a/nipype/interfaces/petpvc.py b/nipype/interfaces/petpvc.py index dbb3a25d1a..8de4cfd162 100644 --- a/nipype/interfaces/petpvc.py +++ b/nipype/interfaces/petpvc.py @@ -48,9 +48,9 @@ class PETPVCInputSpec(CommandLineInputSpec): fwhm_x = traits.Float(desc="The full-width at half maximum in mm along x-axis", mandatory=True, argstr="-x %.4f") fwhm_y = traits.Float(desc="The full-width at half maximum in mm along y-axis", mandatory=True, argstr="-y %.4f") fwhm_z = traits.Float(desc="The full-width at half maximum in mm along z-axis", mandatory=True, argstr="-z %.4f") - debug = traits.Bool (desc="Prints debug information", usedefault=True, default_value=False, argstr="-d") - n_iter = traits.Int (desc="Number of iterations", default_value=10, argstr="-n %d") - n_deconv = traits.Int (desc="Number of deconvolution iterations", default_value=10, argstr="-k %d") + debug = traits.Bool(desc="Prints debug information", usedefault=True, default_value=False, argstr="-d") + n_iter = traits.Int(desc="Number of iterations", default_value=10, argstr="-n %d") + n_deconv = traits.Int(desc="Number of deconvolution iterations", default_value=10, argstr="-k %d") alpha = traits.Float(desc="Alpha value", default_value=1.5, argstr="-a %.4f") stop_crit = traits.Float(desc="Stopping criterion", default_value=0.01, argstr="-a %.4f") diff --git a/nipype/scripts/crash_files.py b/nipype/scripts/crash_files.py index 363e0abf80..b7b83dff5c 100644 --- a/nipype/scripts/crash_files.py +++ b/nipype/scripts/crash_files.py @@ -68,7 +68,7 @@ def display_crash_file(crashfile, rerun, debug, directory): print("\n") print("Traceback: ") print(''.join(tb)) - print ("\n") + print("\n") if rerun: if node is None: From 57228bc55685e5316b9aac13ee2b3b98277c4d0b Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:30:07 +0100 Subject: [PATCH 108/365] STY: correction of E272 - multiple spaces before keyword --- nipype/interfaces/tests/test_io.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index 40420c05c6..e2eb4e3c09 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -155,11 +155,11 @@ def test_datagrabber_order(tmpdir): res = dg.run() outfiles = res.outputs.outfiles - assert 'sub002_L1_R1' in outfiles[0][0] - assert 'sub002_L1_R2' in outfiles[0][1] - assert 'sub002_L2_R1' in outfiles[1][0] - assert 'sub002_L2_R2' in outfiles[1][1] - assert 'sub002_L3_R2' in outfiles[2][0] + assert 'sub002_L1_R1' in outfiles[0][0] + assert 'sub002_L1_R2' in outfiles[0][1] + assert 'sub002_L2_R1' in outfiles[1][0] + assert 'sub002_L2_R2' in outfiles[1][1] + assert 'sub002_L3_R2' in outfiles[2][0] assert 'sub002_L3_R10' in outfiles[2][1] From 7d673e31270ef9f82341e4b173f9ebc676bf11dd Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:37:01 +0100 Subject: [PATCH 109/365] STY: correction of E301 - expected 1 blank line, found 0 --- nipype/interfaces/afni/preprocess.py | 1 + nipype/interfaces/ants/registration.py | 1 + nipype/pipeline/engine/tests/test_engine.py | 1 + nipype/sphinxext/plot_workflow.py | 2 ++ 4 files changed, 5 insertions(+) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index c96616273d..27849486e7 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -745,6 +745,7 @@ class AutoTLRC(AFNICommand): _cmd = '@auto_tlrc' input_spec = AutoTLRCInputSpec output_spec = AFNICommandOutputSpec + def _list_outputs(self): outputs = self.output_spec().get() ext = '.HEAD' diff --git a/nipype/interfaces/ants/registration.py b/nipype/interfaces/ants/registration.py index a5fd0e63da..9f528b6144 100644 --- a/nipype/interfaces/ants/registration.py +++ b/nipype/interfaces/ants/registration.py @@ -1031,6 +1031,7 @@ def _format_winsorize_image_intensities(self): self._quantilesDone = True return '--winsorize-image-intensities [ %s, %s ]' % (self.inputs.winsorize_lower_quantile, self.inputs.winsorize_upper_quantile) + def _get_initial_transform_filenames(self): n_transforms = len(self.inputs.initial_moving_transform) diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index 8b4d559ec0..1726c2004a 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -463,6 +463,7 @@ def test_mapnode_iterfield_check(): ]) def test_mapnode_iterfield_type(x_inp, f_exp): from nipype import MapNode, Function + def double_func(x): return 2 * x double = Function(["x"], ["f_x"], double_func) diff --git a/nipype/sphinxext/plot_workflow.py b/nipype/sphinxext/plot_workflow.py index 46ccad7a01..fab49976d8 100644 --- a/nipype/sphinxext/plot_workflow.py +++ b/nipype/sphinxext/plot_workflow.py @@ -124,12 +124,14 @@ try: # Sphinx depends on either Jinja or Jinja2 import jinja2 + def format_template(template, **kw): return jinja2.Template(template).render(**kw) except ImportError as e: missing_imports.append(str(e)) try: import jinja + def format_template(template, **kw): return jinja.from_string(template, **kw) missing_imports.pop() From dad9539b484263ded7a79cd425e027412d34b79d Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:38:54 +0100 Subject: [PATCH 110/365] STY: correction of E401 - multiple imports on one line --- nipype/conftest.py | 3 ++- nipype/interfaces/freesurfer/tests/test_utils.py | 3 ++- nipype/interfaces/fsl/tests/test_preprocess.py | 3 ++- nipype/pipeline/engine/tests/test_engine.py | 3 ++- nipype/pipeline/engine/tests/test_utils.py | 3 ++- nipype/pipeline/plugins/tests/test_multiproc_nondaemon.py | 3 ++- nipype/sphinxext/plot_workflow.py | 7 ++++++- 7 files changed, 18 insertions(+), 7 deletions(-) diff --git a/nipype/conftest.py b/nipype/conftest.py index 27a3789ea4..e9faf69075 100644 --- a/nipype/conftest.py +++ b/nipype/conftest.py @@ -1,5 +1,6 @@ import pytest -import numpy, os +import numpy +import os @pytest.fixture(autouse=True) def add_np(doctest_namespace): diff --git a/nipype/interfaces/freesurfer/tests/test_utils.py b/nipype/interfaces/freesurfer/tests/test_utils.py index c033a1e346..054aeb276e 100644 --- a/nipype/interfaces/freesurfer/tests/test_utils.py +++ b/nipype/interfaces/freesurfer/tests/test_utils.py @@ -3,7 +3,8 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function, division, unicode_literals, absolute_import from builtins import open -import os, os.path as op +import os +import os.path as op import pytest from nipype.testing.fixtures import (create_files_in_directory_plus_dummy_file, create_surf_file_in_directory) diff --git a/nipype/interfaces/fsl/tests/test_preprocess.py b/nipype/interfaces/fsl/tests/test_preprocess.py index ece8b76c29..ae3ec612c7 100644 --- a/nipype/interfaces/fsl/tests/test_preprocess.py +++ b/nipype/interfaces/fsl/tests/test_preprocess.py @@ -8,7 +8,8 @@ import os from copy import deepcopy -import pytest, pdb +import pytest +import pdb from nipype.utils.filemanip import split_filename, filename_to_list from .. import preprocess as fsl from nipype.interfaces.fsl import Info diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index 1726c2004a..f0c8e150a8 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -10,7 +10,8 @@ from builtins import open from copy import deepcopy from glob import glob -import os, sys +import os +import sys import networkx as nx diff --git a/nipype/pipeline/engine/tests/test_utils.py b/nipype/pipeline/engine/tests/test_utils.py index 23c7a16fc6..7435bccc85 100644 --- a/nipype/pipeline/engine/tests/test_utils.py +++ b/nipype/pipeline/engine/tests/test_utils.py @@ -6,7 +6,8 @@ from __future__ import print_function, division, unicode_literals, absolute_import from builtins import range, open -import os, sys +import os +import sys from copy import deepcopy from shutil import rmtree import pytest diff --git a/nipype/pipeline/plugins/tests/test_multiproc_nondaemon.py b/nipype/pipeline/plugins/tests/test_multiproc_nondaemon.py index 7112aa2448..e5150d8c20 100644 --- a/nipype/pipeline/plugins/tests/test_multiproc_nondaemon.py +++ b/nipype/pipeline/plugins/tests/test_multiproc_nondaemon.py @@ -7,7 +7,8 @@ from builtins import range, open # Import packages -import os, sys +import os +import sys from tempfile import mkdtemp from shutil import rmtree import pytest diff --git a/nipype/sphinxext/plot_workflow.py b/nipype/sphinxext/plot_workflow.py index fab49976d8..47f369ef75 100644 --- a/nipype/sphinxext/plot_workflow.py +++ b/nipype/sphinxext/plot_workflow.py @@ -108,7 +108,12 @@ """ from __future__ import print_function, division, absolute_import, unicode_literals -import sys, os, shutil, io, re, textwrap +import sys +import os +import shutil +import io +import re +import textwrap from os.path import relpath from errno import EEXIST import traceback From 997c06e3e0385fa54c59a55a2d4bab95abb57a76 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:41:53 +0100 Subject: [PATCH 111/365] STY: correction of E711 - comparison to None should be 'if cond is None:' --- nipype/interfaces/freesurfer/utils.py | 4 ++-- nipype/interfaces/spm/tests/test_base.py | 6 +++--- nipype/utils/tests/test_filemanip.py | 2 +- nipype/workflows/smri/freesurfer/autorecon1.py | 2 +- nipype/workflows/smri/freesurfer/utils.py | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nipype/interfaces/freesurfer/utils.py b/nipype/interfaces/freesurfer/utils.py index d3eb7b611d..527ed3b972 100644 --- a/nipype/interfaces/freesurfer/utils.py +++ b/nipype/interfaces/freesurfer/utils.py @@ -57,10 +57,10 @@ def copy2subjdir(cls, in_file, folder=None, basename=None, subject_id=None): else: subject_id = 'subject_id' #default # check for basename - if basename == None: + if basename is None: basename = os.path.basename(in_file) # check which folder to put the file in - if folder != None: + if folder is not None: out_dir = os.path.join(subjects_dir, subject_id, folder) else: out_dir = os.path.join(subjects_dir, subject_id) diff --git a/nipype/interfaces/spm/tests/test_base.py b/nipype/interfaces/spm/tests/test_base.py index d1c517a0d3..90aad6cdd2 100644 --- a/nipype/interfaces/spm/tests/test_base.py +++ b/nipype/interfaces/spm/tests/test_base.py @@ -60,13 +60,13 @@ class TestClass(spm.SPMCommand): except KeyError: pass dc = TestClass() - assert dc._use_mcr == None - assert dc._matlab_cmd == None + assert dc._use_mcr is None + assert dc._matlab_cmd is None # test with only FORCE_SPMMCR set os.environ['FORCE_SPMMCR'] = '1' dc = TestClass() assert dc._use_mcr == True - assert dc._matlab_cmd == None + assert dc._matlab_cmd is None # test with both, FORCE_SPMMCR and SPMMCRCMD set os.environ['SPMMCRCMD'] = 'spmcmd' dc = TestClass() diff --git a/nipype/utils/tests/test_filemanip.py b/nipype/utils/tests/test_filemanip.py index 029bfa7320..b83a176ad5 100644 --- a/nipype/utils/tests/test_filemanip.py +++ b/nipype/utils/tests/test_filemanip.py @@ -72,7 +72,7 @@ def test_check_forhash(): assert hash == [orig_hash] result, hash = check_forhash('foobar.nii') assert not result - assert hash == None + assert hash is None @pytest.fixture() def _temp_analyze_files(tmpdir): diff --git a/nipype/workflows/smri/freesurfer/autorecon1.py b/nipype/workflows/smri/freesurfer/autorecon1.py index 62bd4437df..2c9d81d92f 100644 --- a/nipype/workflows/smri/freesurfer/autorecon1.py +++ b/nipype/workflows/smri/freesurfer/autorecon1.py @@ -254,7 +254,7 @@ def createTemplate(in_files, out_file): if not longitudinal: # single session processing talairach_avi = pe.Node(TalairachAVI(), name="Compute_Transform") - if custom_atlas != None: + if custom_atlas is not None: # allows to specify a custom atlas talairach_avi.inputs.atlas = custom_atlas talairach_avi.inputs.out_file = 'talairach.auto.xfm' diff --git a/nipype/workflows/smri/freesurfer/utils.py b/nipype/workflows/smri/freesurfer/utils.py index 838333b093..06c85d0bd0 100644 --- a/nipype/workflows/smri/freesurfer/utils.py +++ b/nipype/workflows/smri/freesurfer/utils.py @@ -400,7 +400,7 @@ def copy_file(in_file, out_file=None): """ import os import shutil - if out_file == None: + if out_file is None: out_file = os.path.join(os.getcwd(), os.path.basename(in_file)) if type(in_file) is list and len(in_file) == 1: in_file = in_file[0] @@ -470,7 +470,7 @@ def checkenv(exitonfail=False): fs_home = os.environ.get('FREESURFER_HOME') path = os.environ.get('PATH') print("FREESURFER_HOME: {0}".format(fs_home)) - if fs_home == None: + if fs_home is None: msg = "please set FREESURFER_HOME before running the workflow" elif not os.path.isdir(fs_home): msg = "FREESURFER_HOME must be set to a valid directory before running this workflow" From f92c36c5ff84f31d9b6dbae55e6eb14b910c154f Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:48:34 +0100 Subject: [PATCH 112/365] STY: correction of E712 - comparison to False should be 'if cond is False:' or 'if not cond:' --- nipype/interfaces/fsl/tests/test_dti.py | 2 +- nipype/interfaces/fsl/tests/test_preprocess.py | 2 +- nipype/interfaces/spm/tests/test_base.py | 4 ++-- nipype/interfaces/spm/tests/test_utils.py | 4 ++-- nipype/pipeline/plugins/sgegraph.py | 2 +- nipype/pipeline/plugins/slurmgraph.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nipype/interfaces/fsl/tests/test_dti.py b/nipype/interfaces/fsl/tests/test_dti.py index 751340941b..a07083ca1c 100644 --- a/nipype/interfaces/fsl/tests/test_dti.py +++ b/nipype/interfaces/fsl/tests/test_dti.py @@ -223,7 +223,7 @@ def test_Proj_thresh(): results = proj3.run(volumes=['inp1', 'inp3', 'inp2'], threshold=2) assert results.runtime.cmdline == 'proj_thresh inp1 inp3 inp2 2' assert results.runtime.returncode != 0 - assert isinstance(results.interface.inputs.volumes, list) == True + assert isinstance(results.interface.inputs.volumes, list) assert results.interface.inputs.threshold == 2 # test arguments for opt_map diff --git a/nipype/interfaces/fsl/tests/test_preprocess.py b/nipype/interfaces/fsl/tests/test_preprocess.py index ae3ec612c7..e404177e87 100644 --- a/nipype/interfaces/fsl/tests/test_preprocess.py +++ b/nipype/interfaces/fsl/tests/test_preprocess.py @@ -102,7 +102,7 @@ def test_fast(setup_infile): fasted2 = fsl.FAST(in_files=[tmp_infile, tmp_infile], verbose=True) assert faster.cmd == 'fast' - assert faster.inputs.verbose == True + assert faster.inputs.verbose assert faster.inputs.manual_seg == Undefined assert faster.inputs != fasted.inputs assert fasted.cmdline == 'fast -v -S 1 %s' % (tmp_infile) diff --git a/nipype/interfaces/spm/tests/test_base.py b/nipype/interfaces/spm/tests/test_base.py index 90aad6cdd2..f52f072854 100644 --- a/nipype/interfaces/spm/tests/test_base.py +++ b/nipype/interfaces/spm/tests/test_base.py @@ -65,12 +65,12 @@ class TestClass(spm.SPMCommand): # test with only FORCE_SPMMCR set os.environ['FORCE_SPMMCR'] = '1' dc = TestClass() - assert dc._use_mcr == True + assert dc._use_mcr assert dc._matlab_cmd is None # test with both, FORCE_SPMMCR and SPMMCRCMD set os.environ['SPMMCRCMD'] = 'spmcmd' dc = TestClass() - assert dc._use_mcr == True + assert dc._use_mcr assert dc._matlab_cmd == 'spmcmd' # restore environment os.environ.clear() diff --git a/nipype/interfaces/spm/tests/test_utils.py b/nipype/interfaces/spm/tests/test_utils.py index 7d8106f80c..43b759717e 100644 --- a/nipype/interfaces/spm/tests/test_utils.py +++ b/nipype/interfaces/spm/tests/test_utils.py @@ -18,7 +18,7 @@ def test_coreg(): coreg.inputs.target = target assert coreg.inputs.matlab_cmd == 'mymatlab' coreg.inputs.moving = moving - assert isdefined(coreg.inputs.mat) == False + assert not isdefined(coreg.inputs.mat) pth, mov, _ = split_filename(moving) _, tgt, _ = split_filename(target) mat = os.path.join(pth, '%s_to_%s.mat' % (mov, tgt)) @@ -70,7 +70,7 @@ def test_dicom_import(): assert di.inputs.output_dir_struct == 'flat' assert di.inputs.output_dir == './converted_dicom' assert di.inputs.format == 'nii' - assert di.inputs.icedims == False + assert not di.inputs.icedims with pytest.raises(TraitError): di.inputs.trait_set(output_dir_struct='wrong') with pytest.raises(TraitError): di.inputs.trait_set(format='FAT') with pytest.raises(TraitError): di.inputs.trait_set(in_files=['does_sfd_not_32fn_exist.dcm']) diff --git a/nipype/pipeline/plugins/sgegraph.py b/nipype/pipeline/plugins/sgegraph.py index 882c455450..21033bf4e5 100644 --- a/nipype/pipeline/plugins/sgegraph.py +++ b/nipype/pipeline/plugins/sgegraph.py @@ -123,7 +123,7 @@ def make_job_name(jobnumber, nodeslist): values = ' ' for jobid in dependencies[idx]: # Avoid dependancies of done jobs - if not self._dont_resubmit_completed_jobs or cache_doneness_per_node[jobid] == False: + if not self._dont_resubmit_completed_jobs or not cache_doneness_per_node[jobid]: values += "${{{0}}},".format(make_job_name(jobid, nodes)) if values != ' ': # i.e. if some jobs were added to dependency list values = values.rstrip(',') diff --git a/nipype/pipeline/plugins/slurmgraph.py b/nipype/pipeline/plugins/slurmgraph.py index ed571ecffe..090df2a50b 100644 --- a/nipype/pipeline/plugins/slurmgraph.py +++ b/nipype/pipeline/plugins/slurmgraph.py @@ -122,7 +122,7 @@ def make_job_name(jobnumber, nodeslist): values = '' for jobid in dependencies[idx]: # Avoid dependancies of done jobs - if not self._dont_resubmit_completed_jobs or cache_doneness_per_node[jobid] == False: + if not self._dont_resubmit_completed_jobs or not cache_doneness_per_node[jobid]: values += "${{{0}}}:".format(make_job_name(jobid, nodes)) if values != '': # i.e. if some jobs were added to dependency list values = values.rstrip(':') From d594e732ba56390752d48ba895e6758e8422a4a3 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:53:47 +0100 Subject: [PATCH 113/365] STY: correction of E131 - continuation line unaligned for hanging indent --- nipype/interfaces/afni/preprocess.py | 122 +++++++++--------- nipype/interfaces/afni/utils.py | 92 ++++++------- .../interfaces/freesurfer/tests/test_model.py | 2 +- nipype/pipeline/engine/tests/test_engine.py | 2 +- 4 files changed, 109 insertions(+), 109 deletions(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 27849486e7..c94e4d0d5a 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -666,62 +666,62 @@ class AutoTLRCInputSpec(CommandLineInputSpec): copyfile=False) base = traits.Str( desc = ' Reference anatomical volume' - ' Usually this volume is in some standard space like' - ' TLRC or MNI space and with afni dataset view of' - ' (+tlrc).' - ' Preferably, this reference volume should have had' - ' the skull removed but that is not mandatory.' - ' AFNI\'s distribution contains several templates.' - ' For a longer list, use "whereami -show_templates"' - 'TT_N27+tlrc --> Single subject, skull stripped volume.' - ' This volume is also known as ' - ' N27_SurfVol_NoSkull+tlrc elsewhere in ' - ' AFNI and SUMA land.' - ' (www.loni.ucla.edu, www.bic.mni.mcgill.ca)' - ' This template has a full set of FreeSurfer' - ' (surfer.nmr.mgh.harvard.edu)' - ' surface models that can be used in SUMA. ' - ' For details, see Talairach-related link:' - ' https://afni.nimh.nih.gov/afni/suma' - 'TT_icbm452+tlrc --> Average volume of 452 normal brains.' - ' Skull Stripped. (www.loni.ucla.edu)' - 'TT_avg152T1+tlrc --> Average volume of 152 normal brains.' - ' Skull Stripped.(www.bic.mni.mcgill.ca)' - 'TT_EPI+tlrc --> EPI template from spm2, masked as TT_avg152T1' - ' TT_avg152 and TT_EPI volume sources are from' - ' SPM\'s distribution. (www.fil.ion.ucl.ac.uk/spm/)' - 'If you do not specify a path for the template, the script' - 'will attempt to locate the template AFNI\'s binaries directory.' - 'NOTE: These datasets have been slightly modified from' - ' their original size to match the standard TLRC' - ' dimensions (Jean Talairach and Pierre Tournoux' - ' Co-Planar Stereotaxic Atlas of the Human Brain' - ' Thieme Medical Publishers, New York, 1988). ' - ' That was done for internal consistency in AFNI.' - ' You may use the original form of these' - ' volumes if you choose but your TLRC coordinates' - ' will not be consistent with AFNI\'s TLRC database' - ' (San Antonio Talairach Daemon database), for example.', + ' Usually this volume is in some standard space like' + ' TLRC or MNI space and with afni dataset view of' + ' (+tlrc).' + ' Preferably, this reference volume should have had' + ' the skull removed but that is not mandatory.' + ' AFNI\'s distribution contains several templates.' + ' For a longer list, use "whereami -show_templates"' + 'TT_N27+tlrc --> Single subject, skull stripped volume.' + ' This volume is also known as ' + ' N27_SurfVol_NoSkull+tlrc elsewhere in ' + ' AFNI and SUMA land.' + ' (www.loni.ucla.edu, www.bic.mni.mcgill.ca)' + ' This template has a full set of FreeSurfer' + ' (surfer.nmr.mgh.harvard.edu)' + ' surface models that can be used in SUMA. ' + ' For details, see Talairach-related link:' + ' https://afni.nimh.nih.gov/afni/suma' + 'TT_icbm452+tlrc --> Average volume of 452 normal brains.' + ' Skull Stripped. (www.loni.ucla.edu)' + 'TT_avg152T1+tlrc --> Average volume of 152 normal brains.' + ' Skull Stripped.(www.bic.mni.mcgill.ca)' + 'TT_EPI+tlrc --> EPI template from spm2, masked as TT_avg152T1' + ' TT_avg152 and TT_EPI volume sources are from' + ' SPM\'s distribution. (www.fil.ion.ucl.ac.uk/spm/)' + 'If you do not specify a path for the template, the script' + 'will attempt to locate the template AFNI\'s binaries directory.' + 'NOTE: These datasets have been slightly modified from' + ' their original size to match the standard TLRC' + ' dimensions (Jean Talairach and Pierre Tournoux' + ' Co-Planar Stereotaxic Atlas of the Human Brain' + ' Thieme Medical Publishers, New York, 1988). ' + ' That was done for internal consistency in AFNI.' + ' You may use the original form of these' + ' volumes if you choose but your TLRC coordinates' + ' will not be consistent with AFNI\'s TLRC database' + ' (San Antonio Talairach Daemon database), for example.', mandatory = True, argstr='-base %s') no_ss = traits.Bool( desc='Do not strip skull of input data set' - '(because skull has already been removed' - 'or because template still has the skull)' - 'NOTE: The -no_ss option is not all that optional.' - ' Here is a table of when you should and should not use -no_ss' - ' Template Template' - ' WITH skull WITHOUT skull' - ' Dset.' - ' WITH skull -no_ss xxx ' - ' ' - ' WITHOUT skull No Cigar -no_ss' - ' ' - ' Template means: Your template of choice' - ' Dset. means: Your anatomical dataset' - ' -no_ss means: Skull stripping should not be attempted on Dset' - ' xxx means: Don\'t put anything, the script will strip Dset' - ' No Cigar means: Don\'t try that combination, it makes no sense.', + '(because skull has already been removed' + 'or because template still has the skull)' + 'NOTE: The -no_ss option is not all that optional.' + ' Here is a table of when you should and should not use -no_ss' + ' Template Template' + ' WITH skull WITHOUT skull' + ' Dset.' + ' WITH skull -no_ss xxx ' + ' ' + ' WITHOUT skull No Cigar -no_ss' + ' ' + ' Template means: Your template of choice' + ' Dset. means: Your anatomical dataset' + ' -no_ss means: Skull stripping should not be attempted on Dset' + ' xxx means: Don\'t put anything, the script will strip Dset' + ' No Cigar means: Don\'t try that combination, it makes no sense.', argstr='-no_ss') class AutoTLRC(AFNICommand): @@ -2798,15 +2798,15 @@ class QwarpPlusMinusInputSpec(CommandLineInputSpec): blur = traits.List( traits.Float(), desc="Gaussian blur the input images by (FWHM) voxels " - "before doing the alignment (the output dataset " - "will not be blurred). The default is 2.345 (for " - "no good reason). Optionally, you can provide 2 " - "values, and then the first one is applied to the " - "base volume, the second to the source volume. A " - "negative blur radius means to use 3D median " - "filtering, rather than Gaussian blurring. This " - "type of filtering will better preserve edges, " - "which can be important in alignment.", + "before doing the alignment (the output dataset " + "will not be blurred). The default is 2.345 (for " + "no good reason). Optionally, you can provide 2 " + "values, and then the first one is applied to the " + "base volume, the second to the source volume. A " + "negative blur radius means to use 3D median " + "filtering, rather than Gaussian blurring. This " + "type of filtering will better preserve edges, " + "which can be important in alignment.", argstr='-blur %s', minlen=1, maxlen=2) diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 922e6fd05c..01e9a44bce 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -337,45 +337,45 @@ class BucketInputSpec(AFNICommandInputSpec): mandatory=True, argstr="%s", desc='List of tuples of input datasets and subbrick selection strings' - 'as described in more detail in the following afni help string' - 'Input dataset specified using one of these forms:' - ' \'prefix+view\', \'prefix+view.HEAD\', or \'prefix+view.BRIK\'.' - 'You can also add a sub-brick selection list after the end of the' - 'dataset name. This allows only a subset of the sub-bricks to be' - 'included into the output (by default, all of the input dataset' - 'is copied into the output). A sub-brick selection list looks like' - 'one of the following forms:' - ' fred+orig[5] ==> use only sub-brick #5' - ' fred+orig[5,9,17] ==> use #5, #9, and #17' - ' fred+orig[5..8] or [5-8] ==> use #5, #6, #7, and #8' - ' fred+orig[5..13(2)] or [5-13(2)] ==> use #5, #7, #9, #11, and #13' - 'Sub-brick indexes start at 0. You can use the character \'$\'' - 'to indicate the last sub-brick in a dataset; for example, you' - 'can select every third sub-brick by using the selection list' - ' fred+orig[0..$(3)]' - 'N.B.: The sub-bricks are output in the order specified, which may' - ' not be the order in the original datasets. For example, using' - ' fred+orig[0..$(2),1..$(2)]' - ' will cause the sub-bricks in fred+orig to be output into the' - ' new dataset in an interleaved fashion. Using' - ' fred+orig[$..0]' - ' will reverse the order of the sub-bricks in the output.' - 'N.B.: Bucket datasets have multiple sub-bricks, but do NOT have' - ' a time dimension. You can input sub-bricks from a 3D+time dataset' - ' into a bucket dataset. You can use the \'3dinfo\' program to see' - ' how many sub-bricks a 3D+time or a bucket dataset contains.' - 'N.B.: In non-bucket functional datasets (like the \'fico\' datasets' - ' output by FIM, or the \'fitt\' datasets output by 3dttest), sub-brick' - ' [0] is the \'intensity\' and sub-brick [1] is the statistical parameter' - ' used as a threshold. Thus, to create a bucket dataset using the' - ' intensity from dataset A and the threshold from dataset B, and' - ' calling the output dataset C, you would type' - ' 3dbucket -prefix C -fbuc \'A+orig[0]\' -fbuc \'B+orig[1]\'' - 'WARNING: using this program, it is possible to create a dataset that' - ' has different basic datum types for different sub-bricks' - ' (e.g., shorts for brick 0, floats for brick 1).' - ' Do NOT do this! Very few AFNI programs will work correctly' - ' with such datasets!') + 'as described in more detail in the following afni help string' + 'Input dataset specified using one of these forms:' + ' \'prefix+view\', \'prefix+view.HEAD\', or \'prefix+view.BRIK\'.' + 'You can also add a sub-brick selection list after the end of the' + 'dataset name. This allows only a subset of the sub-bricks to be' + 'included into the output (by default, all of the input dataset' + 'is copied into the output). A sub-brick selection list looks like' + 'one of the following forms:' + ' fred+orig[5] ==> use only sub-brick #5' + ' fred+orig[5,9,17] ==> use #5, #9, and #17' + ' fred+orig[5..8] or [5-8] ==> use #5, #6, #7, and #8' + ' fred+orig[5..13(2)] or [5-13(2)] ==> use #5, #7, #9, #11, and #13' + 'Sub-brick indexes start at 0. You can use the character \'$\'' + 'to indicate the last sub-brick in a dataset; for example, you' + 'can select every third sub-brick by using the selection list' + ' fred+orig[0..$(3)]' + 'N.B.: The sub-bricks are output in the order specified, which may' + ' not be the order in the original datasets. For example, using' + ' fred+orig[0..$(2),1..$(2)]' + ' will cause the sub-bricks in fred+orig to be output into the' + ' new dataset in an interleaved fashion. Using' + ' fred+orig[$..0]' + ' will reverse the order of the sub-bricks in the output.' + 'N.B.: Bucket datasets have multiple sub-bricks, but do NOT have' + ' a time dimension. You can input sub-bricks from a 3D+time dataset' + ' into a bucket dataset. You can use the \'3dinfo\' program to see' + ' how many sub-bricks a 3D+time or a bucket dataset contains.' + 'N.B.: In non-bucket functional datasets (like the \'fico\' datasets' + ' output by FIM, or the \'fitt\' datasets output by 3dttest), sub-brick' + ' [0] is the \'intensity\' and sub-brick [1] is the statistical parameter' + ' used as a threshold. Thus, to create a bucket dataset using the' + ' intensity from dataset A and the threshold from dataset B, and' + ' calling the output dataset C, you would type' + ' 3dbucket -prefix C -fbuc \'A+orig[0]\' -fbuc \'B+orig[1]\'' + 'WARNING: using this program, it is possible to create a dataset that' + ' has different basic datum types for different sub-bricks' + ' (e.g., shorts for brick 0, floats for brick 1).' + ' Do NOT do this! Very few AFNI programs will work correctly' + ' with such datasets!') out_file = File( argstr='-prefix %s', name_template='buck') @@ -535,7 +535,7 @@ class CatInputSpec(AFNICommandInputSpec): argstr='-stack') sel = traits.Str( desc='Apply the same column/row selection string to all filenames ' - 'on the command line.', + 'on the command line.', argstr='-sel %s') out_int = traits.Bool( desc='specifiy int data type for output', @@ -598,9 +598,9 @@ class CatMatvecInputSpec(AFNICommandInputSpec): mandatory=True) matrix = traits.Bool( descr="indicates that the resulting matrix will" - "be written to outfile in the 'MATRIX(...)' format (FORM 3)." - "This feature could be used, with clever scripting, to input" - "a matrix directly on the command line to program 3dWarp.", + "be written to outfile in the 'MATRIX(...)' format (FORM 3)." + "This feature could be used, with clever scripting, to input" + "a matrix directly on the command line to program 3dWarp.", argstr="-MATRIX", xor=['oneline', 'fourxfour']) oneline = traits.Bool( @@ -838,7 +838,7 @@ class DotInputSpec(AFNICommandInputSpec): argstr='-full') show_labels = traits.Bool( desc='Print sub-brick labels to help identify what is being correlated. This option is useful when' - 'you have more than 2 sub-bricks at input.', + 'you have more than 2 sub-bricks at input.', argstr='-show_labels') upper = traits.Bool( desc='Compute upper triangular matrix', @@ -1551,7 +1551,7 @@ class NwarpApplyInputSpec(CommandLineInputSpec): name_source='in_file') short = traits.Bool( desc='Write output dataset using 16-bit short integers, rather than ' - 'the usual 32-bit floats.', + 'the usual 32-bit floats.', argstr='-short') quiet = traits.Bool( desc='don\'t be verbose :(', @@ -1727,7 +1727,7 @@ class OneDToolPyInputSpec(AFNIPythonCommandInputSpec): show_censor_count = traits.Bool( desc='display the total number of censored TRs Note : if input is a valid xmat.1D dataset,' 'then the count will come from the header. Otherwise the input is assumed to be a binary censor' - 'file, and zeros are simply counted.', + 'file, and zeros are simply counted.', argstr="-show_censor_count") censor_motion = traits.Tuple( (traits.Float(),File()), diff --git a/nipype/interfaces/freesurfer/tests/test_model.py b/nipype/interfaces/freesurfer/tests/test_model.py index a30a29b0ac..dd956ce708 100644 --- a/nipype/interfaces/freesurfer/tests/test_model.py +++ b/nipype/interfaces/freesurfer/tests/test_model.py @@ -48,7 +48,7 @@ def test_concatenate(tmpdir): wf.run() assert np.allclose(nb.load(tmpdir.join( 'test_concatenate', - 'concat', out).strpath).get_data(), + 'concat', out).strpath).get_data(), out_data) # Test a simple statistic diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index f0c8e150a8..bdb42f15a7 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -460,7 +460,7 @@ def test_mapnode_iterfield_check(): @pytest.mark.parametrize("x_inp, f_exp", [ (3, [6]), ([2, 3], [4, 6]), ((2, 3), [4, 6]), (range(3), [0, 2, 4]), - ("Str", ["StrStr"]), (["Str1", "Str2"], ["Str1Str1", "Str2Str2"]) + ("Str", ["StrStr"]), (["Str1", "Str2"], ["Str1Str1", "Str2Str2"]) ]) def test_mapnode_iterfield_type(x_inp, f_exp): from nipype import MapNode, Function From 22d37d3dbad1ad4050950e284b88f4004cffb969 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 02:59:07 +0100 Subject: [PATCH 114/365] STY: correction of E262 - inline comment should start with '# ' --- nipype/interfaces/afni/utils.py | 2 +- nipype/interfaces/freesurfer/utils.py | 4 ++-- nipype/pipeline/engine/tests/test_engine.py | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 01e9a44bce..e9c94b53fd 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -1311,7 +1311,7 @@ def _list_outputs(self): else: outputs['out_detrend'] = Undefined - sout = np.loadtxt(outputs['out_file']) #pylint: disable=E1101 + sout = np.loadtxt(outputs['out_file']) # pylint: disable=E1101 if self._acf: outputs['acf_param'] = tuple(sout[1]) sout = tuple(sout[0]) diff --git a/nipype/interfaces/freesurfer/utils.py b/nipype/interfaces/freesurfer/utils.py index 527ed3b972..ca9130122e 100644 --- a/nipype/interfaces/freesurfer/utils.py +++ b/nipype/interfaces/freesurfer/utils.py @@ -49,13 +49,13 @@ def copy2subjdir(cls, in_file, folder=None, basename=None, subject_id=None): if isdefined(cls.inputs.subjects_dir): subjects_dir = cls.inputs.subjects_dir else: - subjects_dir = os.getcwd() #if not use cwd + subjects_dir = os.getcwd() # if not use cwd # check for subject_id if not subject_id: if isdefined(cls.inputs.subject_id): subject_id = cls.inputs.subject_id else: - subject_id = 'subject_id' #default + subject_id = 'subject_id' # default # check for basename if basename is None: basename = os.path.basename(in_file) diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index bdb42f15a7..c7b6c2f35a 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -75,8 +75,8 @@ def test_add_nodes(): # ensure that all connections are tested later @pytest.mark.parametrize("iterables, expected", [ - ({"1": None}, (1,0)), #test1 - ({"1": dict(input1=lambda: [1, 2], input2=lambda: [1, 2])}, (4,0)) #test2 + ({"1": None}, (1,0)), # test1 + ({"1": dict(input1=lambda: [1, 2], input2=lambda: [1, 2])}, (4,0)) # test2 ]) def test_1mod(iterables, expected): pipe = pe.Workflow(name='pipe') @@ -90,9 +90,9 @@ def test_1mod(iterables, expected): @pytest.mark.parametrize("iterables, expected", [ - ({"1": {}, "2": dict(input1=lambda: [1, 2])}, (3,2)), #test3 - ({"1": dict(input1=lambda: [1, 2]), "2": {}}, (4,2)), #test4 - ({"1": dict(input1=lambda: [1, 2]), "2": dict(input1=lambda: [1, 2])}, (6,4)) #test5 + ({"1": {}, "2": dict(input1=lambda: [1, 2])}, (3,2)), # test3 + ({"1": dict(input1=lambda: [1, 2]), "2": {}}, (4,2)), # test4 + ({"1": dict(input1=lambda: [1, 2]), "2": dict(input1=lambda: [1, 2])}, (6,4)) # test5 ]) def test_2mods(iterables, expected): pipe = pe.Workflow(name='pipe') @@ -108,10 +108,10 @@ def test_2mods(iterables, expected): @pytest.mark.parametrize("iterables, expected, connect", [ - ({"1": {}, "2": dict(input1=lambda: [1, 2]), "3": {}}, (5,4), ("1-2","2-3")), #test6 - ({"1": dict(input1=lambda: [1, 2]), "2": {}, "3": {}}, (5,4), ("1-3","2-3")), #test7 + ({"1": {}, "2": dict(input1=lambda: [1, 2]), "3": {}}, (5,4), ("1-2","2-3")), # test6 + ({"1": dict(input1=lambda: [1, 2]), "2": {}, "3": {}}, (5,4), ("1-3","2-3")), # test7 ({"1": dict(input1=lambda: [1, 2]), "2": dict(input1=lambda: [1, 2]), "3": {}}, - (8,8), ("1-3","2-3")), #test8 + (8,8), ("1-3","2-3")), # test8 ]) def test_3mods(iterables, expected, connect): pipe = pe.Workflow(name='pipe') From f21518e6c4c83689adfaf6d763624ed539b3c8db Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 03:04:21 +0100 Subject: [PATCH 115/365] STY: deletion of pylint info --- nipype/interfaces/afni/utils.py | 4 ++-- nipype/interfaces/base/core.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index e9c94b53fd..805d3c092c 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -732,7 +732,7 @@ def _list_outputs(self): outputs = super(CenterMass, self)._list_outputs() outputs['out_file'] = os.path.abspath(self.inputs.in_file) outputs['cm_file'] = os.path.abspath(self.inputs.cm_file) - sout = np.loadtxt(outputs['cm_file'], ndmin=2) # pylint: disable=E1101 + sout = np.loadtxt(outputs['cm_file'], ndmin=2) outputs['cm'] = [tuple(s) for s in sout] return outputs @@ -1311,7 +1311,7 @@ def _list_outputs(self): else: outputs['out_detrend'] = Undefined - sout = np.loadtxt(outputs['out_file']) # pylint: disable=E1101 + sout = np.loadtxt(outputs['out_file']) if self._acf: outputs['acf_param'] = tuple(sout[1]) sout = tuple(sout[0]) diff --git a/nipype/interfaces/base/core.py b/nipype/interfaces/base/core.py index bcf2656620..6fce67d40d 100644 --- a/nipype/interfaces/base/core.py +++ b/nipype/interfaces/base/core.py @@ -307,7 +307,7 @@ def _outputs_help(cls): """ helpstr = ['Outputs::', ''] if cls.output_spec: - outputs = cls.output_spec() # pylint: disable=E1102 + outputs = cls.output_spec() for name, spec in sorted(outputs.traits(transient=None).items()): helpstr += cls._get_trait_desc(outputs, name, spec) if len(helpstr) == 2: @@ -319,7 +319,7 @@ def _outputs(self): """ outputs = None if self.output_spec: - outputs = self.output_spec() # pylint: disable=E1102 + outputs = self.output_spec() return outputs @@ -1080,7 +1080,7 @@ def _list_outputs(self): metadata = dict(name_source=lambda t: t is not None) traits = self.inputs.traits(**metadata) if traits: - outputs = self.output_spec().get() # pylint: disable=E1102 + outputs = self.output_spec().get() for name, trait_spec in list(traits.items()): out_name = name if trait_spec.output_name is not None: @@ -1184,7 +1184,7 @@ class SEMLikeCommandLine(CommandLine): """ def _list_outputs(self): - outputs = self.output_spec().get() # pylint: disable=E1102 + outputs = self.output_spec().get() return self._outputs_from_inputs(outputs) def _outputs_from_inputs(self, outputs): From bdac9b146455ebeb0c699cad640f609a2921e2ed Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 03:10:09 +0100 Subject: [PATCH 116/365] STY: correction of E225 - missing whitespace around operator --- nipype/algorithms/modelgen.py | 4 +- nipype/algorithms/tests/test_confounds.py | 2 +- nipype/interfaces/afni/preprocess.py | 4 +- nipype/interfaces/afni/utils.py | 6 +-- nipype/interfaces/ants/segmentation.py | 2 +- nipype/interfaces/cmtk/tests/test_nbs.py | 2 +- nipype/interfaces/fsl/tests/test_maths.py | 2 +- .../workflows/smri/freesurfer/autorecon2.py | 38 +++++++++---------- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/nipype/algorithms/modelgen.py b/nipype/algorithms/modelgen.py index 2c994bf20d..ebecbe5303 100644 --- a/nipype/algorithms/modelgen.py +++ b/nipype/algorithms/modelgen.py @@ -586,9 +586,9 @@ def _generate_design(self, infolist=None): sumscans = out.astype(int) + sum(nscans[0:i]) if out.size == 1: - outliers[0]+= [np.array(sumscans, dtype=int).tolist()] + outliers[0] += [np.array(sumscans, dtype=int).tolist()] else: - outliers[0]+= np.array(sumscans, dtype=int).tolist() + outliers[0] += np.array(sumscans, dtype=int).tolist() self._sessinfo = self._generate_standard_design(concatlist, functional_runs=functional_runs, diff --git a/nipype/algorithms/tests/test_confounds.py b/nipype/algorithms/tests/test_confounds.py index 3f5b21ed55..bd145875aa 100644 --- a/nipype/algorithms/tests/test_confounds.py +++ b/nipype/algorithms/tests/test_confounds.py @@ -47,7 +47,7 @@ def test_dvars(tmpdir): res = dvars.run() dv1 = np.loadtxt(res.outputs.out_all, skiprows=1) - assert (np.abs(dv1[:, 0] - ground_truth[:, 0]).sum()/ len(dv1)) < 0.05 + assert (np.abs(dv1[:, 0] - ground_truth[:, 0]).sum() / len(dv1)) < 0.05 assert (np.abs(dv1[:, 1] - ground_truth[:, 1]).sum() / len(dv1)) < 0.05 diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index c94e4d0d5a..68e870fe5a 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -246,7 +246,7 @@ class AllineateInputSpec(AFNICommandInputSpec): desc='overwrite output file if it already exists', argstr='-overwrite') - allcostx= File( + allcostx = File( desc='Compute and print ALL available cost functionals for the un-warped inputs' 'AND THEN QUIT. If you use this option none of the other expected outputs will be produced', argstr='-allcostx |& tee %s', @@ -3509,7 +3509,7 @@ def _list_outputs(self): if not isdefined(self.inputs.out_file): prefix = self._gen_fname(self.inputs.in_file, suffix='_QW') ext = '.HEAD' - suffix ='+tlrc' + suffix = '+tlrc' else: prefix = self.inputs.out_file ext_ind = max([prefix.lower().rfind('.nii.gz'), diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 805d3c092c..d643e012d0 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -1780,11 +1780,11 @@ def _list_outputs(self): outputs = self.output_spec().get() if isdefined(self.inputs.out_file): - outputs['out_file']=os.path.join(os.getcwd(), self.inputs.out_file) + outputs['out_file'] = os.path.join(os.getcwd(), self.inputs.out_file) if isdefined(self.inputs.show_cormat_warnings): - outputs['out_file']=os.path.join(os.getcwd(), self.inputs.show_cormat_warnings) + outputs['out_file'] = os.path.join(os.getcwd(), self.inputs.show_cormat_warnings) if isdefined(self.inputs.censor_motion): - outputs['out_file']=os.path.join(os.getcwd(), self.inputs.censor_motion[1]) + outputs['out_file'] = os.path.join(os.getcwd(), self.inputs.censor_motion[1]) return outputs class RefitInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/ants/segmentation.py b/nipype/interfaces/ants/segmentation.py index 6c594b5e24..733a5dbdbc 100644 --- a/nipype/interfaces/ants/segmentation.py +++ b/nipype/interfaces/ants/segmentation.py @@ -773,7 +773,7 @@ def _list_outputs(self): ) outputs['BrainExtractionInitialAffine'] = os.path.join( os.getcwd(), - self.inputs.out_prefix +'BrainExtractionInitialAffine.mat' + self.inputs.out_prefix + 'BrainExtractionInitialAffine.mat' ) outputs['BrainExtractionInitialAffineFixed'] = os.path.join( os.getcwd(), diff --git a/nipype/interfaces/cmtk/tests/test_nbs.py b/nipype/interfaces/cmtk/tests/test_nbs.py index 03a7aa8619..66a7d05804 100644 --- a/nipype/interfaces/cmtk/tests/test_nbs.py +++ b/nipype/interfaces/cmtk/tests/test_nbs.py @@ -44,7 +44,7 @@ def test_importerror(creating_graphs, tmpdir): @pytest.mark.skipif(not have_cv, reason="cviewer has to be available") def test_keyerror(creating_graphs): - graphlist =creating_graphs + graphlist = creating_graphs group1 = graphlist[:3] group2 = graphlist[3:] diff --git a/nipype/interfaces/fsl/tests/test_maths.py b/nipype/interfaces/fsl/tests/test_maths.py index 4d3c6ad03d..dcaa7cf8bd 100644 --- a/nipype/interfaces/fsl/tests/test_maths.py +++ b/nipype/interfaces/fsl/tests/test_maths.py @@ -157,7 +157,7 @@ def test_stdimage(create_files_in_directory_plus_output_type): # Test the other dimensions cmdline = "fslmaths a.nii -{}std b.nii" for dim in ["X","Y","Z","T"]: - stder.inputs.dimension=dim + stder.inputs.dimension = dim assert stder.cmdline == cmdline.format(dim) # Test the auto naming diff --git a/nipype/workflows/smri/freesurfer/autorecon2.py b/nipype/workflows/smri/freesurfer/autorecon2.py index acd6c6d97f..0812cd1a5f 100644 --- a/nipype/workflows/smri/freesurfer/autorecon2.py +++ b/nipype/workflows/smri/freesurfer/autorecon2.py @@ -625,25 +625,25 @@ def create_AutoRecon2(name="AutoRecon2", longitudinal=False, (inputspec, hemi_wf, [('num_threads', 'inputspec.num_threads')])]) # Outputs for hemisphere workflow - hemi_outputs=['orig_nofix', - 'orig', - 'smoothwm_nofix', - 'inflated_nofix', - 'qsphere_nofix', - 'white', - 'curv', - 'area', - 'cortex', - 'pial_auto', - 'thickness', - 'smoothwm', - 'sulc', - 'inflated', - 'white_H', - 'white_K', - 'inflated_H', - 'inflated_K', - 'curv_stats'] + hemi_outputs = ['orig_nofix', + 'orig', + 'smoothwm_nofix', + 'inflated_nofix', + 'qsphere_nofix', + 'white', + 'curv', + 'area', + 'cortex', + 'pial_auto', + 'thickness', + 'smoothwm', + 'sulc', + 'inflated', + 'white_H', + 'white_K', + 'inflated_H', + 'inflated_K', + 'curv_stats'] hemi_outputspec = pe.Node(IdentityInterface(fields=hemi_outputs), name="outputspec") From cb71b1885a626c253735d16914c7b2e50808d266 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 03:12:14 +0100 Subject: [PATCH 117/365] STY: correction of E251 - unexpected spaces around keyword / parameter equals --- nipype/interfaces/afni/preprocess.py | 76 ++++++++++++------------- nipype/interfaces/petpvc.py | 2 +- nipype/interfaces/tests/test_bids.py | 2 +- nipype/workflows/fmri/fsl/preprocess.py | 4 +- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 68e870fe5a..6c37b614ca 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -665,44 +665,44 @@ class AutoTLRCInputSpec(CommandLineInputSpec): exists=True, copyfile=False) base = traits.Str( - desc = ' Reference anatomical volume' - ' Usually this volume is in some standard space like' - ' TLRC or MNI space and with afni dataset view of' - ' (+tlrc).' - ' Preferably, this reference volume should have had' - ' the skull removed but that is not mandatory.' - ' AFNI\'s distribution contains several templates.' - ' For a longer list, use "whereami -show_templates"' - 'TT_N27+tlrc --> Single subject, skull stripped volume.' - ' This volume is also known as ' - ' N27_SurfVol_NoSkull+tlrc elsewhere in ' - ' AFNI and SUMA land.' - ' (www.loni.ucla.edu, www.bic.mni.mcgill.ca)' - ' This template has a full set of FreeSurfer' - ' (surfer.nmr.mgh.harvard.edu)' - ' surface models that can be used in SUMA. ' - ' For details, see Talairach-related link:' - ' https://afni.nimh.nih.gov/afni/suma' - 'TT_icbm452+tlrc --> Average volume of 452 normal brains.' - ' Skull Stripped. (www.loni.ucla.edu)' - 'TT_avg152T1+tlrc --> Average volume of 152 normal brains.' - ' Skull Stripped.(www.bic.mni.mcgill.ca)' - 'TT_EPI+tlrc --> EPI template from spm2, masked as TT_avg152T1' - ' TT_avg152 and TT_EPI volume sources are from' - ' SPM\'s distribution. (www.fil.ion.ucl.ac.uk/spm/)' - 'If you do not specify a path for the template, the script' - 'will attempt to locate the template AFNI\'s binaries directory.' - 'NOTE: These datasets have been slightly modified from' - ' their original size to match the standard TLRC' - ' dimensions (Jean Talairach and Pierre Tournoux' - ' Co-Planar Stereotaxic Atlas of the Human Brain' - ' Thieme Medical Publishers, New York, 1988). ' - ' That was done for internal consistency in AFNI.' - ' You may use the original form of these' - ' volumes if you choose but your TLRC coordinates' - ' will not be consistent with AFNI\'s TLRC database' - ' (San Antonio Talairach Daemon database), for example.', - mandatory = True, + desc=' Reference anatomical volume' + ' Usually this volume is in some standard space like' + ' TLRC or MNI space and with afni dataset view of' + ' (+tlrc).' + ' Preferably, this reference volume should have had' + ' the skull removed but that is not mandatory.' + ' AFNI\'s distribution contains several templates.' + ' For a longer list, use "whereami -show_templates"' + 'TT_N27+tlrc --> Single subject, skull stripped volume.' + ' This volume is also known as ' + ' N27_SurfVol_NoSkull+tlrc elsewhere in ' + ' AFNI and SUMA land.' + ' (www.loni.ucla.edu, www.bic.mni.mcgill.ca)' + ' This template has a full set of FreeSurfer' + ' (surfer.nmr.mgh.harvard.edu)' + ' surface models that can be used in SUMA. ' + ' For details, see Talairach-related link:' + ' https://afni.nimh.nih.gov/afni/suma' + 'TT_icbm452+tlrc --> Average volume of 452 normal brains.' + ' Skull Stripped. (www.loni.ucla.edu)' + 'TT_avg152T1+tlrc --> Average volume of 152 normal brains.' + ' Skull Stripped.(www.bic.mni.mcgill.ca)' + 'TT_EPI+tlrc --> EPI template from spm2, masked as TT_avg152T1' + ' TT_avg152 and TT_EPI volume sources are from' + ' SPM\'s distribution. (www.fil.ion.ucl.ac.uk/spm/)' + 'If you do not specify a path for the template, the script' + 'will attempt to locate the template AFNI\'s binaries directory.' + 'NOTE: These datasets have been slightly modified from' + ' their original size to match the standard TLRC' + ' dimensions (Jean Talairach and Pierre Tournoux' + ' Co-Planar Stereotaxic Atlas of the Human Brain' + ' Thieme Medical Publishers, New York, 1988). ' + ' That was done for internal consistency in AFNI.' + ' You may use the original form of these' + ' volumes if you choose but your TLRC coordinates' + ' will not be consistent with AFNI\'s TLRC database' + ' (San Antonio Talairach Daemon database), for example.', + mandatory=True, argstr='-base %s') no_ss = traits.Bool( desc='Do not strip skull of input data set' diff --git a/nipype/interfaces/petpvc.py b/nipype/interfaces/petpvc.py index 8de4cfd162..753de51891 100644 --- a/nipype/interfaces/petpvc.py +++ b/nipype/interfaces/petpvc.py @@ -56,7 +56,7 @@ class PETPVCInputSpec(CommandLineInputSpec): class PETPVCOutputSpec(TraitedSpec): - out_file = File(desc = "Output file") + out_file = File(desc="Output file") class PETPVC(CommandLine): diff --git a/nipype/interfaces/tests/test_bids.py b/nipype/interfaces/tests/test_bids.py index aa5bc6c359..2ba09f5acf 100644 --- a/nipype/interfaces/tests/test_bids.py +++ b/nipype/interfaces/tests/test_bids.py @@ -42,7 +42,7 @@ def test_bids_grabber(tmpdir): reason="Pybids is not installed in editable mode") def test_bids_fields(tmpdir): tmpdir.chdir() - bg = BIDSDataGrabber(infields = ['subject'], outfields = ['dwi']) + bg = BIDSDataGrabber(infields=['subject'], outfields=['dwi']) bg.inputs.base_dir = os.path.join(datadir, 'ds005') bg.inputs.subject = '01' bg.inputs.output_query['dwi'] = dict(modality='dwi') diff --git a/nipype/workflows/fmri/fsl/preprocess.py b/nipype/workflows/fmri/fsl/preprocess.py index aa8ac03673..a4a98def2b 100644 --- a/nipype/workflows/fmri/fsl/preprocess.py +++ b/nipype/workflows/fmri/fsl/preprocess.py @@ -533,7 +533,7 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle', if whichvol != 'mean': extract_ref = pe.Node(interface=fsl.ExtractROI(t_size=1), iterfield=['in_file'], - name = 'extractref') + name='extractref') featpreproc.connect(img2float, ('out_file', pickrun, whichrun), extract_ref, 'in_file') featpreproc.connect(img2float, ('out_file', pickvol, 0, whichvol), extract_ref, 't_min') featpreproc.connect(extract_ref, 'roi_file', outputnode, 'reference') @@ -572,7 +572,7 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle', Extract the mean volume of the first functional run """ - meanfunc = pe.Node(interface=fsl.ImageMaths(op_string = '-Tmean', suffix='_mean'), + meanfunc = pe.Node(interface=fsl.ImageMaths(op_string='-Tmean', suffix='_mean'), name='meanfunc') featpreproc.connect(motion_correct, ('out_file', pickrun, whichrun), meanfunc, 'in_file') From 9ed771fc6bfd48ddef1c74efdbcd26d45a015348 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 03:14:06 +0100 Subject: [PATCH 118/365] STY: correction of E221 - multiple spaces before operator --- nipype/interfaces/freesurfer/model.py | 4 ++-- nipype/interfaces/petpvc.py | 20 +++++++++---------- .../interfaces/utility/tests/test_wrappers.py | 2 +- nipype/pipeline/engine/tests/test_engine.py | 2 +- nipype/scripts/utils.py | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nipype/interfaces/freesurfer/model.py b/nipype/interfaces/freesurfer/model.py index 71de48d786..55d0b5f225 100644 --- a/nipype/interfaces/freesurfer/model.py +++ b/nipype/interfaces/freesurfer/model.py @@ -183,10 +183,10 @@ def run(self, **inputs): def _format_arg(self, name, spec, value): # mris_preproc looks for these files in the surf dir - if name == 'surfreg_files': + if name == 'surfreg_files': basename = os.path.basename(value[0]) return spec.argstr % basename.lstrip('rh.').lstrip('lh.') - if name == "surf_measure_file": + if name == "surf_measure_file": basename = os.path.basename(value) return spec.argstr % basename.lstrip('rh.').lstrip('lh.') return super(MRISPreprocReconAll, self)._format_arg(name, spec, value) diff --git a/nipype/interfaces/petpvc.py b/nipype/interfaces/petpvc.py index 753de51891..6d85282a52 100644 --- a/nipype/interfaces/petpvc.py +++ b/nipype/interfaces/petpvc.py @@ -41,17 +41,17 @@ class PETPVCInputSpec(CommandLineInputSpec): - in_file = File(desc="PET image file", exists=True, mandatory=True, argstr="-i %s") - out_file = File(desc="Output file", genfile=True, hash_files=False, argstr="-o %s") + in_file = File(desc="PET image file", exists=True, mandatory=True, argstr="-i %s") + out_file = File(desc="Output file", genfile=True, hash_files=False, argstr="-o %s") mask_file = File(desc="Mask image file", exists=True, mandatory=True, argstr="-m %s") - pvc = traits.Enum(pvc_methods, desc="Desired PVC method", mandatory=True, argstr="-p %s") - fwhm_x = traits.Float(desc="The full-width at half maximum in mm along x-axis", mandatory=True, argstr="-x %.4f") - fwhm_y = traits.Float(desc="The full-width at half maximum in mm along y-axis", mandatory=True, argstr="-y %.4f") - fwhm_z = traits.Float(desc="The full-width at half maximum in mm along z-axis", mandatory=True, argstr="-z %.4f") - debug = traits.Bool(desc="Prints debug information", usedefault=True, default_value=False, argstr="-d") - n_iter = traits.Int(desc="Number of iterations", default_value=10, argstr="-n %d") - n_deconv = traits.Int(desc="Number of deconvolution iterations", default_value=10, argstr="-k %d") - alpha = traits.Float(desc="Alpha value", default_value=1.5, argstr="-a %.4f") + pvc = traits.Enum(pvc_methods, desc="Desired PVC method", mandatory=True, argstr="-p %s") + fwhm_x = traits.Float(desc="The full-width at half maximum in mm along x-axis", mandatory=True, argstr="-x %.4f") + fwhm_y = traits.Float(desc="The full-width at half maximum in mm along y-axis", mandatory=True, argstr="-y %.4f") + fwhm_z = traits.Float(desc="The full-width at half maximum in mm along z-axis", mandatory=True, argstr="-z %.4f") + debug = traits.Bool(desc="Prints debug information", usedefault=True, default_value=False, argstr="-d") + n_iter = traits.Int(desc="Number of iterations", default_value=10, argstr="-n %d") + n_deconv = traits.Int(desc="Number of deconvolution iterations", default_value=10, argstr="-k %d") + alpha = traits.Float(desc="Alpha value", default_value=1.5, argstr="-a %.4f") stop_crit = traits.Float(desc="Stopping criterion", default_value=0.01, argstr="-a %.4f") diff --git a/nipype/interfaces/utility/tests/test_wrappers.py b/nipype/interfaces/utility/tests/test_wrappers.py index b995dc27ad..e8aa537413 100644 --- a/nipype/interfaces/utility/tests/test_wrappers.py +++ b/nipype/interfaces/utility/tests/test_wrappers.py @@ -93,7 +93,7 @@ def _inc(x): return x + 1 params = pe.Node(utility.IdentityInterface(fields=['size', 'num']), name='params') - params.inputs.num = 42 + params.inputs.num = 42 params.inputs.size = 1 gen_tuple = pe.Node(utility.Function(input_names=['size'], diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index c7b6c2f35a..400293d4f9 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -472,7 +472,7 @@ def double_func(x): double_node = MapNode(double, name="double", iterfield=["x"]) double_node.inputs.x = x_inp - res = double_node.run() + res = double_node.run() assert res.outputs.f_x == f_exp diff --git a/nipype/scripts/utils.py b/nipype/scripts/utils.py index e35f4d464e..99e9665291 100644 --- a/nipype/scripts/utils.py +++ b/nipype/scripts/utils.py @@ -20,7 +20,7 @@ ignore_unknown_options=True) # specification of existing ParamTypes -ExistingDirPath = click.Path(exists=True, file_okay=False, resolve_path=True) +ExistingDirPath = click.Path(exists=True, file_okay=False, resolve_path=True) ExistingFilePath = click.Path(exists=True, dir_okay=False, resolve_path=True) UnexistingFilePath = click.Path(dir_okay=False, resolve_path=True) From 70681c0a5a4b05ad3e0ce83a745a637c2d877e3c Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 03:17:06 +0100 Subject: [PATCH 119/365] STY: correction of E502 - the backslash is redundant between brackets --- nipype/algorithms/confounds.py | 8 ++++---- nipype/interfaces/ants/tests/test_resampling.py | 2 +- nipype/interfaces/io.py | 16 ++++++++-------- nipype/utils/draw_gantt_chart.py | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nipype/algorithms/confounds.py b/nipype/algorithms/confounds.py index 4bb0ddeac6..9199871a17 100644 --- a/nipype/algorithms/confounds.py +++ b/nipype/algorithms/confounds.py @@ -58,10 +58,10 @@ class ComputeDVARSInputSpec(BaseInterfaceInputSpec): 'by the median calculated across all voxels' 'and timepoints within the mask (if specified)' 'and then multiply by the value specified by' - 'this parameter. By using the default (1000)' \ - 'output DVARS will be expressed in ' \ - 'x10 % BOLD units compatible with Power et al.' \ - '2012. Set this to 0 to disable intensity' \ + 'this parameter. By using the default (1000)' + 'output DVARS will be expressed in ' + 'x10 % BOLD units compatible with Power et al.' + '2012. Set this to 0 to disable intensity' 'normalization altogether.') diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index c51d497794..e4d0f5ddb1 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -24,7 +24,7 @@ def create_wimt(): wimt = WarpImageMultiTransform() wimt.inputs.input_image = 'diffusion_weighted.nii' wimt.inputs.reference_image = 'functional.nii' - wimt.inputs.transformation_series = ['func2anat_coreg_Affine.txt','func2anat_InverseWarp.nii.gz', \ + wimt.inputs.transformation_series = ['func2anat_coreg_Affine.txt','func2anat_InverseWarp.nii.gz', 'dwi2anat_Warp.nii.gz','dwi2anat_coreg_Affine.txt'] return wimt diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index 0793b955bd..6265836053 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -190,8 +190,8 @@ class DataSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): 'it with')) regexp_substitutions = \ InputMultiPath(traits.Tuple(Str, Str), - desc=('List of 2-tuples reflecting a pair of a '\ - 'Python regexp pattern and a replacement '\ + desc=('List of 2-tuples reflecting a pair of a ' + 'Python regexp pattern and a replacement ' 'string. Invoked after string `substitutions`')) _outputs = traits.Dict(Str, value={}, usedefault=True) @@ -199,11 +199,11 @@ class DataSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): desc='remove dest directory when copying dirs') # AWS S3 data attributes - creds_path = Str(desc='Filepath to AWS credentials file for S3 bucket '\ - 'access; if not specified, the credentials will '\ - 'be taken from the AWS_ACCESS_KEY_ID and '\ + creds_path = Str(desc='Filepath to AWS credentials file for S3 bucket ' + 'access; if not specified, the credentials will ' + 'be taken from the AWS_ACCESS_KEY_ID and ' 'AWS_SECRET_ACCESS_KEY environment variables') - encrypt_bucket_keys = traits.Bool(desc='Flag indicating whether to use S3 '\ + encrypt_bucket_keys = traits.Bool(desc='Flag indicating whether to use S3 ' 'server-side AES-256 encryption') # Set this if user wishes to override the bucket with their own bucket = traits.Any(desc='Boto3 S3 bucket for manual override of bucket') @@ -588,7 +588,7 @@ def _upload_to_s3(self, bucket, src, dst): for root, dirs, files in os.walk(src): src_files.extend([os.path.join(root, fil) for fil in files]) # Make the dst files have the dst folder as base dir - dst_files = [os.path.join(dst, src_f.split(src)[1]) \ + dst_files = [os.path.join(dst, src_f.split(src)[1]) for src_f in src_files] else: src_files = [src] @@ -669,7 +669,7 @@ def _list_outputs(self): 's3_datasink_' + bucket_name) outdir = local_out_exception # Log local copying directory - iflogger.info('Access to S3 failed! Storing outputs locally at: '\ + iflogger.info('Access to S3 failed! Storing outputs locally at: ' '%s\nError: %s', outdir, exc) else: s3dir = '' diff --git a/nipype/utils/draw_gantt_chart.py b/nipype/utils/draw_gantt_chart.py index fc78f49ea5..1a35b66b22 100644 --- a/nipype/utils/draw_gantt_chart.py +++ b/nipype/utils/draw_gantt_chart.py @@ -22,7 +22,7 @@ try: import pandas as pd except ImportError: - print('Pandas not found; in order for full functionality of this module '\ + print('Pandas not found; in order for full functionality of this module ' 'install the pandas package') pass @@ -248,7 +248,7 @@ def draw_nodes(start, nodes_list, cores, minute_scale, space_between_minutes, scale = space_between_minutes / minute_scale space_between_minutes = space_between_minutes / scale end_times = [datetime.datetime(start.year, start.month, start.day, - start.hour, start.minute, start.second) \ + start.hour, start.minute, start.second) for core in range(cores)] # For each node in the pipeline From 6d3a76b4348c96fa5de6b4d615d7b6b0e64d14b5 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 13:13:06 +0100 Subject: [PATCH 120/365] STY: correction of E701 - multiple statements on one line (colon) --- nipype/algorithms/tests/test_compcor.py | 6 ++++-- nipype/algorithms/tests/test_misc.py | 3 ++- nipype/algorithms/tests/test_modelgen.py | 3 ++- .../freesurfer/tests/test_preprocess.py | 12 ++++++++---- .../interfaces/freesurfer/tests/test_utils.py | 18 ++++++++++++------ nipype/interfaces/fsl/tests/test_preprocess.py | 9 ++++++--- nipype/interfaces/nitime/tests/test_nitime.py | 3 ++- nipype/interfaces/spm/tests/test_utils.py | 15 ++++++++++----- nipype/pipeline/engine/tests/test_engine.py | 18 ++++++++++++------ nipype/pipeline/plugins/tests/test_debug.py | 3 ++- nipype/utils/tests/test_functions.py | 3 ++- 11 files changed, 62 insertions(+), 31 deletions(-) diff --git a/nipype/algorithms/tests/test_compcor.py b/nipype/algorithms/tests/test_compcor.py index 455e994f6e..7f716e909a 100644 --- a/nipype/algorithms/tests/test_compcor.py +++ b/nipype/algorithms/tests/test_compcor.py @@ -102,13 +102,15 @@ def test_compcor_bad_input_shapes(self): data_file = utils.save_toy_nii(np.zeros(data_shape), 'temp.nii') interface = CompCor(realigned_file=data_file, mask_files=self.mask_files[0]) - with pytest.raises(ValueError, message="Dimension mismatch"): interface.run() + with pytest.raises(ValueError, message="Dimension mismatch"): + interface.run() def test_tcompcor_bad_input_dim(self): bad_dims = (2, 2, 2) data_file = utils.save_toy_nii(np.zeros(bad_dims), 'temp.nii') interface = TCompCor(realigned_file=data_file) - with pytest.raises(ValueError, message='Not a 4D file'): interface.run() + with pytest.raises(ValueError, message='Not a 4D file'): + interface.run() def test_tcompcor_merge_intersect_masks(self): for method in ['union', 'intersect']: diff --git a/nipype/algorithms/tests/test_misc.py b/nipype/algorithms/tests/test_misc.py index d148ee8ca1..84c70bfe98 100644 --- a/nipype/algorithms/tests/test_misc.py +++ b/nipype/algorithms/tests/test_misc.py @@ -39,7 +39,8 @@ def test_CalculateMedian(create_analyze_pair_file_in_directory): mean = misc.CalculateMedian() - with pytest.raises(TypeError): mean.run() + with pytest.raises(TypeError): + mean.run() mean.inputs.in_files = example_data('ds003_sub-01_mc.nii.gz') eg = mean.run() diff --git a/nipype/algorithms/tests/test_modelgen.py b/nipype/algorithms/tests/test_modelgen.py index f3f7a37aa7..4a45e76c4d 100644 --- a/nipype/algorithms/tests/test_modelgen.py +++ b/nipype/algorithms/tests/test_modelgen.py @@ -24,7 +24,8 @@ def test_modelgen1(tmpdir): s = SpecifyModel() s.inputs.input_units = 'scans' set_output_units = lambda: setattr(s.inputs, 'output_units', 'scans') - with pytest.raises(TraitError): set_output_units() + with pytest.raises(TraitError): + set_output_units() s.inputs.functional_runs = [filename1, filename2] s.inputs.time_repetition = 6 s.inputs.high_pass_filter_cutoff = 128. diff --git a/nipype/interfaces/freesurfer/tests/test_preprocess.py b/nipype/interfaces/freesurfer/tests/test_preprocess.py index 4965329fae..e4ae160d96 100644 --- a/nipype/interfaces/freesurfer/tests/test_preprocess.py +++ b/nipype/interfaces/freesurfer/tests/test_preprocess.py @@ -23,7 +23,8 @@ def test_robustregister(create_files_in_directory): assert reg.cmd == 'mri_robust_register' # test raising error with mandatory args absent - with pytest.raises(ValueError): reg.run() + with pytest.raises(ValueError): + reg.run() # .inputs based parameters setting reg.inputs.source_file = filelist[0] @@ -51,7 +52,8 @@ def test_fitmsparams(create_files_in_directory): assert fit.cmd == 'mri_ms_fitparms' # test raising error with mandatory args absent - with pytest.raises(ValueError): fit.run() + with pytest.raises(ValueError): + fit.run() # .inputs based parameters setting fit.inputs.in_files = filelist @@ -74,7 +76,8 @@ def test_synthesizeflash(create_files_in_directory): assert syn.cmd == 'mri_synthesize' # test raising error with mandatory args absent - with pytest.raises(ValueError): syn.run() + with pytest.raises(ValueError): + syn.run() # .inputs based parameters setting syn.inputs.t1_image = filelist[0] @@ -100,7 +103,8 @@ def test_mandatory_outvol(create_files_in_directory): assert mni.cmd == "mri_nu_correct.mni" # test raising error with mandatory args absent - with pytest.raises(ValueError): mni.cmdline + with pytest.raises(ValueError): + mni.cmdline # test with minimal args mni.inputs.in_file = filelist[0] diff --git a/nipype/interfaces/freesurfer/tests/test_utils.py b/nipype/interfaces/freesurfer/tests/test_utils.py index 054aeb276e..cbee31bb48 100644 --- a/nipype/interfaces/freesurfer/tests/test_utils.py +++ b/nipype/interfaces/freesurfer/tests/test_utils.py @@ -23,7 +23,8 @@ def test_sample2surf(create_files_in_directory_plus_dummy_file): assert s2s.cmd == 'mri_vol2surf' # Test mandatory args exception - with pytest.raises(ValueError): s2s.run() + with pytest.raises(ValueError): + s2s.run() # Create testing files files, cwd = create_files_in_directory_plus_dummy_file @@ -53,7 +54,8 @@ def test_sample2surf(create_files_in_directory_plus_dummy_file): # Test that a 2-tuple range raises an error def set_illegal_range(): s2s.inputs.sampling_range = (.2, .5) - with pytest.raises(TraitError): set_illegal_range() + with pytest.raises(TraitError): + set_illegal_range() @pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed") @@ -65,7 +67,8 @@ def test_surfsmooth(create_surf_file_in_directory): assert smooth.cmd == "mri_surf2surf" # Test mandatory args exception - with pytest.raises(ValueError): smooth.run() + with pytest.raises(ValueError): + smooth.run() # Create testing files surf, cwd = create_surf_file_in_directory @@ -97,7 +100,8 @@ def test_surfxfm(create_surf_file_in_directory): assert xfm.cmd == "mri_surf2surf" # Test mandatory args exception - with pytest.raises(ValueError): xfm.run() + with pytest.raises(ValueError): + xfm.run() # Create testing files surf, cwd = create_surf_file_in_directory @@ -128,7 +132,8 @@ def test_surfshots(create_files_in_directory_plus_dummy_file): assert fotos.cmd == "tksurfer" # Test mandatory args exception - with pytest.raises(ValueError): fotos.run() + with pytest.raises(ValueError): + fotos.run() # Create testing files files, cwd = create_files_in_directory_plus_dummy_file @@ -158,7 +163,8 @@ def test_surfshots(create_files_in_directory_plus_dummy_file): try: hold_display = os.environ["DISPLAY"] del os.environ["DISPLAY"] - with pytest.raises(RuntimeError): fotos.run() + with pytest.raises(RuntimeError): + fotos.run() os.environ["DISPLAY"] = hold_display except KeyError: pass diff --git a/nipype/interfaces/fsl/tests/test_preprocess.py b/nipype/interfaces/fsl/tests/test_preprocess.py index e404177e87..cd5f50ac6f 100644 --- a/nipype/interfaces/fsl/tests/test_preprocess.py +++ b/nipype/interfaces/fsl/tests/test_preprocess.py @@ -239,7 +239,8 @@ def test_flirt(setup_flirt): axfm = deepcopy(flirter) axfm.inputs.apply_xfm = True # in_matrix_file or uses_qform must be defined - with pytest.raises(RuntimeError): axfm.cmdline + with pytest.raises(RuntimeError): + axfm.cmdline axfm2 = deepcopy(axfm) # test uses_qform axfm.inputs.uses_qform = True @@ -569,8 +570,10 @@ def test_fugue(setup_fugue, attr, out_file): fugue = fsl.FUGUE() for key, value in attr.items(): - if value == "infile": setattr(fugue.inputs, key, infile) - else: setattr(fugue.inputs, key, value) + if value == "infile": + setattr(fugue.inputs, key, infile) + else: + setattr(fugue.inputs, key, value) res = fugue.run() assert isdefined(getattr(res.outputs,out_file)) diff --git a/nipype/interfaces/nitime/tests/test_nitime.py b/nipype/interfaces/nitime/tests/test_nitime.py index d37fea4f4f..12aff75b3b 100644 --- a/nipype/interfaces/nitime/tests/test_nitime.py +++ b/nipype/interfaces/nitime/tests/test_nitime.py @@ -21,7 +21,8 @@ def test_read_csv(): CA = nitime.CoherenceAnalyzer() CA.inputs.TR = 1.89 # bogus value just to pass traits test CA.inputs.in_file = example_data('fmri_timeseries_nolabels.csv') - with pytest.raises(ValueError): CA._read_csv() + with pytest.raises(ValueError): + CA._read_csv() CA.inputs.in_file = example_data('fmri_timeseries.csv') data, roi_names = CA._read_csv() diff --git a/nipype/interfaces/spm/tests/test_utils.py b/nipype/interfaces/spm/tests/test_utils.py index 43b759717e..a574fb90a7 100644 --- a/nipype/interfaces/spm/tests/test_utils.py +++ b/nipype/interfaces/spm/tests/test_utils.py @@ -50,8 +50,10 @@ def test_reslice(): reslice.inputs.in_file = moving reslice.inputs.space_defining = space_defining assert reslice.inputs.interp == 0 - with pytest.raises(TraitError): reslice.inputs.trait_set(interp='nearest') - with pytest.raises(TraitError): reslice.inputs.trait_set(interp=10) + with pytest.raises(TraitError): + reslice.inputs.trait_set(interp='nearest') + with pytest.raises(TraitError): + reslice.inputs.trait_set(interp=10) reslice.inputs.interp = 1 script = reslice._make_matlab_command(None) outfile = fname_presuffix(moving, prefix='r') @@ -71,8 +73,11 @@ def test_dicom_import(): assert di.inputs.output_dir == './converted_dicom' assert di.inputs.format == 'nii' assert not di.inputs.icedims - with pytest.raises(TraitError): di.inputs.trait_set(output_dir_struct='wrong') - with pytest.raises(TraitError): di.inputs.trait_set(format='FAT') - with pytest.raises(TraitError): di.inputs.trait_set(in_files=['does_sfd_not_32fn_exist.dcm']) + with pytest.raises(TraitError): + di.inputs.trait_set(output_dir_struct='wrong') + with pytest.raises(TraitError): + di.inputs.trait_set(format='FAT') + with pytest.raises(TraitError): + di.inputs.trait_set(in_files=['does_sfd_not_32fn_exist.dcm']) di.inputs.in_files = [dicom] assert di.inputs.in_files == [dicom] diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index 400293d4f9..cac377917c 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -44,7 +44,8 @@ def _list_outputs(self): def test_init(): - with pytest.raises(TypeError): pe.Workflow() + with pytest.raises(TypeError): + pe.Workflow() pipe = pe.Workflow(name='pipe') assert type(pipe._graph) == nx.DiGraph @@ -413,7 +414,8 @@ def test_doubleconnect(): def test_node_init(): - with pytest.raises(Exception): pe.Node() + with pytest.raises(Exception): + pe.Node() try: node = pe.Node(EngineTestInterface, name='test') except IOError: @@ -431,8 +433,10 @@ def test_workflow_add(): w1 = pe.Workflow(name='test') w1.connect(n1, 'a', n2, 'c') for node in [n1, n2, n3]: - with pytest.raises(IOError): w1.add_nodes([node]) - with pytest.raises(IOError): w1.connect([(w1, n2, [('n1.a', 'd')])]) + with pytest.raises(IOError): + w1.add_nodes([node]) + with pytest.raises(IOError): + w1.connect([(w1, n2, [('n1.a', 'd')])]) def test_node_get_output(): @@ -448,13 +452,15 @@ def test_mapnode_iterfield_check(): mod1 = pe.MapNode(EngineTestInterface(), iterfield=['input1'], name='mod1') - with pytest.raises(ValueError): mod1._check_iterfield() + with pytest.raises(ValueError): + mod1._check_iterfield() mod1 = pe.MapNode(EngineTestInterface(), iterfield=['input1', 'input2'], name='mod1') mod1.inputs.input1 = [1, 2] mod1.inputs.input2 = 3 - with pytest.raises(ValueError): mod1._check_iterfield() + with pytest.raises(ValueError): + mod1._check_iterfield() @pytest.mark.parametrize("x_inp, f_exp", [ diff --git a/nipype/pipeline/plugins/tests/test_debug.py b/nipype/pipeline/plugins/tests/test_debug.py index e7997ba7f0..0b6bbc7150 100644 --- a/nipype/pipeline/plugins/tests/test_debug.py +++ b/nipype/pipeline/plugins/tests/test_debug.py @@ -46,7 +46,8 @@ def test_debug(tmpdir): mod1.inputs.input1 = 1 run_wf = lambda: pipe.run(plugin="Debug") - with pytest.raises(ValueError): run_wf() + with pytest.raises(ValueError): + run_wf() exc = None try: diff --git a/nipype/utils/tests/test_functions.py b/nipype/utils/tests/test_functions.py index 1d9b9dac7a..4dfa114ff4 100644 --- a/nipype/utils/tests/test_functions.py +++ b/nipype/utils/tests/test_functions.py @@ -19,7 +19,8 @@ def func1(x): def test_func_to_str_err(): bad_src = "obbledygobbledygook" - with pytest.raises(RuntimeError): create_function_from_source(bad_src) + with pytest.raises(RuntimeError): + create_function_from_source(bad_src) def _print_statement(): try: From d540d54408f80b4ab95d09d8d0bae631eded91d9 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 13:20:28 +0100 Subject: [PATCH 121/365] STY: correction of E203 - whitespace before ':' or ',' --- nipype/info.py | 2 +- nipype/interfaces/io.py | 2 +- nipype/interfaces/tests/test_io.py | 4 +-- nipype/interfaces/utility/tests/test_base.py | 4 +-- nipype/pipeline/plugins/tests/test_tools.py | 6 ++-- nipype/utils/draw_gantt_chart.py | 32 ++++++++++---------- nipype/workflows/smri/freesurfer/utils.py | 26 ++++++++-------- 7 files changed, 38 insertions(+), 38 deletions(-) diff --git a/nipype/info.py b/nipype/info.py index 8714f99707..6b462e3516 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -162,7 +162,7 @@ def get_nipype_gitversion(): 'profiler': ['psutil>=5.0'], 'duecredit': ['duecredit'], 'xvfbwrapper': ['xvfbwrapper'], - 'pybids' : ['pybids'] + 'pybids': ['pybids'] # 'mesh': ['mayavi'] # Enable when it works } diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index 6265836053..09bddcf526 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -622,7 +622,7 @@ def _upload_to_s3(self, bucket, src, dst): iflogger.info('Uploading %s to S3 bucket, %s, as %s...', src_f, bucket.name, dst_f) if self.inputs.encrypt_bucket_keys: - extra_args = {'ServerSideEncryption' : 'AES256'} + extra_args = {'ServerSideEncryption': 'AES256'} else: extra_args = {} bucket.upload_file(src_f, dst_k, ExtraArgs=extra_args, diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index e2eb4e3c09..82b2730701 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -420,8 +420,8 @@ def test_jsonsink_input(): @pytest.mark.parametrize("inputs_attributes", [ - {'new_entry' : 'someValue'}, - {'new_entry' : 'someValue', 'test' : 'testInfields'} + {'new_entry': 'someValue'}, + {'new_entry': 'someValue', 'test': 'testInfields'} ]) def test_jsonsink(tmpdir, inputs_attributes): tmpdir.chdir() diff --git a/nipype/interfaces/utility/tests/test_base.py b/nipype/interfaces/utility/tests/test_base.py index 3e66f827d2..058be87885 100644 --- a/nipype/interfaces/utility/tests/test_base.py +++ b/nipype/interfaces/utility/tests/test_base.py @@ -37,8 +37,8 @@ def test_rename(tmpdir): @pytest.mark.parametrize("args, expected", [ - ({} , ([0], [1,2,3])), - ({"squeeze" : True}, (0 , [1,2,3])) + ({}, ([0], [1,2,3])), + ({"squeeze": True}, (0, [1,2,3])) ]) def test_split(tmpdir, args, expected): tmpdir.chdir() diff --git a/nipype/pipeline/plugins/tests/test_tools.py b/nipype/pipeline/plugins/tests/test_tools.py index 479cc773df..def55058f2 100644 --- a/nipype/pipeline/plugins/tests/test_tools.py +++ b/nipype/pipeline/plugins/tests/test_tools.py @@ -18,9 +18,9 @@ def test_report_crash(): mock_node = mock.MagicMock(name='mock_node') mock_node._id = 'an_id' mock_node.config = { - 'execution' : { - 'crashdump_dir' : '.', - 'crashfile_format' : 'pklz', + 'execution': { + 'crashdump_dir': '.', + 'crashfile_format': 'pklz', } } diff --git a/nipype/utils/draw_gantt_chart.py b/nipype/utils/draw_gantt_chart.py index 1a35b66b22..ee62c6250a 100644 --- a/nipype/utils/draw_gantt_chart.py +++ b/nipype/utils/draw_gantt_chart.py @@ -283,14 +283,14 @@ def draw_nodes(start, nodes_list, cores, minute_scale, space_between_minutes, color = 'red' # Setup dictionary for node html string insertion - node_dict = {'left' : left, - 'offset' : offset, - 'scale_duration' : scale_duration, - 'color' : color, - 'node_name' : node['name'], - 'node_dur' : node['duration'] / 60.0, - 'node_start' : node_start.strftime("%Y-%m-%d %H:%M:%S"), - 'node_finish' : node_finish.strftime("%Y-%m-%d %H:%M:%S")} + node_dict = {'left': left, + 'offset': offset, + 'scale_duration': scale_duration, + 'color': color, + 'node_name': node['name'], + 'node_dur': node['duration'] / 60.0, + 'node_start': node_start.strftime("%Y-%m-%d %H:%M:%S"), + 'node_finish': node_finish.strftime("%Y-%m-%d %H:%M:%S")} # Create new node string new_node = "
Date: Sat, 6 Jan 2018 13:27:47 +0100 Subject: [PATCH 122/365] STY: correction of E261 - at least two spaces before inline comment --- examples/fmri_fsl_reuse.py | 14 +++++++------- examples/fmri_spm_dartel.py | 18 +++++++++--------- nipype/algorithms/confounds.py | 6 +++--- nipype/algorithms/tests/test_compcor.py | 4 ++-- nipype/algorithms/tests/test_tsnr.py | 2 +- nipype/interfaces/dcm2nii.py | 2 +- nipype/interfaces/freesurfer/utils.py | 6 +++--- nipype/interfaces/fsl/tests/test_base.py | 8 ++++---- nipype/interfaces/nilearn.py | 12 ++++++------ nipype/interfaces/tests/test_nilearn.py | 2 +- nipype/pipeline/engine/tests/test_engine.py | 16 ++++++++-------- nipype/pipeline/engine/workflows.py | 12 ++++++------ nipype/pipeline/plugins/tests/test_tools.py | 2 +- nipype/sphinxext/plot_workflow.py | 2 +- .../workflows/rsfmri/fsl/tests/test_resting.py | 2 +- nipype/workflows/smri/freesurfer/autorecon2.py | 2 +- nipype/workflows/smri/freesurfer/recon.py | 4 ++-- tools/run_examples.py | 2 +- 18 files changed, 58 insertions(+), 58 deletions(-) diff --git a/examples/fmri_fsl_reuse.py b/examples/fmri_fsl_reuse.py index beb09f0345..85c2c7f2c8 100755 --- a/examples/fmri_fsl_reuse.py +++ b/examples/fmri_fsl_reuse.py @@ -20,13 +20,13 @@ from builtins import str from builtins import range -import os # system functions -import nipype.interfaces.io as nio # Data i/o -import nipype.interfaces.fsl as fsl # fsl -from nipype.interfaces import utility as niu # Utilities -import nipype.pipeline.engine as pe # pypeline engine -import nipype.algorithms.modelgen as model # model generation -import nipype.algorithms.rapidart as ra # artifact detection +import os # system functions +import nipype.interfaces.io as nio # Data i/o +import nipype.interfaces.fsl as fsl # fsl +from nipype.interfaces import utility as niu # Utilities +import nipype.pipeline.engine as pe # pypeline engine +import nipype.algorithms.modelgen as model # model generation +import nipype.algorithms.rapidart as ra # artifact detection from nipype.workflows.fmri.fsl import (create_featreg_preproc, create_modelfit_workflow, diff --git a/examples/fmri_spm_dartel.py b/examples/fmri_spm_dartel.py index 746da9f810..0246b8a722 100755 --- a/examples/fmri_spm_dartel.py +++ b/examples/fmri_spm_dartel.py @@ -19,15 +19,15 @@ from builtins import str from builtins import range -import nipype.interfaces.io as nio # Data i/o -import nipype.interfaces.spm as spm # spm -import nipype.workflows.fmri.spm as spm_wf # spm -import nipype.interfaces.fsl as fsl # fsl -from nipype.interfaces import utility as niu # Utilities -import nipype.pipeline.engine as pe # pypeline engine -import nipype.algorithms.rapidart as ra # artifact detection -import nipype.algorithms.modelgen as model # model specification -import os # system functions +import nipype.interfaces.io as nio # Data i/o +import nipype.interfaces.spm as spm # spm +import nipype.workflows.fmri.spm as spm_wf # spm +import nipype.interfaces.fsl as fsl # fsl +from nipype.interfaces import utility as niu # Utilities +import nipype.pipeline.engine as pe # pypeline engine +import nipype.algorithms.rapidart as ra # artifact detection +import nipype.algorithms.modelgen as model # model specification +import os # system functions """ diff --git a/nipype/algorithms/confounds.py b/nipype/algorithms/confounds.py index 9199871a17..24db2cc565 100644 --- a/nipype/algorithms/confounds.py +++ b/nipype/algorithms/confounds.py @@ -324,7 +324,7 @@ class CompCorInputSpec(BaseInterfaceInputSpec): 'first is the default.')) components_file = traits.Str('components_file.txt', usedefault=True, desc='Filename to store physiological components') - num_components = traits.Int(6, usedefault=True) # 6 for BOLD, 4 for ASL + num_components = traits.Int(6, usedefault=True) # 6 for BOLD, 4 for ASL pre_filter = traits.Enum('polynomial', 'cosine', False, usedefault=True, desc='Detrend time series prior to component ' 'extraction') @@ -929,7 +929,7 @@ def regress_poly(degree, data, remove_mean=True, axis=-1): data = data.reshape((-1, timepoints)) # Generate design matrix - X = np.ones((timepoints, 1)) # quick way to calc degree 0 + X = np.ones((timepoints, 1)) # quick way to calc degree 0 for i in range(degree): polynomial_func = Legendre.basis(i + 1) value_array = np.linspace(-1, 1, timepoints) @@ -943,7 +943,7 @@ def regress_poly(degree, data, remove_mean=True, axis=-1): # Estimation if remove_mean: datahat = X.dot(betas).T - else: # disregard the first layer of X, which is degree 0 + else: # disregard the first layer of X, which is degree 0 datahat = X[:, 1:].dot(betas[1:, ...]).T regressed_data = data - datahat diff --git a/nipype/algorithms/tests/test_compcor.py b/nipype/algorithms/tests/test_compcor.py index 7f716e909a..952d079d37 100644 --- a/nipype/algorithms/tests/test_compcor.py +++ b/nipype/algorithms/tests/test_compcor.py @@ -95,8 +95,8 @@ def test_tcompcor_asymmetric_dim(self): assert nb.load('mask_000.nii.gz').get_data().shape == asymmetric_shape[:3] def test_compcor_bad_input_shapes(self): - shape_less_than = (1, 2, 2, 5) # dim 0 is < dim 0 of self.mask_files (2) - shape_more_than = (3, 3, 3, 5) # dim 0 is > dim 0 of self.mask_files (2) + shape_less_than = (1, 2, 2, 5) # dim 0 is < dim 0 of self.mask_files (2) + shape_more_than = (3, 3, 3, 5) # dim 0 is > dim 0 of self.mask_files (2) for data_shape in (shape_less_than, shape_more_than): data_file = utils.save_toy_nii(np.zeros(data_shape), 'temp.nii') diff --git a/nipype/algorithms/tests/test_tsnr.py b/nipype/algorithms/tests/test_tsnr.py index f4bac9a17d..e78da27606 100644 --- a/nipype/algorithms/tests/test_tsnr.py +++ b/nipype/algorithms/tests/test_tsnr.py @@ -20,7 +20,7 @@ class TestTSNR(): 'in_file': 'tsnrinfile.nii', } - out_filenames = {# default output file names + out_filenames = { # default output file names 'detrended_file': 'detrend.nii.gz', 'mean_file': 'mean.nii.gz', 'stddev_file': 'stdev.nii.gz', diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py index 88ed4b1f52..5fb2b6480e 100644 --- a/nipype/interfaces/dcm2nii.py +++ b/nipype/interfaces/dcm2nii.py @@ -303,7 +303,7 @@ def _parse_stdout(self, stdout): for line in stdout.split("\n"): if not skip: out_file = None - if line.startswith("Convert "): # output + if line.startswith("Convert "): # output fname = str(re.search('\S+/\S+', line).group(0)) if isdefined(self.inputs.output_dir): output_dir = self.inputs.output_dir diff --git a/nipype/interfaces/freesurfer/utils.py b/nipype/interfaces/freesurfer/utils.py index ca9130122e..28c2aecc46 100644 --- a/nipype/interfaces/freesurfer/utils.py +++ b/nipype/interfaces/freesurfer/utils.py @@ -49,13 +49,13 @@ def copy2subjdir(cls, in_file, folder=None, basename=None, subject_id=None): if isdefined(cls.inputs.subjects_dir): subjects_dir = cls.inputs.subjects_dir else: - subjects_dir = os.getcwd() # if not use cwd + subjects_dir = os.getcwd() # if not use cwd # check for subject_id if not subject_id: if isdefined(cls.inputs.subject_id): subject_id = cls.inputs.subject_id else: - subject_id = 'subject_id' # default + subject_id = 'subject_id' # default # check for basename if basename is None: basename = os.path.basename(in_file) @@ -2114,7 +2114,7 @@ def _format_arg(self, name, spec, value): else: prefix = basename if prefix == 'aseg': - return # aseg is already the default + return # aseg is already the default return spec.argstr % prefix elif name in ['orig_white', 'orig_pial']: # these inputs do take full file paths or even basenames diff --git a/nipype/interfaces/fsl/tests/test_base.py b/nipype/interfaces/fsl/tests/test_base.py index 916f8e7826..f3d844bbf6 100644 --- a/nipype/interfaces/fsl/tests/test_base.py +++ b/nipype/interfaces/fsl/tests/test_base.py @@ -61,11 +61,11 @@ def test_FSLCommand2(): @pytest.mark.skipif(no_fsl(), reason="fsl is not installed") @pytest.mark.parametrize("args, desired_name", - [({}, {"file": 'foo.nii.gz'}), # just the filename - ({"suffix": '_brain'}, {"file": 'foo_brain.nii.gz'}), # filename with suffix + [({}, {"file": 'foo.nii.gz'}), # just the filename + ({"suffix": '_brain'}, {"file": 'foo_brain.nii.gz'}), # filename with suffix ({"suffix": '_brain', "cwd": '/data'}, - {"dir": '/data', "file": 'foo_brain.nii.gz'}), # filename with suffix and working directory - ({"suffix": '_brain.mat', "change_ext": False}, {"file": 'foo_brain.mat'}) # filename with suffix and no file extension change + {"dir": '/data', "file": 'foo_brain.nii.gz'}), # filename with suffix and working directory + ({"suffix": '_brain.mat', "change_ext": False}, {"file": 'foo_brain.mat'}s) # filename with suffix and no file extension change ]) def test_gen_fname(args, desired_name): # Test _gen_fname method of FSLCommand diff --git a/nipype/interfaces/nilearn.py b/nipype/interfaces/nilearn.py index db47b57e8b..29c6048133 100644 --- a/nipype/interfaces/nilearn.py +++ b/nipype/interfaces/nilearn.py @@ -100,15 +100,15 @@ def _process_inputs(self): maskers = [] # determine form of label files, choose appropriate nilearn masker - if np.amax(label_data.get_data()) > 1: # 3d label file + if np.amax(label_data.get_data()) > 1: # 3d label file n_labels = np.amax(label_data.get_data()) maskers.append(nl.NiftiLabelsMasker(label_data)) - else: # 4d labels + else: # 4d labels n_labels = label_data.get_data().shape[3] - if self.inputs.incl_shared_variance: # 4d labels, independent computation + if self.inputs.incl_shared_variance: # 4d labels, independent computation for img in nli.iter_img(label_data): maskers.append(nl.NiftiMapsMasker(self._4d(img.get_data(), img.affine))) - else: # 4d labels, one computation fitting all + else: # 4d labels, one computation fitting all maskers.append(nl.NiftiMapsMasker(label_data)) # check label list size @@ -124,8 +124,8 @@ def _process_inputs(self): self.inputs.label_files)) if self.inputs.include_global: - global_label_data = label_data.get_data().sum(axis=3) # sum across all regions - global_label_data = np.rint(global_label_data).astype(int).clip(0, 1) # binarize + global_label_data = label_data.get_data().sum(axis=3) # sum across all regions + global_label_data = np.rint(global_label_data).astype(int).clip(0, 1) # binarize global_label_data = self._4d(global_label_data, label_data.affine) global_masker = nl.NiftiLabelsMasker(global_label_data, detrend=self.inputs.detrend) maskers.insert(0, global_masker) diff --git a/nipype/interfaces/tests/test_nilearn.py b/nipype/interfaces/tests/test_nilearn.py index ce3846a6d3..7d06c59834 100644 --- a/nipype/interfaces/tests/test_nilearn.py +++ b/nipype/interfaces/tests/test_nilearn.py @@ -140,7 +140,7 @@ def _test_4d_label(self, wanted, fake_labels, include_global=False, incl_shared_ def assert_expected_output(self, labels, wanted): with open(self.filenames['out_file'], 'r') as output: got = [line.split() for line in output] - labels_got = got.pop(0) # remove header + labels_got = got.pop(0) # remove header assert labels_got == labels assert len(got) == self.fake_fmri_data.shape[3],'num rows and num volumes' # convert from string to float diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index cac377917c..b267567345 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -76,8 +76,8 @@ def test_add_nodes(): # ensure that all connections are tested later @pytest.mark.parametrize("iterables, expected", [ - ({"1": None}, (1,0)), # test1 - ({"1": dict(input1=lambda: [1, 2], input2=lambda: [1, 2])}, (4,0)) # test2 + ({"1": None}, (1,0)), # test1 + ({"1": dict(input1=lambda: [1, 2], input2=lambda: [1, 2])}, (4,0)) # test2 ]) def test_1mod(iterables, expected): pipe = pe.Workflow(name='pipe') @@ -91,9 +91,9 @@ def test_1mod(iterables, expected): @pytest.mark.parametrize("iterables, expected", [ - ({"1": {}, "2": dict(input1=lambda: [1, 2])}, (3,2)), # test3 - ({"1": dict(input1=lambda: [1, 2]), "2": {}}, (4,2)), # test4 - ({"1": dict(input1=lambda: [1, 2]), "2": dict(input1=lambda: [1, 2])}, (6,4)) # test5 + ({"1": {}, "2": dict(input1=lambda: [1, 2])}, (3,2)), # test3 + ({"1": dict(input1=lambda: [1, 2]), "2": {}}, (4,2)), # test4 + ({"1": dict(input1=lambda: [1, 2]), "2": dict(input1=lambda: [1, 2])}, (6,4)) # test5 ]) def test_2mods(iterables, expected): pipe = pe.Workflow(name='pipe') @@ -109,10 +109,10 @@ def test_2mods(iterables, expected): @pytest.mark.parametrize("iterables, expected, connect", [ - ({"1": {}, "2": dict(input1=lambda: [1, 2]), "3": {}}, (5,4), ("1-2","2-3")), # test6 - ({"1": dict(input1=lambda: [1, 2]), "2": {}, "3": {}}, (5,4), ("1-3","2-3")), # test7 + ({"1": {}, "2": dict(input1=lambda: [1, 2]), "3": {}}, (5,4), ("1-2","2-3")), # test6 + ({"1": dict(input1=lambda: [1, 2]), "2": {}, "3": {}}, (5,4), ("1-3","2-3")), # test7 ({"1": dict(input1=lambda: [1, 2]), "2": dict(input1=lambda: [1, 2]), "3": {}}, - (8,8), ("1-3","2-3")), # test8 + (8,8), ("1-3","2-3")), # test8 ]) def test_3mods(iterables, expected, connect): pipe = pe.Workflow(name='pipe') diff --git a/nipype/pipeline/engine/workflows.py b/nipype/pipeline/engine/workflows.py index f2ad13cddf..192d7e0f0e 100644 --- a/nipype/pipeline/engine/workflows.py +++ b/nipype/pipeline/engine/workflows.py @@ -930,13 +930,13 @@ def _get_dot(self, prefix=None, hierarchy=None, colored=False, prefix = ' ' if hierarchy is None: hierarchy = [] - colorset = ['#FFFFC8', # Y - '#0000FF', '#B4B4FF', '#E6E6FF', # B - '#FF0000', '#FFB4B4', '#FFE6E6', # R - '#00A300', '#B4FFB4', '#E6FFE6', # G - '#0000FF', '#B4B4FF'] # loop B + colorset = ['#FFFFC8', # Y + '#0000FF', '#B4B4FF', '#E6E6FF', # B + '#FF0000', '#FFB4B4', '#FFE6E6', # R + '#00A300', '#B4FFB4', '#E6FFE6', # G + '#0000FF', '#B4B4FF'] # loop B if level > len(colorset) - 2: - level = 3 # Loop back to blue + level = 3 # Loop back to blue dotlist = ['%slabel="%s";' % (prefix, self.name)] for node in nx.topological_sort(self._graph): diff --git a/nipype/pipeline/plugins/tests/test_tools.py b/nipype/pipeline/plugins/tests/test_tools.py index def55058f2..dcf3faa57f 100644 --- a/nipype/pipeline/plugins/tests/test_tools.py +++ b/nipype/pipeline/plugins/tests/test_tools.py @@ -13,7 +13,7 @@ def test_report_crash(): with mock.patch('pickle.dump', mock.MagicMock()) as mock_pickle_dump: - with mock.patch('nipype.pipeline.plugins.tools.format_exception', mock.MagicMock()): # see iss 1517 + with mock.patch('nipype.pipeline.plugins.tools.format_exception', mock.MagicMock()): # see iss 1517 mock_pickle_dump.return_value = True mock_node = mock.MagicMock(name='mock_node') mock_node._id = 'an_id' diff --git a/nipype/sphinxext/plot_workflow.py b/nipype/sphinxext/plot_workflow.py index 47f369ef75..c5250b7ad5 100644 --- a/nipype/sphinxext/plot_workflow.py +++ b/nipype/sphinxext/plot_workflow.py @@ -623,7 +623,7 @@ def run(arguments, content, options, state_machine, state, lineno): dest_dir = os.path.abspath(os.path.join(setup.app.builder.outdir, source_rel_dir)) if not os.path.exists(dest_dir): - os.makedirs(dest_dir) # no problem here for me, but just use built-ins + os.makedirs(dest_dir) # no problem here for me, but just use built-ins # how to link to files from the RST file dest_dir_link = os.path.join(relpath(setup.confdir, rst_dir), diff --git a/nipype/workflows/rsfmri/fsl/tests/test_resting.py b/nipype/workflows/rsfmri/fsl/tests/test_resting.py index c176d49ed6..39061e6f8c 100644 --- a/nipype/workflows/rsfmri/fsl/tests/test_resting.py +++ b/nipype/workflows/rsfmri/fsl/tests/test_resting.py @@ -23,7 +23,7 @@ def stub_node_factory(*args, **kwargs): name = kwargs['name'] if name == 'compcor': return Node(*args, **kwargs) - else: # replace with an IdentityInterface + else: # replace with an IdentityInterface return Node(IdentityInterface(fields=ALL_FIELDS), name=name) diff --git a/nipype/workflows/smri/freesurfer/autorecon2.py b/nipype/workflows/smri/freesurfer/autorecon2.py index 0812cd1a5f..fee6145709 100644 --- a/nipype/workflows/smri/freesurfer/autorecon2.py +++ b/nipype/workflows/smri/freesurfer/autorecon2.py @@ -18,7 +18,7 @@ def create_AutoRecon2(name="AutoRecon2", longitudinal=False, ar2_wf = pe.Workflow(name=name) inputspec = pe.Node(IdentityInterface(fields=['orig', - 'nu', # version < 6 + 'nu', # version < 6 'brainmask', 'transform', 'subject_id', diff --git a/nipype/workflows/smri/freesurfer/recon.py b/nipype/workflows/smri/freesurfer/recon.py index eec6856578..909a982d12 100644 --- a/nipype/workflows/smri/freesurfer/recon.py +++ b/nipype/workflows/smri/freesurfer/recon.py @@ -160,7 +160,7 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None): fs_version = 'v6.0' th3 = True shrink = 2 - distance = 200 # 3T should be 50 + distance = 200 # 3T should be 50 stop = 0.0001 exvivo = True entorhinal = True @@ -178,7 +178,7 @@ def create_reconall_workflow(name="ReconAll", plugin_args=None): "set or if you are using an older version of " "FreeSurfer")) else: - fs_version = 5.3 # assume version 5.3 + fs_version = 5.3 # assume version 5.3 th3 = False shrink = None distance = 50 diff --git a/tools/run_examples.py b/tools/run_examples.py index 45f4c8dc4f..6f12d02bcf 100644 --- a/tools/run_examples.py +++ b/tools/run_examples.py @@ -43,7 +43,7 @@ def run_examples(example, pipelines, data_path, plugin=None, rm_base_dir=True): try: wf.inputs.inputnode.in_data = os.path.abspath(data_path) except AttributeError: - pass # the workflow does not have inputnode.in_data + pass # the workflow does not have inputnode.in_data wf.run(plugin=plugin, plugin_args=plugin_args) # run twice to check if nothing is rerunning From ed7db38c99ffa8a798522a38deaabef5562a0a28 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 13:31:01 +0100 Subject: [PATCH 123/365] STY: correction of E111 - indentation is not a multiple of four --- nipype/interfaces/afni/preprocess.py | 2 +- .../interfaces/ants/tests/test_resampling.py | 78 +++++++++---------- nipype/interfaces/dcm2nii.py | 2 +- nipype/interfaces/fsl/model.py | 8 +- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 6c37b614ca..6a7985ae55 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -1927,7 +1927,7 @@ def aggregate_outputs(self, runtime=None, needed_outputs=None): outputs = self._outputs() output_filename = 'roi_stats.csv' with open(output_filename, 'w') as f: - f.write(runtime.stdout) + f.write(runtime.stdout) outputs.stats = os.path.abspath(output_filename) return outputs diff --git a/nipype/interfaces/ants/tests/test_resampling.py b/nipype/interfaces/ants/tests/test_resampling.py index e4d0f5ddb1..cc9feff8bb 100644 --- a/nipype/interfaces/ants/tests/test_resampling.py +++ b/nipype/interfaces/ants/tests/test_resampling.py @@ -8,76 +8,76 @@ @pytest.fixture() def change_dir(request): - orig_dir = os.getcwd() - filepath = os.path.dirname(os.path.realpath(__file__)) - datadir = os.path.realpath(os.path.join(filepath, '../../../testing/data')) - os.chdir(datadir) + orig_dir = os.getcwd() + filepath = os.path.dirname(os.path.realpath(__file__)) + datadir = os.path.realpath(os.path.join(filepath, '../../../testing/data')) + os.chdir(datadir) - def move2orig(): - os.chdir(orig_dir) + def move2orig(): + os.chdir(orig_dir) - request.addfinalizer(move2orig) + request.addfinalizer(move2orig) @pytest.fixture() def create_wimt(): - wimt = WarpImageMultiTransform() - wimt.inputs.input_image = 'diffusion_weighted.nii' - wimt.inputs.reference_image = 'functional.nii' - wimt.inputs.transformation_series = ['func2anat_coreg_Affine.txt','func2anat_InverseWarp.nii.gz', - 'dwi2anat_Warp.nii.gz','dwi2anat_coreg_Affine.txt'] - return wimt + wimt = WarpImageMultiTransform() + wimt.inputs.input_image = 'diffusion_weighted.nii' + wimt.inputs.reference_image = 'functional.nii' + wimt.inputs.transformation_series = ['func2anat_coreg_Affine.txt','func2anat_InverseWarp.nii.gz', + 'dwi2anat_Warp.nii.gz','dwi2anat_coreg_Affine.txt'] + return wimt def test_WarpImageMultiTransform(change_dir, create_wimt): - wimt = create_wimt - assert wimt.cmdline == 'WarpImageMultiTransform 3 diffusion_weighted.nii diffusion_weighted_wimt.nii -R functional.nii \ + wimt = create_wimt + assert wimt.cmdline == 'WarpImageMultiTransform 3 diffusion_weighted.nii diffusion_weighted_wimt.nii -R functional.nii \ func2anat_coreg_Affine.txt func2anat_InverseWarp.nii.gz dwi2anat_Warp.nii.gz dwi2anat_coreg_Affine.txt' def test_WarpImageMultiTransform_invaffine_1(change_dir, create_wimt): - wimt = create_wimt - wimt.inputs.invert_affine = [1] - assert wimt.cmdline == 'WarpImageMultiTransform 3 diffusion_weighted.nii diffusion_weighted_wimt.nii -R functional.nii \ + wimt = create_wimt + wimt.inputs.invert_affine = [1] + assert wimt.cmdline == 'WarpImageMultiTransform 3 diffusion_weighted.nii diffusion_weighted_wimt.nii -R functional.nii \ -i func2anat_coreg_Affine.txt func2anat_InverseWarp.nii.gz dwi2anat_Warp.nii.gz dwi2anat_coreg_Affine.txt' def test_WarpImageMultiTransform_invaffine_2(change_dir, create_wimt): - wimt = create_wimt - wimt.inputs.invert_affine = [2] - assert wimt.cmdline == 'WarpImageMultiTransform 3 diffusion_weighted.nii diffusion_weighted_wimt.nii -R functional.nii func2anat_coreg_Affine.txt func2anat_InverseWarp.nii.gz dwi2anat_Warp.nii.gz -i dwi2anat_coreg_Affine.txt' + wimt = create_wimt + wimt.inputs.invert_affine = [2] + assert wimt.cmdline == 'WarpImageMultiTransform 3 diffusion_weighted.nii diffusion_weighted_wimt.nii -R functional.nii func2anat_coreg_Affine.txt func2anat_InverseWarp.nii.gz dwi2anat_Warp.nii.gz -i dwi2anat_coreg_Affine.txt' def test_WarpImageMultiTransform_invaffine_wrong(change_dir, create_wimt): - wimt = create_wimt - wimt.inputs.invert_affine = [3] - with pytest.raises(Exception): - assert wimt.cmdline + wimt = create_wimt + wimt.inputs.invert_affine = [3] + with pytest.raises(Exception): + assert wimt.cmdline @pytest.fixture() def create_wtsimt(): - wtsimt = WarpTimeSeriesImageMultiTransform() - wtsimt.inputs.input_image = 'resting.nii' - wtsimt.inputs.reference_image = 'ants_deformed.nii.gz' - wtsimt.inputs.transformation_series = ['ants_Warp.nii.gz','ants_Affine.txt'] - return wtsimt + wtsimt = WarpTimeSeriesImageMultiTransform() + wtsimt.inputs.input_image = 'resting.nii' + wtsimt.inputs.reference_image = 'ants_deformed.nii.gz' + wtsimt.inputs.transformation_series = ['ants_Warp.nii.gz','ants_Affine.txt'] + return wtsimt def test_WarpTimeSeriesImageMultiTransform(change_dir, create_wtsimt): - wtsimt = create_wtsimt - assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ + wtsimt = create_wtsimt + assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ -R ants_deformed.nii.gz ants_Warp.nii.gz ants_Affine.txt' def test_WarpTimeSeriesImageMultiTransform_invaffine(change_dir, create_wtsimt): - wtsimt = create_wtsimt - wtsimt.inputs.invert_affine = [1] - assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ + wtsimt = create_wtsimt + wtsimt.inputs.invert_affine = [1] + assert wtsimt.cmdline == 'WarpTimeSeriesImageMultiTransform 4 resting.nii resting_wtsimt.nii \ -R ants_deformed.nii.gz ants_Warp.nii.gz -i ants_Affine.txt' def test_WarpTimeSeriesImageMultiTransform_invaffine_wrong(change_dir, create_wtsimt): - wtsimt = create_wtsimt - wtsimt.inputs.invert_affine = [0] - with pytest.raises(Exception): - wtsimt.cmdline + wtsimt = create_wtsimt + wtsimt.inputs.invert_affine = [0] + with pytest.raises(Exception): + wtsimt.cmdline diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py index 5fb2b6480e..6efc5a161a 100644 --- a/nipype/interfaces/dcm2nii.py +++ b/nipype/interfaces/dcm2nii.py @@ -289,7 +289,7 @@ def _run_interface(self, runtime): (self.output_files, self.bvecs, self.bvals, self.bids) = self._parse_stdout(new_runtime.stdout) else: - (self.output_files, self.bvecs, + (self.output_files, self.bvecs, self.bvals) = self._parse_stdout(new_runtime.stdout) return new_runtime diff --git a/nipype/interfaces/fsl/model.py b/nipype/interfaces/fsl/model.py index 9cbee3fd3d..e78a31ae7f 100644 --- a/nipype/interfaces/fsl/model.py +++ b/nipype/interfaces/fsl/model.py @@ -159,13 +159,13 @@ def _create_ev_files( basis_key = "hrf" elif basis_key == "gamma": try: - _ = ev_parameters['gammasigma'] + _ = ev_parameters['gammasigma'] except KeyError: - ev_parameters['gammasigma'] = 3 + ev_parameters['gammasigma'] = 3 try: - _ = ev_parameters['gammadelay'] + _ = ev_parameters['gammadelay'] except KeyError: - ev_parameters['gammadelay'] = 6 + ev_parameters['gammadelay'] = 6 ev_template = load_template('feat_ev_'+basis_key+'.tcl') ev_none = load_template('feat_ev_none.tcl') ev_ortho = load_template('feat_ev_ortho.tcl') From 777985d77152b79661eb2fcc327b6e35fd533c23 Mon Sep 17 00:00:00 2001 From: miykael Date: Sat, 6 Jan 2018 13:39:30 +0100 Subject: [PATCH 124/365] STY: correction of most E265 - block comment should start with '# ' --- nipype/interfaces/dipy/tensors.py | 2 +- nipype/interfaces/freesurfer/preprocess.py | 4 ++-- nipype/interfaces/tests/test_nilearn.py | 2 +- nipype/pipeline/engine/tests/test_join.py | 4 ++-- nipype/pipeline/engine/tests/test_utils.py | 2 +- nipype/sphinxext/plot_workflow.py | 8 ++++---- nipype/utils/draw_gantt_chart.py | 6 +++--- nipype/workflows/smri/freesurfer/autorecon3.py | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nipype/interfaces/dipy/tensors.py b/nipype/interfaces/dipy/tensors.py index e5518f4ea0..c939523291 100644 --- a/nipype/interfaces/dipy/tensors.py +++ b/nipype/interfaces/dipy/tensors.py @@ -67,7 +67,7 @@ def _run_interface(self, runtime): nb.save(img, out_file) IFLOGGER.info('DTI parameters image saved as %s', out_file) - #FA MD RD and AD + # FA MD RD and AD for metric in ["fa", "md", "rd", "ad"]: data = getattr(ten_fit,metric).astype("float32") out_name = self._gen_filename(metric) diff --git a/nipype/interfaces/freesurfer/preprocess.py b/nipype/interfaces/freesurfer/preprocess.py index 1d209c3022..ff940d26eb 100644 --- a/nipype/interfaces/freesurfer/preprocess.py +++ b/nipype/interfaces/freesurfer/preprocess.py @@ -1964,7 +1964,7 @@ def _list_outputs(self): class CARegisterInputSpec(FSTraitedSpecOpenMP): - #required + # required in_file = File(argstr='%s', exists=True, mandatory=True, position=-3, desc="The input volume for CARegister") out_file = File(argstr='%s', position=-1, @@ -2031,7 +2031,7 @@ def _list_outputs(self): class CALabelInputSpec(FSTraitedSpecOpenMP): - #required + # required in_file = File(argstr="%s", position=-4, mandatory=True, exists=True, desc="Input volume for CALabel") out_file = File(argstr="%s", position=-1, mandatory=True, exists=False, diff --git a/nipype/interfaces/tests/test_nilearn.py b/nipype/interfaces/tests/test_nilearn.py index 7d06c59834..02cbbf0646 100644 --- a/nipype/interfaces/tests/test_nilearn.py +++ b/nipype/interfaces/tests/test_nilearn.py @@ -150,7 +150,7 @@ def assert_expected_output(self, labels, wanted): for j, segment in enumerate(time): npt.assert_almost_equal(segment, wanted[i][j], decimal=1) -#dj: self doesnt have orig_dir at this point, not sure how to change it. should work without it +# dj: self doesnt have orig_dir at this point, not sure how to change it. should work without it # def teardown_class(self): # self.orig_dir.chdir() diff --git a/nipype/pipeline/engine/tests/test_join.py b/nipype/pipeline/engine/tests/test_join.py index 8b8608b248..021833c7ea 100644 --- a/nipype/pipeline/engine/tests/test_join.py +++ b/nipype/pipeline/engine/tests/test_join.py @@ -548,7 +548,7 @@ def test_nested_workflow_join(tmpdir): # Make the nested workflow def nested_wf(i, name='smallwf'): - #iterables with list of nums + # iterables with list of nums inputspec = pe.Node(IdentityInterface(fields=['n']), name='inputspec') inputspec.iterables = [('n', i)] # increment each iterable before joining @@ -559,7 +559,7 @@ def nested_wf(i, name='smallwf'): joinsource='inputspec', joinfield='n', name='join') - #define and connect nested workflow + # define and connect nested workflow wf = pe.Workflow(name='wf_%d' % i[0]) wf.connect(inputspec, 'n', pre_join, 'input1') wf.connect(pre_join, 'output1', join, 'n') diff --git a/nipype/pipeline/engine/tests/test_utils.py b/nipype/pipeline/engine/tests/test_utils.py index 7435bccc85..eb903c6cd2 100644 --- a/nipype/pipeline/engine/tests/test_utils.py +++ b/nipype/pipeline/engine/tests/test_utils.py @@ -375,7 +375,7 @@ def test_mapnode_crash3(tmpdir): wf = pe.Workflow('testmapnodecrash') wf.add_nodes([node]) wf.base_dir = tmpdir.strpath - #changing crashdump dir to cwl (to avoid problems with read-only systems) + # changing crashdump dir to cwl (to avoid problems with read-only systems) wf.config["execution"]["crashdump_dir"] = os.getcwd() with pytest.raises(RuntimeError): wf.run(plugin='Linear') diff --git a/nipype/sphinxext/plot_workflow.py b/nipype/sphinxext/plot_workflow.py index c5250b7ad5..c1498cf122 100644 --- a/nipype/sphinxext/plot_workflow.py +++ b/nipype/sphinxext/plot_workflow.py @@ -273,9 +273,9 @@ def setup(app): return metadata -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Doctest handling -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ def contains_doctest(text): try: @@ -316,9 +316,9 @@ def remove_coding(text): sub_re = re.compile("^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE) return sub_re.sub("", text) -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ # Template -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ TEMPLATE = """ diff --git a/nipype/utils/draw_gantt_chart.py b/nipype/utils/draw_gantt_chart.py index ee62c6250a..0a87c4f793 100644 --- a/nipype/utils/draw_gantt_chart.py +++ b/nipype/utils/draw_gantt_chart.py @@ -423,7 +423,7 @@ def generate_gantt_chart(logfile, cores, minute_scale=10, # generate_gantt_chart('callback.log', 8) ''' - #add the html header + # add the html header html_string = '''
-
Loading
- - - +
{% endblock %} diff --git a/doc/conf.py b/doc/conf.py index 9891454e6c..144c36f0db 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -73,7 +73,7 @@ # General information about the project. project = u'nipype' -copyright = u'2009-17, Neuroimaging in Python team' +copyright = u'2009-18, Neuroimaging in Python team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/doc/searchresults.rst b/doc/searchresults.rst index bef3894672..d79eaebfbc 100644 --- a/doc/searchresults.rst +++ b/doc/searchresults.rst @@ -6,168 +6,17 @@ Search results .. raw:: html -
Loading
- - - +
Loading + + +
From 49af6237542817a9472c312a6abd7252ae0581f6 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sat, 3 Feb 2018 09:25:49 -0500 Subject: [PATCH 296/365] Fix input argstr --- nipype/interfaces/afni/preprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index ee8740619a..6dc04bc5a0 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -2409,7 +2409,7 @@ class TNorm(AFNICommand): class TProjectInputSpec(AFNICommandInputSpec): in_file = File( desc='input file to 3dTproject', - argstr='%s', + argstr='-input %s', position=1, mandatory=True, exists=True, From 75b66bae7453142534d3d814524818ce9e8f2266 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sat, 3 Feb 2018 12:01:46 -0500 Subject: [PATCH 297/365] FIX: fix out_file when censor_motion is passed in OneDToolPy --- nipype/interfaces/afni/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 188ba158c0..3691cb561f 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -1815,7 +1815,7 @@ def _list_outputs(self): os.getcwd(), self.inputs.show_cormat_warnings) if isdefined(self.inputs.censor_motion): outputs['out_file'] = os.path.join(os.getcwd(), - self.inputs.censor_motion[1]) + self.inputs.censor_motion[1] + '_censor.1D') return outputs From fd1037ee1d92bf0db5faffe367bace6daaae9548 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sat, 3 Feb 2018 12:05:55 -0500 Subject: [PATCH 298/365] Add auto test for TProject, pepify out_file for OneDTool --- nipype/interfaces/afni/tests/test_auto_TProject.py | 2 +- nipype/interfaces/afni/utils.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/afni/tests/test_auto_TProject.py b/nipype/interfaces/afni/tests/test_auto_TProject.py index 6736e5e8e3..2fec4896d5 100644 --- a/nipype/interfaces/afni/tests/test_auto_TProject.py +++ b/nipype/interfaces/afni/tests/test_auto_TProject.py @@ -27,7 +27,7 @@ def test_TProject_inputs(): usedefault=True, ), in_file=dict( - argstr='%s', + argstr='-input %s', copyfile=False, mandatory=True, position=1, diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index 3691cb561f..05910c06b3 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -1815,7 +1815,8 @@ def _list_outputs(self): os.getcwd(), self.inputs.show_cormat_warnings) if isdefined(self.inputs.censor_motion): outputs['out_file'] = os.path.join(os.getcwd(), - self.inputs.censor_motion[1] + '_censor.1D') + self.inputs.censor_motion[1] + + '_censor.1D') return outputs From d3a75264f3b3254e7a8cb8c518d428c6f0d360d8 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Sat, 3 Feb 2018 13:56:05 -0500 Subject: [PATCH 299/365] Fix doctest --- nipype/interfaces/afni/preprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 6dc04bc5a0..cb92950e7d 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -2562,7 +2562,7 @@ class TProject(AFNICommand): >>> tproject.inputs.automask = True >>> tproject.inputs.out_file = 'projected.nii.gz' >>> tproject.cmdline - '3dTproject functional.nii -automask -bandpass 0.006670 99999.000000 -polort 3 -prefix projected.nii.gz' + '3dTproject -input functional.nii -automask -bandpass 0.006670 99999.000000 -polort 3 -prefix projected.nii.gz' >>> res = tproject.run() # doctest: +SKIP """ From d4658cf08b7216d2248185c2f4a533105573ea2c Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Mon, 5 Feb 2018 19:01:06 -0500 Subject: [PATCH 300/365] ENH: add -noFDR option to 3dDeconvolve --- nipype/interfaces/afni/model.py | 4 ++++ nipype/interfaces/afni/tests/test_auto_Deconvolve.py | 1 + 2 files changed, 5 insertions(+) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index 903d323b4e..f933b6c53d 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -165,6 +165,10 @@ class DeconvolveInputSpec(AFNICommandInputSpec): vout = traits.Bool( desc='output the sample variance (MSE) for each stimulus', argstr='-vout') + nofdr = traits.Bool( + desc="Don't compute the statistic-vs-FDR curves for the bucket " + "dataset.", + argstr='-noFDR') global_times = traits.Bool( desc='use global timing for stimulus timing files', argstr='-global_times', diff --git a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py index e456f97818..bf5b0cddd7 100644 --- a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py +++ b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py @@ -59,6 +59,7 @@ def test_Deconvolve_inputs(): noblock=dict(argstr='-noblock', ), nocond=dict(argstr='-nocond', ), nodmbase=dict(argstr='-nodmbase', ), + nofdr=dict(argstr='-noFDR', ), nolegendre=dict(argstr='-nolegendre', ), nosvd=dict(argstr='-nosvd', ), num_glt=dict( From d40a627ab43f9feb29e33d708aba4d077d1fad5a Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Tue, 6 Feb 2018 16:57:00 -0500 Subject: [PATCH 301/365] ENH: set correct number of jobs/threads for 3dDeconvolve --- nipype/interfaces/afni/model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index f933b6c53d..c3f6b64737 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -278,6 +278,8 @@ def _parse_inputs(self, skip=None): self.inputs.num_glt = len(self.inputs.gltsym) if not isdefined(self.inputs.out_file): self.inputs.out_file = 'Decon.nii' + if isdefined(self.inputs.jobs): + self.inputs.num_threads = self.inputs.jobs return super(Deconvolve, self)._parse_inputs(skip) From e511566f98d0374c429412e69d9c032d752341e5 Mon Sep 17 00:00:00 2001 From: daniel glen Date: Tue, 6 Feb 2018 19:20:27 -0500 Subject: [PATCH 302/365] fstype parsing for cifs can fail on Mac OS --- nipype/utils/filemanip.py | 69 ++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 97a7538780..774c1eeadc 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -3,13 +3,6 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """Miscellaneous file manipulation functions - .. testsetup:: - # Change directory to provide relative paths for doctests - >>> import os - >>> filepath = os.path.dirname(os.path.realpath( __file__ )) - >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) - >>> os.chdir(datadir) - """ from __future__ import (print_function, division, unicode_literals, absolute_import) @@ -229,38 +222,19 @@ def check_forhash(filename): return False, None -def hash_infile(afile, chunk_len=8192, crypto=hashlib.md5, - raise_notfound=False): - """ - Computes hash of a file using 'crypto' module - - >>> hash_infile('smri_ants_registration_settings.json') - '49b956387ed8d95a4eb44576fc5103b6' - - >>> hash_infile('surf01.vtk') - 'fdf1cf359b4e346034372cdeb58f9a88' - - >>> hash_infile('spminfo') - '0dc55e3888c98a182dab179b976dfffc' - - >>> hash_infile('fsl_motion_outliers_fd.txt') - 'defd1812c22405b1ee4431aac5bbdd73' - - - """ - if not op.isfile(afile): - if raise_notfound: - raise RuntimeError('File "%s" not found.' % afile) - return None - - crypto_obj = crypto() - with open(afile, 'rb') as fp: - while True: - data = fp.read(chunk_len) - if not data: - break - crypto_obj.update(data) - return crypto_obj.hexdigest() +def hash_infile(afile, chunk_len=8192, crypto=hashlib.md5): + """ Computes hash of a file using 'crypto' module""" + hex = None + if op.isfile(afile): + crypto_obj = crypto() + with open(afile, 'rb') as fp: + while True: + data = fp.read(chunk_len) + if not data: + break + crypto_obj.update(data) + hex = crypto_obj.hexdigest() + return hex def hash_timestamp(afile): @@ -295,8 +269,23 @@ def _generate_cifs_table(): (line.split()[2:5:2] for line in output.splitlines()), key=lambda x: len(x[0]), reverse=True) - cifs_paths = [path for path, fstype in mount_info if fstype == 'cifs'] + # find which mount points are CIFS + # init to empty list + cifs_paths = [] + + try: + for path_and_fstype in mount_info: + # need to check for tables that have only path and no fstype + if len(path_and_fstype) == 2: + # if this entry is cifs, add it to list + if path_and_fstype[1] == 'cifs': + cifs_paths.append(path_and_fstype[0]) + else: + fmlogger.debug('mount file system types not described by fstype') + except: + fmlogger.debug('mount file system type check for CIFS error') + return [] return [ mount for mount in mount_info if any(mount[0].startswith(path) for path in cifs_paths) From 547e2de2f614750e0cf069bab72d46e1d4c81e8d Mon Sep 17 00:00:00 2001 From: daniel glen Date: Tue, 6 Feb 2018 19:24:43 -0500 Subject: [PATCH 303/365] fstype parsing for cifs can fail on Mac OS --- nipype/utils/filemanip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 774c1eeadc..1a3270b068 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -281,7 +281,7 @@ def _generate_cifs_table(): # if this entry is cifs, add it to list if path_and_fstype[1] == 'cifs': cifs_paths.append(path_and_fstype[0]) - else: + else: fmlogger.debug('mount file system types not described by fstype') except: fmlogger.debug('mount file system type check for CIFS error') From c8edc2f4275c8ca2f3e3c05b22e59725c3f3433a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81re=CC=81my=20Guillon?= Date: Wed, 7 Feb 2018 16:01:27 +0100 Subject: [PATCH 304/365] Fix issue #2408 --- nipype/interfaces/mrtrix3/preprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index ca5996bea8..02bb039281 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -27,7 +27,7 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec): 'tournier', 'tax', argstr='%s', - position=-6, + position=1, mandatory=True, desc='response estimation algorithm (multi-tissue)') in_file = File( From a0d48fd1623424d66e55114002b7d618305b6e55 Mon Sep 17 00:00:00 2001 From: daniel glen Date: Wed, 7 Feb 2018 12:44:13 -0500 Subject: [PATCH 305/365] more proper integration --- nipype/utils/filemanip.py | 52 +++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 1a3270b068..83f2a9ead2 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -3,6 +3,13 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """Miscellaneous file manipulation functions + .. testsetup:: + # Change directory to provide relative paths for doctests + >>> import os + >>> filepath = os.path.dirname(os.path.realpath( __file__ )) + >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) + >>> os.chdir(datadir) + """ from __future__ import (print_function, division, unicode_literals, absolute_import) @@ -222,19 +229,38 @@ def check_forhash(filename): return False, None -def hash_infile(afile, chunk_len=8192, crypto=hashlib.md5): - """ Computes hash of a file using 'crypto' module""" - hex = None - if op.isfile(afile): - crypto_obj = crypto() - with open(afile, 'rb') as fp: - while True: - data = fp.read(chunk_len) - if not data: - break - crypto_obj.update(data) - hex = crypto_obj.hexdigest() - return hex +def hash_infile(afile, chunk_len=8192, crypto=hashlib.md5, + raise_notfound=False): + """ + Computes hash of a file using 'crypto' module + + >>> hash_infile('smri_ants_registration_settings.json') + '49b956387ed8d95a4eb44576fc5103b6' + + >>> hash_infile('surf01.vtk') + 'fdf1cf359b4e346034372cdeb58f9a88' + + >>> hash_infile('spminfo') + '0dc55e3888c98a182dab179b976dfffc' + + >>> hash_infile('fsl_motion_outliers_fd.txt') + 'defd1812c22405b1ee4431aac5bbdd73' + + + """ + if not op.isfile(afile): + if raise_notfound: + raise RuntimeError('File "%s" not found.' % afile) + return None + + crypto_obj = crypto() + with open(afile, 'rb') as fp: + while True: + data = fp.read(chunk_len) + if not data: + break + crypto_obj.update(data) + return crypto_obj.hexdigest() def hash_timestamp(afile): From 9e763badde423611621c670dbd2954b0f9a7ecbf Mon Sep 17 00:00:00 2001 From: daniel glen Date: Wed, 7 Feb 2018 13:44:32 -0500 Subject: [PATCH 306/365] tab/space fix --- nipype/utils/filemanip.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 83f2a9ead2..6773d19d8b 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -301,17 +301,17 @@ def _generate_cifs_table(): cifs_paths = [] try: - for path_and_fstype in mount_info: - # need to check for tables that have only path and no fstype - if len(path_and_fstype) == 2: - # if this entry is cifs, add it to list - if path_and_fstype[1] == 'cifs': - cifs_paths.append(path_and_fstype[0]) - else: - fmlogger.debug('mount file system types not described by fstype') + for path_and_fstype in mount_info: + # need to check for tables that have only path and no fstype + if len(path_and_fstype) == 2: + # if this entry is cifs, add it to list + if path_and_fstype[1] == 'cifs': + cifs_paths.append(path_and_fstype[0]) + else: + fmlogger.debug('mount file system types not described by fstype') except: - fmlogger.debug('mount file system type check for CIFS error') - return [] + fmlogger.debug('mount file system type check for CIFS error') + return [] return [ mount for mount in mount_info if any(mount[0].startswith(path) for path in cifs_paths) From 9d96f4e7917e11c5d25ed745d2cce8211e487633 Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Wed, 7 Feb 2018 14:03:57 -0500 Subject: [PATCH 307/365] REF: jobs -> num_threads in 3dDeconvolve for consistency --- nipype/interfaces/afni/model.py | 4 +--- nipype/interfaces/afni/tests/test_auto_Deconvolve.py | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index c3f6b64737..6fbe749b9a 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -153,7 +153,7 @@ class DeconvolveInputSpec(AFNICommandInputSpec): 'instead of the bucket dataset, if possible.', argstr='-cbucket %s') out_file = File(desc='output statistics file', argstr='-bucket %s') - jobs = traits.Int( + num_threads = traits.Int( desc='run the program with provided number of sub-processes', argstr='-jobs %d') fout = traits.Bool( @@ -278,8 +278,6 @@ def _parse_inputs(self, skip=None): self.inputs.num_glt = len(self.inputs.gltsym) if not isdefined(self.inputs.out_file): self.inputs.out_file = 'Decon.nii' - if isdefined(self.inputs.jobs): - self.inputs.num_threads = self.inputs.jobs return super(Deconvolve, self)._parse_inputs(skip) diff --git a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py index bf5b0cddd7..b2455f76f3 100644 --- a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py +++ b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py @@ -49,7 +49,6 @@ def test_Deconvolve_inputs(): sep=' ', ), input1D=dict(argstr='-input1D %s', ), - jobs=dict(argstr='-jobs %d', ), legendre=dict(argstr='-legendre', ), local_times=dict( argstr='-local_times', @@ -70,10 +69,7 @@ def test_Deconvolve_inputs(): argstr='-num_stimts %d', position=-6, ), - num_threads=dict( - nohash=True, - usedefault=True, - ), + num_threads=dict(argstr='-jobs %d', ), ortvec=dict(argstr='-ortvec %s %s', ), out_file=dict(argstr='-bucket %s', ), outputtype=dict(), From b7ea93310cd4f2f8f8a7fdf4d13aadf452f72f3a Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Wed, 7 Feb 2018 14:15:43 -0500 Subject: [PATCH 308/365] Fixes to 3dTProject args --- nipype/interfaces/afni/preprocess.py | 15 ++++++++------- .../interfaces/afni/tests/test_auto_TProject.py | 13 +++++-------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index cb92950e7d..560daa231c 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -2425,7 +2425,8 @@ class TProjectInputSpec(AFNICommandInputSpec): * This is a file of 1s and 0s, indicating which time points are to be included (1) and which are to be excluded (0).""", - argstr="-censor %s") + argstr="-censor %s", + exists=True) censortr = traits.List( traits.Str(), desc="""list of strings that specify time indexes @@ -2489,7 +2490,7 @@ class TProjectInputSpec(AFNICommandInputSpec): ort = File( desc="""Remove each column in file ++ Each column will have its mean removed.""", - exist=True, + exists=True, argstr="-ort %s") polort = traits.Int( desc="""Remove polynomials up to and including degree pp. @@ -2505,15 +2506,15 @@ class TProjectInputSpec(AFNICommandInputSpec): bandpass = traits.Tuple( traits.Float, traits.Float, desc="""Remove all frequencies EXCEPT those in the range""", - argstr='-bandpass %f %f') + argstr='-bandpass %g %g') stopband = traits.Tuple( traits.Float, traits.Float, desc="""Remove all frequencies in the range""", - argstr='-stopband %f %f') + argstr='-stopband %g %g') TR = traits.Float( desc="""Use time step dd for the frequency calculations, rather than the value stored in the dataset header.""", - argstr='-TR %f') + argstr='-TR %g') mask = File( exist=True, desc="""Only operate on voxels nonzero in the mset dataset. @@ -2530,7 +2531,7 @@ class TProjectInputSpec(AFNICommandInputSpec): width (FWHM) of fff millimeters. ++ Spatial blurring (if done) is after the time series filtering.""", - argstr='-blur %f') + argstr='-blur %g') norm = traits.Bool( desc="""Normalize each output time series to have sum of squares = 1. This is the LAST operation.""", @@ -2562,7 +2563,7 @@ class TProject(AFNICommand): >>> tproject.inputs.automask = True >>> tproject.inputs.out_file = 'projected.nii.gz' >>> tproject.cmdline - '3dTproject -input functional.nii -automask -bandpass 0.006670 99999.000000 -polort 3 -prefix projected.nii.gz' + '3dTproject -input functional.nii -automask -bandpass 0.00667 99999 -polort 3 -prefix projected.nii.gz' >>> res = tproject.run() # doctest: +SKIP """ diff --git a/nipype/interfaces/afni/tests/test_auto_TProject.py b/nipype/interfaces/afni/tests/test_auto_TProject.py index 2fec4896d5..25a47142b9 100644 --- a/nipype/interfaces/afni/tests/test_auto_TProject.py +++ b/nipype/interfaces/afni/tests/test_auto_TProject.py @@ -5,14 +5,14 @@ def test_TProject_inputs(): input_map = dict( - TR=dict(argstr='-TR %f', ), + TR=dict(argstr='-TR %g', ), args=dict(argstr='%s', ), automask=dict( argstr='-automask', xor=['mask'], ), - bandpass=dict(argstr='-bandpass %f %f', ), - blur=dict(argstr='-blur %f', ), + bandpass=dict(argstr='-bandpass %g %g', ), + blur=dict(argstr='-blur %g', ), cenmode=dict(argstr='-cenmode %s', ), censor=dict(argstr='-censor %s', ), censortr=dict(argstr='-CENSORTR %s', ), @@ -42,10 +42,7 @@ def test_TProject_inputs(): nohash=True, usedefault=True, ), - ort=dict( - argstr='-ort %s', - exist=True, - ), + ort=dict(argstr='-ort %s', ), out_file=dict( argstr='-prefix %s', name_source='in_file', @@ -54,7 +51,7 @@ def test_TProject_inputs(): ), outputtype=dict(), polort=dict(argstr='-polort %d', ), - stopband=dict(argstr='-stopband %f %f', ), + stopband=dict(argstr='-stopband %g %g', ), terminal_output=dict( deprecated='1.0.0', nohash=True, From ae7dc34ebb065a369be9fba2aeaed28d92c4c22c Mon Sep 17 00:00:00 2001 From: Matteo Visconti dOC Date: Wed, 7 Feb 2018 15:07:12 -0500 Subject: [PATCH 309/365] Set nohash for num_threads in 3dDeconvolve --- nipype/interfaces/afni/model.py | 3 ++- nipype/interfaces/afni/tests/test_auto_Deconvolve.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/afni/model.py b/nipype/interfaces/afni/model.py index 6fbe749b9a..38ddf09520 100644 --- a/nipype/interfaces/afni/model.py +++ b/nipype/interfaces/afni/model.py @@ -155,7 +155,8 @@ class DeconvolveInputSpec(AFNICommandInputSpec): out_file = File(desc='output statistics file', argstr='-bucket %s') num_threads = traits.Int( desc='run the program with provided number of sub-processes', - argstr='-jobs %d') + argstr='-jobs %d', + nohash=True) fout = traits.Bool( desc='output F-statistic for each stimulus', argstr='-fout') rout = traits.Bool( diff --git a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py index b2455f76f3..86f1fee093 100644 --- a/nipype/interfaces/afni/tests/test_auto_Deconvolve.py +++ b/nipype/interfaces/afni/tests/test_auto_Deconvolve.py @@ -69,7 +69,10 @@ def test_Deconvolve_inputs(): argstr='-num_stimts %d', position=-6, ), - num_threads=dict(argstr='-jobs %d', ), + num_threads=dict( + argstr='-jobs %d', + nohash=True, + ), ortvec=dict(argstr='-ortvec %s %s', ), out_file=dict(argstr='-bucket %s', ), outputtype=dict(), From 4f49bf43592357cf9536d04c992e1079eae5e973 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Wed, 7 Feb 2018 17:48:51 -0500 Subject: [PATCH 310/365] enh: add c3d and c4d interface --- nipype/interfaces/c3.py | 132 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 131 insertions(+), 1 deletion(-) diff --git a/nipype/interfaces/c3.py b/nipype/interfaces/c3.py index 3a3284b32e..32e04e9a4b 100644 --- a/nipype/interfaces/c3.py +++ b/nipype/interfaces/c3.py @@ -10,9 +10,16 @@ """ from __future__ import (print_function, division, unicode_literals, absolute_import) +import os +from glob import glob from .base import (CommandLineInputSpec, traits, TraitedSpec, File, - SEMLikeCommandLine) + SEMLikeCommandLine, InputMultiPath, OutputMultiPath, + CommandLine, isdefined) +from ..utils.filemanip import split_filename +from .. import logging + +iflogger = logging.getLogger("interface") class C3dAffineToolInputSpec(CommandLineInputSpec): @@ -52,3 +59,126 @@ class C3dAffineTool(SEMLikeCommandLine): _cmd = 'c3d_affine_tool' _outputs_filenames = {'itk_transform': 'affine.txt'} + + +class C3dInputSpec(CommandLineInputSpec): + in_file = InputMultiPath(File(), + position=1, + argstr="%s", + mandatory=True, + desc="Input file (wildcard and multiple are supported)") + out_file = File(exists=False, + argstr="-o %s", + position=-1, + xor=["out_files"], + desc="Output file of last image on the stack") + out_files = InputMultiPath(File(), + argstr="-oo %s", + xor=["out_file"], + position=-1, + desc=("Write all images on the convert3d stack as multiple files." + " Supports both list of output files or a pattern for the output" + " filenames (using %d substituion).")) + pix_type = traits.Enum("float", "char", "uchar", "short", "ushort", "int", "uint", "double", + argstr="-type %s", + desc=("Specifies the pixel type for the output image. By default, images are written in" + " floating point (float) format")) + scale = traits.Either(traits.Int(), traits.Float(), + argstr="-scale %s", + desc="Multiplies the intensity of each voxel in the last image on the stack by the given factor.") + shift = traits.Either(traits.Int(), traits.Float(), + argstr="-shift %s", + desc='Adds the given constant to every voxel.') + interp = traits.Enum("Linear", "NearestNeighbor", "Cubic", "Sinc", "Gaussian", + argstr="-interpolation %s", + desc="Specifies the interpolation used with -resample and other commands. Default is Linear.") + resample = traits.Str(argstr="-resample %s", + desc=("Resamples the image, keeping the bounding box the same, but changing the number of" + " voxels in the image. The dimensions can be specified as a percentage, for example to" + " double the number of voxels in each direction. The -interpolation flag affects how" + " sampling is performed.")) + smooth = traits.Str(argstr="-smooth %s", + desc=("Applies Gaussian smoothing to the image. The parameter vector specifies the" + " standard deviation of the Gaussian kernel.")) + multicomp_split = traits.Bool(False, + usedefault=True, + argstr="-mcr", + position=0, + desc="Enable reading of multi-component images.") + is_4d = traits.Bool(False, + usedefault=True, + desc="Changes command to support 4D file operations (default is false).") + +class C3dOutputSpec(TraitedSpec): + out_files = OutputMultiPath(File(exists=False)) + +class C3d(CommandLine): + """ + Convert3d is a command-line tool for converting 3D (or 4D) images between common + file formats. The tool also includes a growing list of commands for image manipulation, + such as thresholding and resampling. The tool can also be used to obtain information about + image files. More information on Convert3d can be found at: + https://sourceforge.net/p/c3d/git/ci/master/tree/doc/c3d.md + + + Example + ======= + + >>> from nipype.interfaces.c3 import C3d + >>> c3 = C3d() + >>> c3.inputs.in_file = "T1.nii" + >>> c3.inputs.pix_type = "short" + >>> c3.inputs.out_file = "T1.img" + >>> c3.cmdline + 'c3d T1.nii -type short -o T1.img' + >>> c3.inputs.is_4d = True + >>> c3.inputs.in_file = "epi.nii" + >>> c3.inputs.out_file = "epi.img" + >>> c3.cmdline + 'c4d epi.nii -type short -o epi.img' + """ + input_spec = C3dInputSpec + output_spec = C3dOutputSpec + + _cmd = "c3d" + + def __init__(self, **inputs): + super(C3d, self).__init__(**inputs) + self.inputs.on_trait_change(self._is_4d, "is_4d") + if self.inputs.is_4d: + self._is_4d() + + def _is_4d(self): + self._cmd = "c4d" if self.inputs.is_4d else "c3d" + + def _run_interface(self, runtime): + cmd = self._cmd + # by default, does not want to override file, so we define a new output file + if not isdefined(self.inputs.out_file) and not isdefined(self.inputs.out_files): + self._gen_outfile() + runtime = super(C3d, self)._run_interface(runtime) + self._cmd = cmd + return runtime + + def _gen_outfile(self): + # if many infiles, raise exception + if (len(self.inputs.in_file) > 1) or ("*" in self.inputs.in_file[0]): + raise AttributeError("Multiple in_files found - specify either out_file or out_files") + _, fn, ext = split_filename(self.inputs.in_file[0]) + self.inputs.out_file = fn + "_generated" + ext + assert not os.path.exists(os.path.abspath(self.inputs.out_file)) + iflogger.info("Generating out_file to avoid overwriting") + + def _list_outputs(self): + outputs = self.output_spec().get() + if isdefined(self.inputs.out_file): + outputs["out_files"] = os.path.abspath(self.inputs.out_file) + if isdefined(self.inputs.out_files): + if not len(self.inputs.out_files) > 1: + _out_files = glob(os.path.abspath(self.inputs.out_files[0])) + else: + _out_files = [os.path.abspath(fl) for fl in self.inputs.out_files + if os.path.exists(os.path.abspath(fl))] + outputs["out_files"] = _out_files + + return outputs From 234c55591799ca0c44254335e7660838480a69cd Mon Sep 17 00:00:00 2001 From: mathiasg Date: Wed, 7 Feb 2018 18:00:55 -0500 Subject: [PATCH 311/365] enh+sty: autotest and styling --- nipype/interfaces/c3.py | 82 ++++++++++++------------ nipype/interfaces/tests/test_auto_C3d.py | 61 ++++++++++++++++++ 2 files changed, 102 insertions(+), 41 deletions(-) create mode 100644 nipype/interfaces/tests/test_auto_C3d.py diff --git a/nipype/interfaces/c3.py b/nipype/interfaces/c3.py index 32e04e9a4b..e77b9ceec2 100644 --- a/nipype/interfaces/c3.py +++ b/nipype/interfaces/c3.py @@ -63,63 +63,63 @@ class C3dAffineTool(SEMLikeCommandLine): class C3dInputSpec(CommandLineInputSpec): in_file = InputMultiPath(File(), - position=1, - argstr="%s", - mandatory=True, - desc="Input file (wildcard and multiple are supported)") + position=1, + argstr="%s", + mandatory=True, + desc="Input file (wildcard and multiple are supported)") out_file = File(exists=False, - argstr="-o %s", - position=-1, - xor=["out_files"], - desc="Output file of last image on the stack") + argstr="-o %s", + position=-1, + xor=["out_files"], + desc="Output file of last image on the stack") out_files = InputMultiPath(File(), - argstr="-oo %s", - xor=["out_file"], - position=-1, - desc=("Write all images on the convert3d stack as multiple files." - " Supports both list of output files or a pattern for the output" - " filenames (using %d substituion).")) + argstr="-oo %s", + xor=["out_file"], + position=-1, + desc=("Write all images on the convert3d stack as multiple files." + " Supports both list of output files or a pattern for the output" + " filenames (using %d substituion).")) pix_type = traits.Enum("float", "char", "uchar", "short", "ushort", "int", "uint", "double", - argstr="-type %s", - desc=("Specifies the pixel type for the output image. By default, images are written in" - " floating point (float) format")) + argstr="-type %s", + desc=("Specifies the pixel type for the output image. By default, images are written in" + " floating point (float) format")) scale = traits.Either(traits.Int(), traits.Float(), - argstr="-scale %s", - desc="Multiplies the intensity of each voxel in the last image on the stack by the given factor.") + argstr="-scale %s", + desc="Multiplies the intensity of each voxel in the last image on the stack by the given factor.") shift = traits.Either(traits.Int(), traits.Float(), - argstr="-shift %s", - desc='Adds the given constant to every voxel.') + argstr="-shift %s", + desc='Adds the given constant to every voxel.') interp = traits.Enum("Linear", "NearestNeighbor", "Cubic", "Sinc", "Gaussian", - argstr="-interpolation %s", - desc="Specifies the interpolation used with -resample and other commands. Default is Linear.") + argstr="-interpolation %s", + desc="Specifies the interpolation used with -resample and other commands. Default is Linear.") resample = traits.Str(argstr="-resample %s", - desc=("Resamples the image, keeping the bounding box the same, but changing the number of" - " voxels in the image. The dimensions can be specified as a percentage, for example to" - " double the number of voxels in each direction. The -interpolation flag affects how" - " sampling is performed.")) + desc=("Resamples the image, keeping the bounding box the same, but changing the number of" + " voxels in the image. The dimensions can be specified as a percentage, for example to" + " double the number of voxels in each direction. The -interpolation flag affects how" + " sampling is performed.")) smooth = traits.Str(argstr="-smooth %s", - desc=("Applies Gaussian smoothing to the image. The parameter vector specifies the" - " standard deviation of the Gaussian kernel.")) + desc=("Applies Gaussian smoothing to the image. The parameter vector specifies the" + " standard deviation of the Gaussian kernel.")) multicomp_split = traits.Bool(False, - usedefault=True, - argstr="-mcr", - position=0, - desc="Enable reading of multi-component images.") - is_4d = traits.Bool(False, - usedefault=True, - desc="Changes command to support 4D file operations (default is false).") + usedefault=True, + argstr="-mcr", + position=0, + desc="Enable reading of multi-component images.") + is_4d = traits.Bool(False, + usedefault=True, + desc="Changes command to support 4D file operations (default is false).") class C3dOutputSpec(TraitedSpec): out_files = OutputMultiPath(File(exists=False)) class C3d(CommandLine): """ - Convert3d is a command-line tool for converting 3D (or 4D) images between common - file formats. The tool also includes a growing list of commands for image manipulation, - such as thresholding and resampling. The tool can also be used to obtain information about + Convert3d is a command-line tool for converting 3D (or 4D) images between common + file formats. The tool also includes a growing list of commands for image manipulation, + such as thresholding and resampling. The tool can also be used to obtain information about image files. More information on Convert3d can be found at: https://sourceforge.net/p/c3d/git/ci/master/tree/doc/c3d.md - + Example ======= @@ -174,7 +174,7 @@ def _list_outputs(self): if isdefined(self.inputs.out_file): outputs["out_files"] = os.path.abspath(self.inputs.out_file) if isdefined(self.inputs.out_files): - if not len(self.inputs.out_files) > 1: + if len(self.inputs.out_files) == 1: _out_files = glob(os.path.abspath(self.inputs.out_files[0])) else: _out_files = [os.path.abspath(fl) for fl in self.inputs.out_files diff --git a/nipype/interfaces/tests/test_auto_C3d.py b/nipype/interfaces/tests/test_auto_C3d.py new file mode 100644 index 0000000000..18300e2aff --- /dev/null +++ b/nipype/interfaces/tests/test_auto_C3d.py @@ -0,0 +1,61 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from __future__ import unicode_literals +from ..c3 import C3d + + +def test_C3d_inputs(): + input_map = dict( + args=dict(argstr='%s', ), + environ=dict( + nohash=True, + usedefault=True, + ), + ignore_exception=dict( + deprecated='1.0.0', + nohash=True, + usedefault=True, + ), + in_file=dict( + argstr='%s', + mandatory=True, + position=1, + ), + interp=dict(argstr='-interpolation %s', ), + is_4d=dict(usedefault=True, ), + multicomp_split=dict( + argstr='-mcr', + position=0, + usedefault=True, + ), + out_file=dict( + argstr='-o %s', + position=-1, + xor=['out_files'], + ), + out_files=dict( + argstr='-oo %s', + position=-1, + xor=['out_file'], + ), + pix_type=dict(argstr='-type %s', ), + resample=dict(argstr='-resample %s', ), + scale=dict(argstr='-scale %s', ), + shift=dict(argstr='-shift %s', ), + smooth=dict(argstr='-smooth %s', ), + terminal_output=dict( + deprecated='1.0.0', + nohash=True, + ), + ) + inputs = C3d.input_spec() + + for key, metadata in list(input_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(inputs.traits()[key], metakey) == value +def test_C3d_outputs(): + output_map = dict(out_files=dict(), ) + outputs = C3d.output_spec() + + for key, metadata in list(output_map.items()): + for metakey, value in list(metadata.items()): + assert getattr(outputs.traits()[key], metakey) == value From 9612144ec2d0eafd8483cb68db1ef4f26ad2594a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81re=CC=81my=20Guillon?= Date: Thu, 8 Feb 2018 12:38:03 +0100 Subject: [PATCH 312/365] Change auto test accordingly --- nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py index 29a89f097a..01104d2d20 100644 --- a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py +++ b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py @@ -8,7 +8,7 @@ def test_ResponseSD_inputs(): algorithm=dict( argstr='%s', mandatory=True, - position=-6, + position=1, ), args=dict(argstr='%s', ), bval_scale=dict(argstr='-bvalue_scaling %s', ), From e6dad8f0658291534ae6769d85a01f0ef0dab3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Je=CC=81re=CC=81my=20Guillon?= Date: Thu, 8 Feb 2018 12:39:08 +0100 Subject: [PATCH 313/365] Fix expected CL in doctest --- nipype/interfaces/mrtrix3/preprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py index 02bb039281..740513194d 100644 --- a/nipype/interfaces/mrtrix3/preprocess.py +++ b/nipype/interfaces/mrtrix3/preprocess.py @@ -74,7 +74,7 @@ class ResponseSD(MRTrix3Base): >>> resp.inputs.algorithm = 'tournier' >>> resp.inputs.grad_fsl = ('bvecs', 'bvals') >>> resp.cmdline # doctest: +ELLIPSIS - 'dwi2response -fslgrad bvecs bvals tournier dwi.mif wm.txt' + 'dwi2response tournier -fslgrad bvecs bvals dwi.mif wm.txt' >>> resp.run() # doctest: +SKIP """ From 392cc12323896e4e3f8858c3ffb2169d3575d6e1 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 8 Feb 2018 10:41:19 -0500 Subject: [PATCH 314/365] sty: pep8 and better error messages --- nipype/interfaces/c3.py | 94 ++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 35 deletions(-) diff --git a/nipype/interfaces/c3.py b/nipype/interfaces/c3.py index e77b9ceec2..1704d94446 100644 --- a/nipype/interfaces/c3.py +++ b/nipype/interfaces/c3.py @@ -62,62 +62,80 @@ class C3dAffineTool(SEMLikeCommandLine): class C3dInputSpec(CommandLineInputSpec): - in_file = InputMultiPath(File(), + in_file = InputMultiPath( + File(), position=1, argstr="%s", mandatory=True, - desc="Input file (wildcard and multiple are supported)") - out_file = File(exists=False, + desc="Input file (wildcard and multiple are supported).") + out_file = File( + exists=False, argstr="-o %s", position=-1, xor=["out_files"], - desc="Output file of last image on the stack") - out_files = InputMultiPath(File(), + desc="Output file of last image on the stack.") + out_files = InputMultiPath( + File(), argstr="-oo %s", xor=["out_file"], position=-1, desc=("Write all images on the convert3d stack as multiple files." " Supports both list of output files or a pattern for the output" " filenames (using %d substituion).")) - pix_type = traits.Enum("float", "char", "uchar", "short", "ushort", "int", "uint", "double", + pix_type = traits.Enum( + "float", "char", "uchar", "short", "ushort", "int", "uint", "double", argstr="-type %s", - desc=("Specifies the pixel type for the output image. By default, images are written in" - " floating point (float) format")) - scale = traits.Either(traits.Int(), traits.Float(), + desc=("Specifies the pixel type for the output image. By default," + " images are written in floating point (float) format")) + scale = traits.Either( + traits.Int(), traits.Float(), argstr="-scale %s", - desc="Multiplies the intensity of each voxel in the last image on the stack by the given factor.") - shift = traits.Either(traits.Int(), traits.Float(), + desc=("Multiplies the intensity of each voxel in the last image on the" + " stack by the given factor.") + shift = traits.Either( + traits.Int(), traits.Float(), argstr="-shift %s", desc='Adds the given constant to every voxel.') - interp = traits.Enum("Linear", "NearestNeighbor", "Cubic", "Sinc", "Gaussian", + interp = traits.Enum( + "Linear", "NearestNeighbor", "Cubic", "Sinc", "Gaussian", argstr="-interpolation %s", - desc="Specifies the interpolation used with -resample and other commands. Default is Linear.") - resample = traits.Str(argstr="-resample %s", - desc=("Resamples the image, keeping the bounding box the same, but changing the number of" - " voxels in the image. The dimensions can be specified as a percentage, for example to" - " double the number of voxels in each direction. The -interpolation flag affects how" - " sampling is performed.")) - smooth = traits.Str(argstr="-smooth %s", - desc=("Applies Gaussian smoothing to the image. The parameter vector specifies the" - " standard deviation of the Gaussian kernel.")) - multicomp_split = traits.Bool(False, + desc=("Specifies the interpolation used with -resample and other" + " commands. Default is Linear.") + resample = traits.Str( + argstr="-resample %s", + desc=("Resamples the image, keeping the bounding box the same, but" + " changing the number of voxels in the image. The dimensions can be" + " specified as a percentage, for example to double the number of voxels" + " in each direction. The -interpolation flag affects how sampling is" + " performed.")) + smooth = traits.Str( + argstr="-smooth %s", + desc=("Applies Gaussian smoothing to the image. The parameter vector" + " specifies the standard deviation of the Gaussian kernel.")) + multicomp_split = traits.Bool( + False, usedefault=True, argstr="-mcr", position=0, desc="Enable reading of multi-component images.") - is_4d = traits.Bool(False, + is_4d = traits.Bool( + False, usedefault=True, - desc="Changes command to support 4D file operations (default is false).") + desc=("Changes command to support 4D file operations (default is" + " false).") + class C3dOutputSpec(TraitedSpec): out_files = OutputMultiPath(File(exists=False)) + class C3d(CommandLine): """ - Convert3d is a command-line tool for converting 3D (or 4D) images between common - file formats. The tool also includes a growing list of commands for image manipulation, - such as thresholding and resampling. The tool can also be used to obtain information about - image files. More information on Convert3d can be found at: + Convert3d is a command-line tool for converting 3D (or 4D) images between + common file formats. The tool also includes a growing list of commands for + image manipulation, such as thresholding and resampling. The tool can also + be used to obtain information about image files. More information on + Convert3d can be found at: https://sourceforge.net/p/c3d/git/ci/master/tree/doc/c3d.md @@ -153,8 +171,10 @@ def _is_4d(self): def _run_interface(self, runtime): cmd = self._cmd - # by default, does not want to override file, so we define a new output file - if not isdefined(self.inputs.out_file) and not isdefined(self.inputs.out_files): + if (not isdefined(self.inputs.out_file) + and not isdefined(self.inputs.out_files)): + # Convert3d does not want to override file, by default + # so we define a new output file self._gen_outfile() runtime = super(C3d, self)._run_interface(runtime) self._cmd = cmd @@ -163,11 +183,14 @@ def _run_interface(self, runtime): def _gen_outfile(self): # if many infiles, raise exception if (len(self.inputs.in_file) > 1) or ("*" in self.inputs.in_file[0]): - raise AttributeError("Multiple in_files found - specify either out_file or out_files") + raise AttributeError("Multiple in_files found - specify either" + " `out_file` or `out_files`.") _, fn, ext = split_filename(self.inputs.in_file[0]) self.inputs.out_file = fn + "_generated" + ext - assert not os.path.exists(os.path.abspath(self.inputs.out_file)) - iflogger.info("Generating out_file to avoid overwriting") + # if generated file will overwrite, raise error + if os.path.exists(os.path.abspath(self.inputs.out_file)): + raise IOError("File already found - to overwrite, use `out_file`.") + iflogger.info("Generating `out_file`.") def _list_outputs(self): outputs = self.output_spec().get() @@ -177,8 +200,9 @@ def _list_outputs(self): if len(self.inputs.out_files) == 1: _out_files = glob(os.path.abspath(self.inputs.out_files[0])) else: - _out_files = [os.path.abspath(fl) for fl in self.inputs.out_files - if os.path.exists(os.path.abspath(fl))] + _out_files = [os.path.abspath(f) for f in self.inputs.out_files + if os.path.exists(os.path.abspath(f))] outputs["out_files"] = _out_files return outputs + From ab9f3eae67601b22dd9676495c95ab9e71f299be Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 8 Feb 2018 11:19:56 -0500 Subject: [PATCH 315/365] fix: syntax --- nipype/interfaces/c3.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/c3.py b/nipype/interfaces/c3.py index 1704d94446..f4778e7d93 100644 --- a/nipype/interfaces/c3.py +++ b/nipype/interfaces/c3.py @@ -91,7 +91,7 @@ class C3dInputSpec(CommandLineInputSpec): traits.Int(), traits.Float(), argstr="-scale %s", desc=("Multiplies the intensity of each voxel in the last image on the" - " stack by the given factor.") + " stack by the given factor.")) shift = traits.Either( traits.Int(), traits.Float(), argstr="-shift %s", @@ -100,7 +100,7 @@ class C3dInputSpec(CommandLineInputSpec): "Linear", "NearestNeighbor", "Cubic", "Sinc", "Gaussian", argstr="-interpolation %s", desc=("Specifies the interpolation used with -resample and other" - " commands. Default is Linear.") + " commands. Default is Linear.")) resample = traits.Str( argstr="-resample %s", desc=("Resamples the image, keeping the bounding box the same, but" @@ -122,7 +122,7 @@ class C3dInputSpec(CommandLineInputSpec): False, usedefault=True, desc=("Changes command to support 4D file operations (default is" - " false).") + " false).")) class C3dOutputSpec(TraitedSpec): From 4c81184fd308dead0aa7572e905045ae44960ac3 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 8 Feb 2018 11:40:53 -0500 Subject: [PATCH 316/365] fix: set _id property of cloned node too --- nipype/pipeline/engine/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nipype/pipeline/engine/base.py b/nipype/pipeline/engine/base.py index 51449632ba..0883023f63 100644 --- a/nipype/pipeline/engine/base.py +++ b/nipype/pipeline/engine/base.py @@ -84,9 +84,12 @@ def clone(self, name): A clone of node or workflow must have a new name """ if name == self.name: - raise ValueError('Cloning requires a new name, "%s" is in use.' % name) + raise ValueError('Cloning requires a new name, "%s" is ' + 'in use.' % name) clone = deepcopy(self) clone.name = name + if hasattr(clone, '_id'): + clone._id = name return clone def _check_outputs(self, parameter): From 1f990d992d94e7870c24daf9edff4c256c53a875 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 8 Feb 2018 11:57:51 -0500 Subject: [PATCH 317/365] enh: add test from #2431 --- nipype/pipeline/engine/tests/test_base.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/nipype/pipeline/engine/tests/test_base.py b/nipype/pipeline/engine/tests/test_base.py index 54356fd6c5..abe0d9d80c 100644 --- a/nipype/pipeline/engine/tests/test_base.py +++ b/nipype/pipeline/engine/tests/test_base.py @@ -6,6 +6,8 @@ import pytest from ..base import EngineBase from ....interfaces import base as nib +from ....interfaces import utility as niu +from ... import engine as pe class InputSpec(nib.TraitedSpec): @@ -64,3 +66,24 @@ def test_clone(): with pytest.raises(ValueError): base.clone('nodename') + +def test_clone_node_iterables(tmpdir): + tmpdir.chdir() + + def addstr(string): + return ('%s+2' % string ) + + subject_list = ['sub-001', 'sub-002'] + inputnode = pe.Node(niu.IdentityInterface(fields = ['subject']), + name = 'inputnode') + inputnode.iterables = [('subject', subject_list)] + + node_1 = pe.Node(niu.Function(input_names='string', + output_names= 'string', + function = addstr),name='node_1') + node_2 = node_1.clone('node_2') + + workflow = pe.Workflow(name='iter_clone_wf') + workflow.connect([(inputnode, node_1, [('subject','string')]), + (node_1, node_2, [('string','string')])]) + workflow.run() From b91560c8ff682ca5084b545d088a9d74753ae295 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Thu, 8 Feb 2018 16:53:28 -0500 Subject: [PATCH 318/365] enh: improve travis build reliability --- .travis.yml | 75 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 08d9234675..1e2ed0c3df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,55 +1,64 @@ -cache: - apt: true +dist: trusty +sudo: required language: python +# our build matrix python: - 2.7 - 3.4 - 3.5 - 3.6 + env: - INSTALL_DEB_DEPENDECIES=true NIPYPE_EXTRAS="doc,tests,fmri,profiler" CI_SKIP_TEST=1 - INSTALL_DEB_DEPENDECIES=false NIPYPE_EXTRAS="doc,tests,fmri,profiler" CI_SKIP_TEST=1 - INSTALL_DEB_DEPENDECIES=true NIPYPE_EXTRAS="doc,tests,fmri,profiler,duecredit" CI_SKIP_TEST=1 - INSTALL_DEB_DEPENDECIES=true NIPYPE_EXTRAS="doc,tests,fmri,profiler" PIP_FLAGS="--pre" CI_SKIP_TEST=1 + +addons: + apt: + packages: + - xvfb + - fusefat + - graphviz + +cache: + directories: + - ${HOME}/.cache + before_install: -- function apt_inst { - if $INSTALL_DEB_DEPENDECIES; then sudo rm -rf /dev/shm; fi && - if $INSTALL_DEB_DEPENDECIES; then sudo ln -s /run/shm /dev/shm; fi && - bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh) && - sudo apt-get -y update && - sudo apt-get -y install xvfb fusefat graphviz && - if $INSTALL_DEB_DEPENDECIES; then travis_retry sudo apt-get install -y -qq - fsl afni elastix fsl-atlases; fi && - if $INSTALL_DEB_DEPENDECIES; then +- if $INSTALL_DEB_DEPENDECIES; then sudo rm -rf /dev/shm; sudo ln -s /run/shm /dev/shm; fi +- travis_retry bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh); +- if $INSTALL_DEB_DEPENDECIES; then + travis_retry sudo apt-get -y update && + travis_retry sudo apt-get install -y -qq fsl afni elastix fsl-atlases; + fi; +- if $INSTALL_DEB_DEPENDECIES; then source /etc/fsl/fsl.sh; source /etc/afni/afni.sh; - export FSLOUTPUTTYPE=NIFTI_GZ; fi } -- function conda_inst { - export CONDA_HOME=$HOME/conda && - wget https://repo.continuum.io/miniconda/Miniconda${TRAVIS_PYTHON_VERSION:0:1}-latest-Linux-x86_64.sh - -O /home/travis/.cache/conda.sh && - bash /home/travis/.cache/conda.sh -b -p ${CONDA_HOME} && - export PATH=${CONDA_HOME}/bin:$PATH && - hash -r && - conda config --set always_yes yes --set changeps1 no && - conda update -q conda && - conda config --add channels conda-forge && - conda install python=${TRAVIS_PYTHON_VERSION} && - conda install -y icu && - pip install -r requirements.txt && - pushd $HOME; - git clone https://github.com/INCF/pybids.git; - cd pybids; - pip install -e .; - popd; } -# Add install of vtk and mayavi to test mesh (disabled): conda install -y vtk mayavi -- travis_retry apt_inst -- travis_retry conda_inst + export FSLOUTPUTTYPE=NIFTI_GZ; + fi; + +# handle python operations separately to reduce timeouts +- wget https://repo.continuum.io/miniconda/Miniconda${TRAVIS_PYTHON_VERSION:0:1}-latest-Linux-x86_64.sh + -O /home/travis/.cache/conda.sh +- bash ${HOME}/.cache/conda.sh -b -p ${HOME}/conda +- export PATH=${HOME}/conda/bin:$PATH +- hash -r +- conda config --set always_yes yes --set changeps1 no +- travis_retry conda update -q conda +- conda config --add channels conda-forge +- travis_retry conda install -y python=${TRAVIS_PYTHON_VERSION} icu +- travis_retry pip install -r requirements.txt +- travis_retry git clone https://github.com/INCF/pybids.git ${HOME}/pybids && + pip install -e ${HOME}/pybids + install: - travis_retry pip install $PIP_FLAGS -e .[$NIPYPE_EXTRAS] + script: - py.test -v --doctest-modules nipype + deploy: provider: pypi user: satra From e98cf315b2570f575364a628432536dca1795464 Mon Sep 17 00:00:00 2001 From: mathiasg Date: Fri, 9 Feb 2018 13:19:53 -0500 Subject: [PATCH 319/365] sty: spacing --- nipype/pipeline/engine/tests/test_base.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nipype/pipeline/engine/tests/test_base.py b/nipype/pipeline/engine/tests/test_base.py index abe0d9d80c..fd87aa6878 100644 --- a/nipype/pipeline/engine/tests/test_base.py +++ b/nipype/pipeline/engine/tests/test_base.py @@ -71,19 +71,19 @@ def test_clone_node_iterables(tmpdir): tmpdir.chdir() def addstr(string): - return ('%s+2' % string ) + return ('%s + 2' % string) subject_list = ['sub-001', 'sub-002'] - inputnode = pe.Node(niu.IdentityInterface(fields = ['subject']), - name = 'inputnode') + inputnode = pe.Node(niu.IdentityInterface(fields=['subject']), + name='inputnode') inputnode.iterables = [('subject', subject_list)] node_1 = pe.Node(niu.Function(input_names='string', - output_names= 'string', - function = addstr),name='node_1') + output_names='string', + function=addstr), name='node_1') node_2 = node_1.clone('node_2') workflow = pe.Workflow(name='iter_clone_wf') - workflow.connect([(inputnode, node_1, [('subject','string')]), - (node_1, node_2, [('string','string')])]) + workflow.connect([(inputnode, node_1, [('subject', 'string')]), + (node_1, node_2, [('string', 'string')])]) workflow.run() From f58ab2f7eb2ce601fd3b10ef0ee1a983ab730141 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 12 Feb 2018 07:59:43 -0500 Subject: [PATCH 320/365] FIX: Update pybids data directory --- nipype/interfaces/tests/test_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index eeae322050..6aafb5b6b9 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -52,7 +52,7 @@ import bids from bids import grabbids as gb filepath = os.path.realpath(os.path.dirname(bids.__file__)) - datadir = os.path.realpath(os.path.join(filepath, 'grabbids/tests/data/')) + datadir = os.path.realpath(os.path.join(filepath, 'tests/data/')) except ImportError: have_pybids = False From f1e0b1946a2ec6b129d202a7a55214c14e97f8a9 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 12 Feb 2018 10:07:42 -0500 Subject: [PATCH 321/365] DOC: Use pip-packaged numpydoc --- doc/conf.py | 2 +- doc/sphinxext/numpy_ext/__init__.py | 1 - doc/sphinxext/numpy_ext/docscrape.py | 520 -------------------- doc/sphinxext/numpy_ext/docscrape_sphinx.py | 238 --------- doc/sphinxext/numpy_ext/numpydoc.py | 183 ------- nipype/info.py | 2 +- 6 files changed, 2 insertions(+), 944 deletions(-) delete mode 100644 doc/sphinxext/numpy_ext/__init__.py delete mode 100644 doc/sphinxext/numpy_ext/docscrape.py delete mode 100644 doc/sphinxext/numpy_ext/docscrape_sphinx.py delete mode 100644 doc/sphinxext/numpy_ext/numpydoc.py diff --git a/doc/conf.py b/doc/conf.py index 144c36f0db..22467090af 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -48,7 +48,7 @@ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.autosummary', - 'numpy_ext.numpydoc', + 'numpydoc', 'matplotlib.sphinxext.plot_directive', 'matplotlib.sphinxext.only_directives', 'nipype.sphinxext.plot_workflow', diff --git a/doc/sphinxext/numpy_ext/__init__.py b/doc/sphinxext/numpy_ext/__init__.py deleted file mode 100644 index 40a96afc6f..0000000000 --- a/doc/sphinxext/numpy_ext/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/doc/sphinxext/numpy_ext/docscrape.py b/doc/sphinxext/numpy_ext/docscrape.py deleted file mode 100644 index 28e3b30948..0000000000 --- a/doc/sphinxext/numpy_ext/docscrape.py +++ /dev/null @@ -1,520 +0,0 @@ -# -*- coding: utf-8 -*- -"""Extract reference documentation from the NumPy source tree. - -""" -from __future__ import print_function -from future import standard_library -standard_library.install_aliases() -from builtins import object - -import inspect -import textwrap -import re -import pydoc -from warnings import warn - -from io import StringIO - - -class Reader(object): - """A line-based string reader. - - """ - - def __init__(self, data): - """ - Parameters - ---------- - data : str - String with lines separated by '\n'. - - """ - if isinstance(data, list): - self._str = data - else: - self._str = data.split('\n') # store string as list of lines - - self.reset() - - def __getitem__(self, n): - return self._str[n] - - def reset(self): - self._l = 0 # current line nr - - def read(self): - if not self.eof(): - out = self[self._l] - self._l += 1 - return out - else: - return '' - - def seek_next_non_empty_line(self): - for l in self[self._l:]: - if l.strip(): - break - else: - self._l += 1 - - def eof(self): - return self._l >= len(self._str) - - def read_to_condition(self, condition_func): - start = self._l - for line in self[start:]: - if condition_func(line): - return self[start:self._l] - self._l += 1 - if self.eof(): - return self[start:self._l + 1] - return [] - - def read_to_next_empty_line(self): - self.seek_next_non_empty_line() - - def is_empty(line): - return not line.strip() - return self.read_to_condition(is_empty) - - def read_to_next_unindented_line(self): - def is_unindented(line): - return (line.strip() and (len(line.lstrip()) == len(line))) - return self.read_to_condition(is_unindented) - - def peek(self, n=0): - if self._l + n < len(self._str): - return self[self._l + n] - else: - return '' - - def is_empty(self): - return not ''.join(self._str).strip() - - -class NumpyDocString(object): - def __init__(self, docstring, config={}): - docstring = textwrap.dedent(docstring).split('\n') - - self._doc = Reader(docstring) - self._parsed_data = { - 'Signature': '', - 'Summary': [''], - 'Extended Summary': [], - 'Parameters': [], - 'Returns': [], - 'Raises': [], - 'Warns': [], - 'Other Parameters': [], - 'Attributes': [], - 'Methods': [], - 'See Also': [], - 'Notes': [], - 'Warnings': [], - 'References': '', - 'Examples': '', - 'index': {} - } - - self._parse() - - def __getitem__(self, key): - return self._parsed_data[key] - - def __setitem__(self, key, val): - if key not in self._parsed_data: - warn("Unknown section %s" % key) - else: - self._parsed_data[key] = val - - def _is_at_section(self): - self._doc.seek_next_non_empty_line() - - if self._doc.eof(): - return False - - l1 = self._doc.peek().strip() # e.g. Parameters - - if l1.startswith('.. index::'): - return True - - l2 = self._doc.peek(1).strip() # ---------- or ========== - return l2.startswith('-' * len(l1)) or l2.startswith('=' * len(l1)) - - def _strip(self, doc): - i = 0 - j = 0 - for i, line in enumerate(doc): - if line.strip(): - break - - for j, line in enumerate(doc[::-1]): - if line.strip(): - break - - return doc[i:len(doc) - j] - - def _read_to_next_section(self): - section = self._doc.read_to_next_empty_line() - - while not self._is_at_section() and not self._doc.eof(): - if not self._doc.peek(-1).strip(): # previous line was empty - section += [''] - - section += self._doc.read_to_next_empty_line() - - return section - - def _read_sections(self): - while not self._doc.eof(): - data = self._read_to_next_section() - name = data[0].strip() - - if name.startswith('..'): # index section - yield name, data[1:] - elif len(data) < 2: - yield StopIteration - else: - yield name, self._strip(data[2:]) - - def _parse_param_list(self, content): - r = Reader(content) - params = [] - while not r.eof(): - header = r.read().strip() - if ' : ' in header: - arg_name, arg_type = header.split(' : ')[:2] - else: - arg_name, arg_type = header, '' - - desc = r.read_to_next_unindented_line() - desc = dedent_lines(desc) - - params.append((arg_name, arg_type, desc)) - - return params - - _name_rgx = re.compile(r"^\s*(:(?P\w+):`(?P[a-zA-Z0-9_.-]+)`|" - r" (?P[a-zA-Z0-9_.-]+))\s*", re.X) - - def _parse_see_also(self, content): - """ - func_name : Descriptive text - continued text - another_func_name : Descriptive text - func_name1, func_name2, :meth:`func_name`, func_name3 - - """ - items = [] - - def parse_item_name(text): - """Match ':role:`name`' or 'name'""" - m = self._name_rgx.match(text) - if m: - g = m.groups() - if g[1] is None: - return g[3], None - else: - return g[2], g[1] - raise ValueError("%s is not a item name" % text) - - def push_item(name, rest): - if not name: - return - name, role = parse_item_name(name) - items.append((name, list(rest), role)) - del rest[:] - - current_func = None - rest = [] - - for line in content: - if not line.strip(): - continue - - m = self._name_rgx.match(line) - if m and line[m.end():].strip().startswith(':'): - push_item(current_func, rest) - current_func, line = line[:m.end()], line[m.end():] - rest = [line.split(':', 1)[1].strip()] - if not rest[0]: - rest = [] - elif not line.startswith(' '): - push_item(current_func, rest) - current_func = None - if ',' in line: - for func in line.split(','): - if func.strip(): - push_item(func, []) - elif line.strip(): - current_func = line - elif current_func is not None: - rest.append(line.strip()) - push_item(current_func, rest) - return items - - def _parse_index(self, section, content): - """ - .. index: default - :refguide: something, else, and more - - """ - def strip_each_in(lst): - return [s.strip() for s in lst] - - out = {} - section = section.split('::') - if len(section) > 1: - out['default'] = strip_each_in(section[1].split(','))[0] - for line in content: - line = line.split(':') - if len(line) > 2: - out[line[1]] = strip_each_in(line[2].split(',')) - return out - - def _parse_summary(self): - """Grab signature (if given) and summary""" - if self._is_at_section(): - return - - summary = self._doc.read_to_next_empty_line() - summary_str = " ".join([s.strip() for s in summary]).strip() - if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str): - self['Signature'] = summary_str - if not self._is_at_section(): - self['Summary'] = self._doc.read_to_next_empty_line() - else: - self['Summary'] = summary - - if not self._is_at_section(): - self['Extended Summary'] = self._read_to_next_section() - - def _parse(self): - self._doc.reset() - self._parse_summary() - - for (section, content) in self._read_sections(): - if not section.startswith('..'): - section = ' '.join([s.capitalize() - for s in section.split(' ')]) - if section in ('Parameters', 'Returns', 'Raises', 'Warns', - 'Other Parameters', 'Attributes', 'Methods'): - self[section] = self._parse_param_list(content) - elif section.startswith('.. index::'): - self['index'] = self._parse_index(section, content) - elif section == 'See Also': - self['See Also'] = self._parse_see_also(content) - else: - self[section] = content - - # string conversion routines - - def _str_header(self, name, symbol='-'): - return [name, len(name) * symbol] - - def _str_indent(self, doc, indent=4): - out = [] - for line in doc: - out += [' ' * indent + line] - return out - - def _str_signature(self): - if self['Signature']: - return [self['Signature'].replace('*', '\*')] + [''] - else: - return [''] - - def _str_summary(self): - if self['Summary']: - return self['Summary'] + [''] - else: - return [] - - def _str_extended_summary(self): - if self['Extended Summary']: - return self['Extended Summary'] + [''] - else: - return [] - - def _str_param_list(self, name): - out = [] - if self[name]: - out += self._str_header(name) - for param, param_type, desc in self[name]: - out += ['%s : %s' % (param, param_type)] - out += self._str_indent(desc) - out += [''] - return out - - def _str_section(self, name): - out = [] - if self[name]: - out += self._str_header(name) - out += self[name] - out += [''] - return out - - def _str_see_also(self, func_role): - if not self['See Also']: - return [] - out = [] - out += self._str_header("See Also") - last_had_desc = True - for func, desc, role in self['See Also']: - if role: - link = ':%s:`%s`' % (role, func) - elif func_role: - link = ':%s:`%s`' % (func_role, func) - else: - link = "`%s`_" % func - if desc or last_had_desc: - out += [''] - out += [link] - else: - out[-1] += ", %s" % link - if desc: - out += self._str_indent([' '.join(desc)]) - last_had_desc = True - else: - last_had_desc = False - out += [''] - return out - - def _str_index(self): - idx = self['index'] - out = [] - out += ['.. index:: %s' % idx.get('default', '')] - for section, references in list(idx.items()): - if section == 'default': - continue - out += [' :%s: %s' % (section, ', '.join(references))] - return out - - def __str__(self, func_role=''): - out = [] - out += self._str_signature() - out += self._str_summary() - out += self._str_extended_summary() - for param_list in ('Parameters', 'Returns', 'Other Parameters', - 'Raises', 'Warns'): - out += self._str_param_list(param_list) - out += self._str_section('Warnings') - out += self._str_see_also(func_role) - for s in ('Notes', 'References', 'Examples'): - out += self._str_section(s) - for param_list in ('Attributes', 'Methods'): - out += self._str_param_list(param_list) - out += self._str_index() - return '\n'.join(out) - - -def indent(str, indent=4): - indent_str = ' ' * indent - if str is None: - return indent_str - lines = str.split('\n') - return '\n'.join(indent_str + l for l in lines) - - -def dedent_lines(lines): - """Deindent a list of lines maximally""" - return textwrap.dedent("\n".join(lines)).split("\n") - - -def header(text, style='-'): - return text + '\n' + style * len(text) + '\n' - - -class FunctionDoc(NumpyDocString): - def __init__(self, func, role='func', doc=None, config={}): - self._f = func - self._role = role # e.g. "func" or "meth" - - if doc is None: - if func is None: - raise ValueError("No function or docstring given") - doc = inspect.getdoc(func) or '' - NumpyDocString.__init__(self, doc) - - if not self['Signature'] and func is not None: - func, func_name = self.get_func() - try: - # try to read signature - argspec = inspect.getargspec(func) - argspec = inspect.formatargspec(*argspec) - argspec = argspec.replace('*', '\*') - signature = '%s%s' % (func_name, argspec) - except TypeError: - signature = '%s()' % func_name - self['Signature'] = signature - - def get_func(self): - func_name = getattr(self._f, '__name__', self.__class__.__name__) - if inspect.isclass(self._f): - func = getattr(self._f, '__call__', self._f.__init__) - else: - func = self._f - return func, func_name - - def __str__(self): - out = '' - - func, func_name = self.get_func() - - roles = {'func': 'function', - 'meth': 'method'} - - if self._role: - if self._role not in roles: - print("Warning: invalid role %s" % self._role) - out += '.. %s:: %s\n \n\n' % (roles.get(self._role, ''), - func_name) - - out += super(FunctionDoc, self).__str__(func_role=self._role) - return out - - -class ClassDoc(NumpyDocString): - - extra_public_methods = ['__call__'] - - def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc, - config={}): - if not inspect.isclass(cls) and cls is not None: - raise ValueError("Expected a class or None, but got %r" % cls) - self._cls = cls - - if modulename and not modulename.endswith('.'): - modulename += '.' - self._mod = modulename - - if doc is None: - if cls is None: - raise ValueError("No class or documentation string given") - doc = pydoc.getdoc(cls) - - NumpyDocString.__init__(self, doc) - - if config.get('show_class_members', True): - if not self['Methods']: - self['Methods'] = [(name, '', '') - for name in sorted(self.methods)] - if not self['Attributes']: - self['Attributes'] = [(name, '', '') - for name in sorted(self.properties)] - - @property - def methods(self): - if self._cls is None: - return [] - return [name for name, func in inspect.getmembers(self._cls) - if ((not name.startswith('_') or - name in self.extra_public_methods) and - callable(func))] - - @property - def properties(self): - if self._cls is None: - return [] - return [name for name, func in inspect.getmembers(self._cls) - if not name.startswith('_') and func is None] diff --git a/doc/sphinxext/numpy_ext/docscrape_sphinx.py b/doc/sphinxext/numpy_ext/docscrape_sphinx.py deleted file mode 100644 index 99ac2f4d00..0000000000 --- a/doc/sphinxext/numpy_ext/docscrape_sphinx.py +++ /dev/null @@ -1,238 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, unicode_literals -from builtins import str, bytes -import re -import inspect -import textwrap -import pydoc -import sphinx -from .docscrape import NumpyDocString, FunctionDoc, ClassDoc - - -class SphinxDocString(NumpyDocString): - def __init__(self, docstring, config={}): - self.use_plots = config.get('use_plots', False) - NumpyDocString.__init__(self, docstring, config=config) - - # string conversion routines - def _str_header(self, name, symbol='`'): - return ['.. rubric:: ' + name, ''] - - def _str_field_list(self, name): - return [':' + name + ':'] - - def _str_indent(self, doc, indent=4): - out = [] - for line in doc: - out += [' ' * indent + line] - return out - - def _str_signature(self): - return [''] - if self['Signature']: - return ['``%s``' % self['Signature']] + [''] - else: - return [''] - - def _str_summary(self): - return self['Summary'] + [''] - - def _str_extended_summary(self): - return self['Extended Summary'] + [''] - - def _str_param_list(self, name): - out = [] - if self[name]: - out += self._str_field_list(name) - out += [''] - for param, param_type, desc in self[name]: - out += self._str_indent(['**%s** : %s' % (param.strip(), - param_type)]) - out += [''] - out += self._str_indent(desc, 8) - out += [''] - return out - - @property - def _obj(self): - if hasattr(self, '_cls'): - return self._cls - elif hasattr(self, '_f'): - return self._f - return None - - def _str_member_list(self, name): - """ - Generate a member listing, autosummary:: table where possible, - and a table where not. - - """ - out = [] - if self[name]: - out += ['.. rubric:: %s' % name, ''] - prefix = getattr(self, '_name', '') - - if prefix: - prefix = '~%s.' % prefix - - autosum = [] - others = [] - for param, param_type, desc in self[name]: - param = param.strip() - if not self._obj or hasattr(self._obj, param): - autosum += [" %s%s" % (prefix, param)] - else: - others.append((param, param_type, desc)) - - if autosum: - out += ['.. autosummary::', ' :toctree:', ''] - out += autosum - - if others: - maxlen_0 = max([len(x[0]) for x in others]) - maxlen_1 = max([len(x[1]) for x in others]) - hdr = "=" * maxlen_0 + " " + "=" * maxlen_1 + " " + "=" * 10 - fmt = '%%%ds %%%ds ' % (maxlen_0, maxlen_1) - n_indent = maxlen_0 + maxlen_1 + 4 - out += [hdr] - for param, param_type, desc in others: - out += [fmt % (param.strip(), param_type)] - out += self._str_indent(desc, n_indent) - out += [hdr] - out += [''] - return out - - def _str_section(self, name): - out = [] - if self[name]: - out += self._str_header(name) - out += [''] - content = textwrap.dedent("\n".join(self[name])).split("\n") - out += content - out += [''] - return out - - def _str_see_also(self, func_role): - out = [] - if self['See Also']: - see_also = super(SphinxDocString, self)._str_see_also(func_role) - out = ['.. seealso::', ''] - out += self._str_indent(see_also[2:]) - return out - - def _str_warnings(self): - out = [] - if self['Warnings']: - out = ['.. warning::', ''] - out += self._str_indent(self['Warnings']) - return out - - def _str_index(self): - idx = self['index'] - out = [] - if len(idx) == 0: - return out - - out += ['.. index:: %s' % idx.get('default', '')] - for section, references in list(idx.items()): - if section == 'default': - continue - elif section == 'refguide': - out += [' single: %s' % (', '.join(references))] - else: - out += [' %s: %s' % (section, ','.join(references))] - return out - - def _str_references(self): - out = [] - if self['References']: - out += self._str_header('References') - if isinstance(self['References'], (str, bytes)): - self['References'] = [self['References']] - out.extend(self['References']) - out += [''] - # Latex collects all references to a separate bibliography, - # so we need to insert links to it - if sphinx.__version__ >= "0.6": - out += ['.. only:: latex', ''] - else: - out += ['.. latexonly::', ''] - items = [] - for line in self['References']: - m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I) - if m: - items.append(m.group(1)) - out += [' ' + ", ".join(["[%s]_" % item for item in items]), ''] - return out - - def _str_examples(self): - examples_str = "\n".join(self['Examples']) - - if (self.use_plots and 'import matplotlib' in examples_str and - 'plot::' not in examples_str): - out = [] - out += self._str_header('Examples') - out += ['.. plot::', ''] - out += self._str_indent(self['Examples']) - out += [''] - return out - else: - return self._str_section('Examples') - - def __str__(self, indent=0, func_role="obj"): - out = [] - out += self._str_signature() - out += self._str_index() + [''] - out += self._str_summary() - out += self._str_extended_summary() - for param_list in ('Parameters', 'Returns', 'Other Parameters', - 'Raises', 'Warns'): - out += self._str_param_list(param_list) - out += self._str_warnings() - out += self._str_see_also(func_role) - out += self._str_section('Notes') - out += self._str_references() - out += self._str_examples() - for param_list in ('Attributes', 'Methods'): - out += self._str_member_list(param_list) - out = self._str_indent(out, indent) - return '\n'.join(out) - - -class SphinxFunctionDoc(SphinxDocString, FunctionDoc): - def __init__(self, obj, doc=None, config={}): - self.use_plots = config.get('use_plots', False) - FunctionDoc.__init__(self, obj, doc=doc, config=config) - - -class SphinxClassDoc(SphinxDocString, ClassDoc): - def __init__(self, obj, doc=None, func_doc=None, config={}): - self.use_plots = config.get('use_plots', False) - ClassDoc.__init__(self, obj, doc=doc, func_doc=None, config=config) - - -class SphinxObjDoc(SphinxDocString): - def __init__(self, obj, doc=None, config={}): - self._f = obj - SphinxDocString.__init__(self, doc, config=config) - - -def get_doc_object(obj, what=None, doc=None, config={}): - if what is None: - if inspect.isclass(obj): - what = 'class' - elif inspect.ismodule(obj): - what = 'module' - elif callable(obj): - what = 'function' - else: - what = 'object' - if what == 'class': - return SphinxClassDoc(obj, func_doc=SphinxFunctionDoc, doc=doc, - config=config) - elif what in ('function', 'method'): - return SphinxFunctionDoc(obj, doc=doc, config=config) - else: - if doc is None: - doc = pydoc.getdoc(obj) - return SphinxObjDoc(obj, doc, config=config) diff --git a/doc/sphinxext/numpy_ext/numpydoc.py b/doc/sphinxext/numpy_ext/numpydoc.py deleted file mode 100644 index c21ada71e6..0000000000 --- a/doc/sphinxext/numpy_ext/numpydoc.py +++ /dev/null @@ -1,183 +0,0 @@ -# -*- coding: utf-8 -*- -""" -======== -numpydoc -======== - -Sphinx extension that handles docstrings in the Numpy standard format. [1] - -It will: - -- Convert Parameters etc. sections to field lists. -- Convert See Also section to a See also entry. -- Renumber references. -- Extract signature from docstring, if it can't be determined otherwise. - -.. [1] https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt - -""" - -from __future__ import absolute_import -from builtins import object - -import sphinx - -if sphinx.__version__ < '1.0.1': - raise RuntimeError("Sphinx 1.0.1 or newer is required") - -import os -import re -import pydoc -from .docscrape_sphinx import get_doc_object, SphinxDocString -from sphinx.util.compat import Directive -import inspect - - -def mangle_docstrings(app, what, name, obj, options, lines, - reference_offset=[0]): - - cfg = dict(use_plots=app.config.numpydoc_use_plots, - show_class_members=app.config.numpydoc_show_class_members) - - if what == 'module': - # Strip top title - title_re = re.compile(r'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*', - re.I | re.S) - lines[:] = title_re.sub(u'', u"\n".join(lines)).split(u"\n") - else: - doc = get_doc_object(obj, what, u"\n".join(lines), config=cfg) - lines[:] = str(doc).split(u"\n") - - if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \ - obj.__name__: - if hasattr(obj, '__module__'): - v = dict(full_name=u"%s.%s" % (obj.__module__, obj.__name__)) - else: - v = dict(full_name=obj.__name__) - lines += [u'', u'.. only:: html', ''] - lines += [u' %s' % x for x in - (app.config.numpydoc_edit_link % v).split("\n")] - - # replace reference numbers so that there are no duplicates - references = [] - for line in lines: - line = line.strip() - m = re.match(r'^.. \[([a-z0-9_.-])\]', line, re.I) - if m: - references.append(m.group(1)) - - # start renaming from the longest string, to avoid overwriting parts - references.sort(key=lambda x: -len(x)) - if references: - for i, line in enumerate(lines): - for r in references: - if re.match(r'^\d+$', r): - new_r = u"R%d" % (reference_offset[0] + int(r)) - else: - new_r = u"%s%d" % (r, reference_offset[0]) - lines[i] = lines[i].replace(u'[%s]_' % r, - u'[%s]_' % new_r) - lines[i] = lines[i].replace(u'.. [%s]' % r, - u'.. [%s]' % new_r) - - reference_offset[0] += len(references) - - -def mangle_signature(app, what, name, obj, options, sig, retann): - # Do not try to inspect classes that don't define `__init__` - if (inspect.isclass(obj) and - (not hasattr(obj, '__init__') or - 'initializes x; see ' in pydoc.getdoc(obj.__init__))): - return '', '' - - if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): - return - if not hasattr(obj, '__doc__'): - return - - doc = SphinxDocString(pydoc.getdoc(obj)) - if doc['Signature']: - sig = re.sub(u"^[^(]*", u"", doc['Signature']) - return sig, u'' - - -def setup(app, get_doc_object_=get_doc_object): - global get_doc_object - get_doc_object = get_doc_object_ - - app.connect('autodoc-process-docstring', mangle_docstrings) - app.connect('autodoc-process-signature', mangle_signature) - app.add_config_value('numpydoc_edit_link', None, False) - app.add_config_value('numpydoc_use_plots', None, False) - app.add_config_value('numpydoc_show_class_members', True, True) - - # Extra mangling domains - app.add_domain(NumpyPythonDomain) - app.add_domain(NumpyCDomain) - -# ------------------------------------------------------------------------------ -# Docstring-mangling domains -# ------------------------------------------------------------------------------ - -from docutils.statemachine import ViewList -from sphinx.domains.c import CDomain -from sphinx.domains.python import PythonDomain - - -class ManglingDomainBase(object): - directive_mangling_map = {} - - def __init__(self, *a, **kw): - super(ManglingDomainBase, self).__init__(*a, **kw) - self.wrap_mangling_directives() - - def wrap_mangling_directives(self): - for name, objtype in list(self.directive_mangling_map.items()): - self.directives[name] = wrap_mangling_directive( - self.directives[name], objtype) - - -class NumpyPythonDomain(ManglingDomainBase, PythonDomain): - name = 'np' - directive_mangling_map = { - 'function': 'function', - 'class': 'class', - 'exception': 'class', - 'method': 'function', - 'classmethod': 'function', - 'staticmethod': 'function', - 'attribute': 'attribute', - } - - -class NumpyCDomain(ManglingDomainBase, CDomain): - name = 'np-c' - directive_mangling_map = { - 'function': 'function', - 'member': 'attribute', - 'macro': 'function', - 'type': 'class', - 'var': 'object', - } - - -def wrap_mangling_directive(base_directive, objtype): - class directive(base_directive): - def run(self): - env = self.state.document.settings.env - - name = None - if self.arguments: - m = re.match(r'^(.*\s+)?(.*?)(\(.*)?', self.arguments[0]) - name = m.group(2).strip() - - if not name: - name = self.arguments[0] - - lines = list(self.content) - mangle_docstrings(env.app, objtype, name, None, None, lines) - self.content = ViewList(lines, self.content.parent) - - return base_directive.run(self) - - return directive diff --git a/nipype/info.py b/nipype/info.py index 93303efb07..8a7e3b4348 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -156,7 +156,7 @@ def get_nipype_gitversion(): TESTS_REQUIRES = ['pytest-cov', 'codecov'] EXTRA_REQUIRES = { - 'doc': ['Sphinx>=1.4', 'matplotlib', 'pydotplus', 'pydot>=1.2.3'], + 'doc': ['Sphinx>=1.4', 'numpydoc', 'matplotlib', 'pydotplus', 'pydot>=1.2.3'], 'tests': TESTS_REQUIRES, 'specs': ['yapf'], 'nipy': ['nitime', 'nilearn', 'dipy', 'nipy', 'matplotlib'], From 02607b87e542bb361795da0b1b3ce6ba5f57a833 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 20 Jan 2018 12:21:13 -0600 Subject: [PATCH 322/365] TEST: Split Circle workflow --- .circleci/config.yml | 159 +++++++++++++++--- .circleci/pytests.sh | 12 ++ .circleci/test_complete.sh | 12 ++ .circleci/test_init.sh | 12 ++ .../test_py2_fmri_spm_nested_multiproc_l2.sh | 8 + .../test_py3_fmri_fsl_feeds_linear_l1.sh | 8 + .../test_py3_fmri_fsl_reuse_linear_l1.sh | 8 + 7 files changed, 192 insertions(+), 27 deletions(-) create mode 100644 .circleci/pytests.sh create mode 100644 .circleci/test_complete.sh create mode 100644 .circleci/test_init.sh create mode 100644 .circleci/test_py2_fmri_spm_nested_multiproc_l2.sh create mode 100644 .circleci/test_py3_fmri_fsl_feeds_linear_l1.sh create mode 100644 .circleci/test_py3_fmri_fsl_reuse_linear_l1.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index e922b37520..e1cdd705e1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,9 +35,7 @@ jobs: - docker/Dockerfile.base-pruned - docker/get_base_image.sh - - build_and_test: - parallelism: 4 + fetch_base: machine: # Ubuntu 14.04 with Docker 17.10.0-ce image: circleci/classic:201710-02 @@ -45,6 +43,7 @@ jobs: steps: - checkout: path: /home/circleci/nipype + - setup_remote_docker - attach_workspace: at: /tmp - run: @@ -75,34 +74,141 @@ jobs: exit 1 fi - run: - name: Build main image (py36) + name: Save Docker images to workspace + no_output_timeout: 60m + command: | + docker save nipype/nipype:base | gzip -1 > /tmp/docker/nipype-base.tar.gz \ + && du -h /tmp/docker/nipype-base.tar.gz + - persist_to_workspace: + root: /tmp + paths: + - docker/* + + build_py2: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - checkout: + path: /home/circleci/nipype + - setup_remote_docker + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base.tar.gz + - run: + name: Get test dependencies and generate Dockerfiles + command: | + pip install --no-cache-dir codecov + make gen-dockerfiles + - run: + name: Modify Nipype version if necessary + command: | + if [ "$CIRCLE_TAG" != "" ]; then + sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py + fi + - run: + name: Build main image (py27) no_output_timeout: 60m command: | e=1 && for i in {1..5}; do docker build \ --rm=false \ - --tag nipype/nipype:latest \ - --tag nipype/nipype:py36 \ + --tag nipype/nipype:py27 \ + --build-arg PYTHON_VERSION_MAJOR=2 \ + --build-arg PYTHON_VERSION_MINOR=7 \ --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ + --build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype \ && e=0 && break || sleep 15 done && [ "$e" -eq "0" ] - run: - name: Build main image (py27) + name: Save Docker images to workspace + no_output_timeout: 60m + command: | + docker save nipype/nipype:py27 | gzip -1 > /tmp/docker/nipype-py27.tar.gz \ + && du -h /tmp/docker/nipype-py27.tar.gz + - persist_to_workspace: + root: /tmp + paths: + - docker/* + + + build_py3: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - checkout: + path: /home/circleci/nipype + - setup_remote_docker + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base.tar.gz + - run: + name: Get test dependencies and generate Dockerfiles + command: | + pip install --no-cache-dir codecov + make gen-dockerfiles + - run: + name: Modify Nipype version if necessary + command: | + if [ "$CIRCLE_TAG" != "" ]; then + sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py + fi + - run: + name: Build main image (py36) no_output_timeout: 60m command: | e=1 && for i in {1..5}; do docker build \ --rm=false \ - --tag nipype/nipype:py27 \ - --build-arg PYTHON_VERSION_MAJOR=2 \ - --build-arg PYTHON_VERSION_MINOR=7 \ + --tag nipype/nipype:latest \ + --tag nipype/nipype:py36 \ --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype \ + --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ && e=0 && break || sleep 15 done && [ "$e" -eq "0" ] + - run: + name: Save Docker images to workspace + no_output_timeout: 60m + command: | + docker save nipype/nipype:latest \ + nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-latest-py36.tar.gz \ + && du -h /tmp/docker/nipype-latest-py36.tar.gz + - persist_to_workspace: + root: /tmp + paths: + - docker/* + + + build_and_test: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base.tar.gz \ + && docker load < /tmp/docker/nipype-py27.tar.gz \ + && docker load < /tmp/docker/nipype-latest-py36.tar.gz + - checkout: + path: /home/circleci/nipype - run: name: Download test data no_output_timeout: 20m @@ -120,26 +226,15 @@ jobs: curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - run: name: Run tests - no_output_timeout: 4h + no_output_timeout: 2h environment: WORKDIR: /home/circleci/work command: | mkdir -p "$WORKDIR" chmod -R 777 "$WORKDIR" - bash /home/circleci/nipype/.circleci/tests.sh + bash /home/circleci/nipype/.circleci/pytests.sh - store_artifacts: path: /home/circleci/work/tests - - run: - name: Save Docker images to workspace - no_output_timeout: 60m - command: | - if [ "$CIRCLE_NODE_INDEX" -eq "0" ] && [ "$CIRCLE_BRANCH" == "master" ]; then - docker save nipype/nipype:base \ - nipype/nipype:latest \ - nipype/nipype:py36 \ - nipype/nipype:py27 | gzip -1 > /tmp/docker/nipype-base-latest-py36-py27.tar.gz - du -h /tmp/docker/nipype-base-latest-py36-py27.tar.gz - fi - persist_to_workspace: root: /tmp paths: @@ -180,12 +275,22 @@ jobs: workflows: version: 2 - build_test_deply: + build_test_deploy: jobs: - compare_base_dockerfiles - - build_and_test: + - fetch_base: requires: - compare_base_dockerfiles + - build_py2: + requires: + - fetch_base + - build_py3: + requires: + - fetch_base + - build_and_test: + requires: + - build_py2 + - build_py3 - deploy: filters: branches: diff --git a/.circleci/pytests.sh b/.circleci/pytests.sh new file mode 100644 index 0000000000..c92de4a582 --- /dev/null +++ b/.circleci/pytests.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +. test_init.sh + +# These tests are manually balanced based on previous build timings. +# They may need to be rebalanced in the future. +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py36" /usr/bin/run_pytests.sh \ +&& docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py27" /usr/bin/run_pytests.sh \ +&& docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /src/nipype/doc "${DOCKER_IMAGE}:py36" /usr/bin/run_builddocs.sh +exitcode=$? + +. test_complete.sh diff --git a/.circleci/test_complete.sh b/.circleci/test_complete.sh new file mode 100644 index 0000000000..5c138a2d82 --- /dev/null +++ b/.circleci/test_complete.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# +# Source after running test and storing relevant return code in $exitcode + +# Exit with error if any of the tests failed +if [ "$exitcode" != "0" ]; then exit 1; fi + +codecov --file "${WORKDIR}/tests/coverage*.xml" \ + --root "${HOME}/nipype/" --flags unittests -e SCRIPT_NAME + +codecov --file "${WORKDIR}/tests/smoketest*.xml" \ + --root "${HOME}/nipype/" --flags smoketests -e SCRIPT_NAME diff --git a/.circleci/test_init.sh b/.circleci/test_init.sh new file mode 100644 index 0000000000..373d5efe7a --- /dev/null +++ b/.circleci/test_init.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# +# Source before running tests + +# Setting # $ help set +set -e # Exit immediately if a command exits with a non-zero status. +set -u # Treat unset variables as an error when substituting. +set -x # Print command traces before executing command. + +export DOCKER_IMAGE="nipype/nipype" + +export SCRIPT_NAME=`basename $0` diff --git a/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh b/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh new file mode 100644 index 0000000000..276511542a --- /dev/null +++ b/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py27" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline +exitcode=$? + +. test_complete.sh diff --git a/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh b/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh new file mode 100644 index 0000000000..95534d127b --- /dev/null +++ b/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline +exitcode=$? + +. test_complete.sh diff --git a/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh b/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh new file mode 100644 index 0000000000..df16db713a --- /dev/null +++ b/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow +exitcode=$? + +. test_complete.sh From 700ba293066df9dbc0e1d2be04adb28527a011d5 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 20 Jan 2018 13:09:40 -0600 Subject: [PATCH 323/365] FIX: Remove setup_remote_docker from fetch/build --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1cdd705e1..139dabe516 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,7 +43,6 @@ jobs: steps: - checkout: path: /home/circleci/nipype - - setup_remote_docker - attach_workspace: at: /tmp - run: @@ -92,7 +91,6 @@ jobs: steps: - checkout: path: /home/circleci/nipype - - setup_remote_docker - attach_workspace: at: /tmp - run: @@ -146,7 +144,6 @@ jobs: steps: - checkout: path: /home/circleci/nipype - - setup_remote_docker - attach_workspace: at: /tmp - run: From c2b0ebc2c6cfb96cd3be135477f557a85311ab67 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 20 Jan 2018 13:37:24 -0600 Subject: [PATCH 324/365] CI: Build in serial, to reduce save/load steps --- .circleci/config.yml | 114 ++++++++----------------------------------- 1 file changed, 21 insertions(+), 93 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 139dabe516..6193922e40 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: - docker/Dockerfile.base-pruned - docker/get_base_image.sh - fetch_base: + build_images: machine: # Ubuntu 14.04 with Docker 17.10.0-ce image: circleci/classic:201710-02 @@ -72,32 +72,6 @@ jobs: echo "Error: method to get base image not understood" exit 1 fi - - run: - name: Save Docker images to workspace - no_output_timeout: 60m - command: | - docker save nipype/nipype:base | gzip -1 > /tmp/docker/nipype-base.tar.gz \ - && du -h /tmp/docker/nipype-base.tar.gz - - persist_to_workspace: - root: /tmp - paths: - - docker/* - - build_py2: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 - working_directory: /home/circleci/nipype - steps: - - checkout: - path: /home/circleci/nipype - - attach_workspace: - at: /tmp - - run: - name: Load saved Docker images. - no_output_timeout: 60m - command: | - docker load < /tmp/docker/nipype-base.tar.gz - run: name: Get test dependencies and generate Dockerfiles command: | @@ -110,86 +84,49 @@ jobs: sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py fi - run: - name: Build main image (py27) + name: Build main image (py36) no_output_timeout: 60m command: | e=1 && for i in {1..5}; do docker build \ --rm=false \ - --tag nipype/nipype:py27 \ - --build-arg PYTHON_VERSION_MAJOR=2 \ - --build-arg PYTHON_VERSION_MINOR=7 \ + --tag nipype/nipype:latest \ + --tag nipype/nipype:py36 \ --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype \ + --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ && e=0 && break || sleep 15 done && [ "$e" -eq "0" ] - run: - name: Save Docker images to workspace - no_output_timeout: 60m - command: | - docker save nipype/nipype:py27 | gzip -1 > /tmp/docker/nipype-py27.tar.gz \ - && du -h /tmp/docker/nipype-py27.tar.gz - - persist_to_workspace: - root: /tmp - paths: - - docker/* - - - build_py3: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 - working_directory: /home/circleci/nipype - steps: - - checkout: - path: /home/circleci/nipype - - attach_workspace: - at: /tmp - - run: - name: Load saved Docker images. - no_output_timeout: 60m - command: | - docker load < /tmp/docker/nipype-base.tar.gz - - run: - name: Get test dependencies and generate Dockerfiles - command: | - pip install --no-cache-dir codecov - make gen-dockerfiles - - run: - name: Modify Nipype version if necessary - command: | - if [ "$CIRCLE_TAG" != "" ]; then - sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py - fi - - run: - name: Build main image (py36) + name: Build main image (py27) no_output_timeout: 60m command: | e=1 && for i in {1..5}; do docker build \ --rm=false \ - --tag nipype/nipype:latest \ - --tag nipype/nipype:py36 \ + --tag nipype/nipype:py27 \ + --build-arg PYTHON_VERSION_MAJOR=2 \ + --build-arg PYTHON_VERSION_MINOR=7 \ --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ + --build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype \ && e=0 && break || sleep 15 done && [ "$e" -eq "0" ] - run: name: Save Docker images to workspace no_output_timeout: 60m command: | - docker save nipype/nipype:latest \ - nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-latest-py36.tar.gz \ - && du -h /tmp/docker/nipype-latest-py36.tar.gz + docker save nipype/nipype:base \ + nipype/nipype:latest \ + nipype/nipype:py27 \ + nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-base-latest-py36-py27.tar.gz \ + && du -h /tmp/docker/nipype-base-latest-py36-py27.tar.gz - persist_to_workspace: root: /tmp paths: - docker/* - - build_and_test: + test: machine: # Ubuntu 14.04 with Docker 17.10.0-ce image: circleci/classic:201710-02 @@ -201,9 +138,7 @@ jobs: name: Load saved Docker images. no_output_timeout: 60m command: | - docker load < /tmp/docker/nipype-base.tar.gz \ - && docker load < /tmp/docker/nipype-py27.tar.gz \ - && docker load < /tmp/docker/nipype-latest-py36.tar.gz + docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype - run: @@ -275,22 +210,15 @@ workflows: build_test_deploy: jobs: - compare_base_dockerfiles - - fetch_base: + - build_images: requires: - compare_base_dockerfiles - - build_py2: - requires: - - fetch_base - - build_py3: - requires: - - fetch_base - - build_and_test: + - test: requires: - - build_py2 - - build_py3 + - build_images - deploy: filters: branches: only: master requires: - - build_and_test + - test From ab1e6b55deb90564cdd6b6964163457f77e820a5 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 20 Jan 2018 13:57:18 -0600 Subject: [PATCH 325/365] CI: Add two tests in parallel --- .circleci/config.yml | 55 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6193922e40..afd5f26871 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -126,7 +126,7 @@ jobs: paths: - docker/* - test: + test_pytest: machine: # Ubuntu 14.04 with Docker 17.10.0-ce image: circleci/classic:201710-02 @@ -167,11 +167,48 @@ jobs: bash /home/circleci/nipype/.circleci/pytests.sh - store_artifacts: path: /home/circleci/work/tests - - persist_to_workspace: - root: /tmp - paths: - - docker/* + test_py2_fmri_spm_nested_multiproc_l2: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz + - checkout: + path: /home/circleci/nipype + - run: + name: Download test data + no_output_timeout: 20m + working_directory: /home/circleci/examples + environment: + OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" + command: | + export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj + + export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz + + export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz + - run: + name: Run tests + no_output_timeout: 2h + environment: + WORKDIR: /home/circleci/work + command: | + mkdir -p "$WORKDIR" + chmod -R 777 "$WORKDIR" + bash /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh + - store_artifacts: + path: /home/circleci/work/tests deploy: docker: @@ -213,7 +250,10 @@ workflows: - build_images: requires: - compare_base_dockerfiles - - test: + - test_pytest: + requires: + - build_images + - test_py2_fmri_spm_nested_multiproc_l2: requires: - build_images - deploy: @@ -221,4 +261,5 @@ workflows: branches: only: master requires: - - test + - test_pytest + - test_py2_fmri_spm_nested_multiproc_l2 From 34ea71832cc9c068812a04c6611fd6dff2c58ef5 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 20 Jan 2018 14:05:01 -0600 Subject: [PATCH 326/365] CI: Remove duplicate steps --- .circleci/config.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index afd5f26871..b2b98a9958 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,17 +72,6 @@ jobs: echo "Error: method to get base image not understood" exit 1 fi - - run: - name: Get test dependencies and generate Dockerfiles - command: | - pip install --no-cache-dir codecov - make gen-dockerfiles - - run: - name: Modify Nipype version if necessary - command: | - if [ "$CIRCLE_TAG" != "" ]; then - sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py - fi - run: name: Build main image (py36) no_output_timeout: 60m From 2c6627834020ce4dd2559ad85ba85044bfc4ca39 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 20 Jan 2018 14:10:26 -0600 Subject: [PATCH 327/365] CI: Full test suite --- .circleci/config.yml | 322 ++++++++++++++++++ .../test_py3_fmri_spm_dartel_linear_l1.sh | 8 + .../test_py3_fmri_spm_dartel_linear_l2.sh | 8 + .circleci/test_py3_fmri_spm_linear_3d.sh | 8 + .circleci/test_py3_fmri_spm_linear_4d.sh | 8 + .../test_py3_fmri_spm_nested_multiproc_l1.sh | 8 + 6 files changed, 362 insertions(+) create mode 100644 .circleci/test_py3_fmri_spm_dartel_linear_l1.sh create mode 100644 .circleci/test_py3_fmri_spm_dartel_linear_l2.sh create mode 100644 .circleci/test_py3_fmri_spm_linear_3d.sh create mode 100644 .circleci/test_py3_fmri_spm_linear_4d.sh create mode 100644 .circleci/test_py3_fmri_spm_nested_multiproc_l1.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index b2b98a9958..9ee472b712 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -199,6 +199,300 @@ jobs: - store_artifacts: path: /home/circleci/work/tests + test_py3_fmri_fsl_feeds_linear_l1: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz + - checkout: + path: /home/circleci/nipype + - run: + name: Download test data + no_output_timeout: 20m + working_directory: /home/circleci/examples + environment: + OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" + command: | + export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj + + export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz + + export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz + - run: + name: Run tests + no_output_timeout: 2h + environment: + WORKDIR: /home/circleci/work + command: | + mkdir -p "$WORKDIR" + chmod -R 777 "$WORKDIR" + bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh + - store_artifacts: + path: /home/circleci/work/tests + + test_py3_fmri_fsl_reuse_linear_l1: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz + - checkout: + path: /home/circleci/nipype + - run: + name: Download test data + no_output_timeout: 20m + working_directory: /home/circleci/examples + environment: + OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" + command: | + export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj + + export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz + + export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz + - run: + name: Run tests + no_output_timeout: 2h + environment: + WORKDIR: /home/circleci/work + command: | + mkdir -p "$WORKDIR" + chmod -R 777 "$WORKDIR" + bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh + - store_artifacts: + path: /home/circleci/work/tests + + test_py3_fmri_spm_dartel_linear_l1: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz + - checkout: + path: /home/circleci/nipype + - run: + name: Download test data + no_output_timeout: 20m + working_directory: /home/circleci/examples + environment: + OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" + command: | + export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj + + export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz + + export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz + - run: + name: Run tests + no_output_timeout: 2h + environment: + WORKDIR: /home/circleci/work + command: | + mkdir -p "$WORKDIR" + chmod -R 777 "$WORKDIR" + bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh + - store_artifacts: + path: /home/circleci/work/tests + + test_py3_fmri_spm_dartel_linear_l2: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz + - checkout: + path: /home/circleci/nipype + - run: + name: Download test data + no_output_timeout: 20m + working_directory: /home/circleci/examples + environment: + OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" + command: | + export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj + + export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz + + export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz + - run: + name: Run tests + no_output_timeout: 2h + environment: + WORKDIR: /home/circleci/work + command: | + mkdir -p "$WORKDIR" + chmod -R 777 "$WORKDIR" + bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh + - store_artifacts: + path: /home/circleci/work/tests + + test_py3_fmri_spm_linear_3d: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz + - checkout: + path: /home/circleci/nipype + - run: + name: Download test data + no_output_timeout: 20m + working_directory: /home/circleci/examples + environment: + OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" + command: | + export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj + + export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz + + export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz + - run: + name: Run tests + no_output_timeout: 2h + environment: + WORKDIR: /home/circleci/work + command: | + mkdir -p "$WORKDIR" + chmod -R 777 "$WORKDIR" + bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh + - store_artifacts: + path: /home/circleci/work/tests + + test_py3_fmri_spm_linear_4d: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz + - checkout: + path: /home/circleci/nipype + - run: + name: Download test data + no_output_timeout: 20m + working_directory: /home/circleci/examples + environment: + OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" + command: | + export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj + + export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz + + export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz + - run: + name: Run tests + no_output_timeout: 2h + environment: + WORKDIR: /home/circleci/work + command: | + mkdir -p "$WORKDIR" + chmod -R 777 "$WORKDIR" + bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh + - store_artifacts: + path: /home/circleci/work/tests + + test_py3_fmri_spm_nested_multiproc_l1: + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 + working_directory: /home/circleci/nipype + steps: + - attach_workspace: + at: /tmp + - run: + name: Load saved Docker images. + no_output_timeout: 60m + command: | + docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz + - checkout: + path: /home/circleci/nipype + - run: + name: Download test data + no_output_timeout: 20m + working_directory: /home/circleci/examples + environment: + OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" + command: | + export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj + + export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz + + export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz + - run: + name: Run tests + no_output_timeout: 2h + environment: + WORKDIR: /home/circleci/work + command: | + mkdir -p "$WORKDIR" + chmod -R 777 "$WORKDIR" + bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh + - store_artifacts: + path: /home/circleci/work/tests + deploy: docker: - image: docker:17.10.0-ce-git @@ -245,6 +539,27 @@ workflows: - test_py2_fmri_spm_nested_multiproc_l2: requires: - build_images + - test_py3_fmri_fsl_feeds_linear_l1: + requires: + - build_images + - test_py3_fmri_fsl_reuse_linear_l1: + requires: + - build_images + - test_py3_fmri_spm_dartel_linear_l1: + requires: + - build_images + - test_py3_fmri_spm_dartel_linear_l2: + requires: + - build_images + - test_py3_fmri_spm_linear_3d: + requires: + - build_images + - test_py3_fmri_spm_linear_4d: + requires: + - build_images + - test_py3_fmri_spm_nested_multiproc_l1: + requires: + - build_images - deploy: filters: branches: @@ -252,3 +567,10 @@ workflows: requires: - test_pytest - test_py2_fmri_spm_nested_multiproc_l2 + - test_py3_fmri_fsl_feeds_linear_l1 + - test_py3_fmri_fsl_reuse_linear_l1 + - test_py3_fmri_spm_dartel_linear_l1 + - test_py3_fmri_spm_dartel_linear_l2 + - test_py3_fmri_spm_linear_3d + - test_py3_fmri_spm_linear_4d + - test_py3_fmri_spm_nested_multiproc_l1 diff --git a/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh b/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh new file mode 100644 index 0000000000..d9ca4e9927 --- /dev/null +++ b/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ level1 +exitcode=$? + +. test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh b/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh new file mode 100644 index 0000000000..9122860ab7 --- /dev/null +++ b/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ l2pipeline +exitcode=$? + +. test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_linear_3d.sh b/.circleci/test_py3_fmri_spm_linear_3d.sh new file mode 100644 index 0000000000..8ab987f113 --- /dev/null +++ b/.circleci/test_py3_fmri_spm_linear_3d.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d +exitcode=$? + +. test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_linear_4d.sh b/.circleci/test_py3_fmri_spm_linear_4d.sh new file mode 100644 index 0000000000..0025971b75 --- /dev/null +++ b/.circleci/test_py3_fmri_spm_linear_4d.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d +exitcode=$? + +. test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh b/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh new file mode 100644 index 0000000000..2a4a4916c3 --- /dev/null +++ b/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 +exitcode=$? + +. test_complete.sh From 7d7ff1932044095223b9f893e38bf770b915a872 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 20 Jan 2018 14:56:02 -0600 Subject: [PATCH 328/365] CI: Add explicit directory to source lines --- .circleci/pytests.sh | 6 ++++-- .circleci/test_py2_fmri_spm_nested_multiproc_l2.sh | 6 ++++-- .circleci/test_py3_fmri_fsl_feeds_linear_l1.sh | 6 ++++-- .circleci/test_py3_fmri_fsl_reuse_linear_l1.sh | 6 ++++-- .circleci/test_py3_fmri_spm_dartel_linear_l1.sh | 6 ++++-- .circleci/test_py3_fmri_spm_dartel_linear_l2.sh | 6 ++++-- .circleci/test_py3_fmri_spm_linear_3d.sh | 6 ++++-- .circleci/test_py3_fmri_spm_linear_4d.sh | 6 ++++-- .circleci/test_py3_fmri_spm_nested_multiproc_l1.sh | 6 ++++-- 9 files changed, 36 insertions(+), 18 deletions(-) diff --git a/.circleci/pytests.sh b/.circleci/pytests.sh index c92de4a582..7d8bb27553 100644 --- a/.circleci/pytests.sh +++ b/.circleci/pytests.sh @@ -1,6 +1,8 @@ #!/bin/bash -. test_init.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh # These tests are manually balanced based on previous build timings. # They may need to be rebalanced in the future. @@ -9,4 +11,4 @@ docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro - && docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /src/nipype/doc "${DOCKER_IMAGE}:py36" /usr/bin/run_builddocs.sh exitcode=$? -. test_complete.sh +. $DIR/test_complete.sh diff --git a/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh b/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh index 276511542a..f575e40e0d 100644 --- a/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh +++ b/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh @@ -1,8 +1,10 @@ #!/bin/bash -. test_init.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py27" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline exitcode=$? -. test_complete.sh +. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh b/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh index 95534d127b..435d08738a 100644 --- a/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh +++ b/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh @@ -1,8 +1,10 @@ #!/bin/bash -. test_init.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline exitcode=$? -. test_complete.sh +. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh b/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh index df16db713a..9ac6d77d91 100644 --- a/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh +++ b/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh @@ -1,8 +1,10 @@ #!/bin/bash -. test_init.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow exitcode=$? -. test_complete.sh +. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh b/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh index d9ca4e9927..d10550f2ed 100644 --- a/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh +++ b/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh @@ -1,8 +1,10 @@ #!/bin/bash -. test_init.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ level1 exitcode=$? -. test_complete.sh +. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh b/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh index 9122860ab7..398a308df6 100644 --- a/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh +++ b/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh @@ -1,8 +1,10 @@ #!/bin/bash -. test_init.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ l2pipeline exitcode=$? -. test_complete.sh +. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_linear_3d.sh b/.circleci/test_py3_fmri_spm_linear_3d.sh index 8ab987f113..dd3542b542 100644 --- a/.circleci/test_py3_fmri_spm_linear_3d.sh +++ b/.circleci/test_py3_fmri_spm_linear_3d.sh @@ -1,8 +1,10 @@ #!/bin/bash -. test_init.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d exitcode=$? -. test_complete.sh +. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_linear_4d.sh b/.circleci/test_py3_fmri_spm_linear_4d.sh index 0025971b75..05a21fc786 100644 --- a/.circleci/test_py3_fmri_spm_linear_4d.sh +++ b/.circleci/test_py3_fmri_spm_linear_4d.sh @@ -1,8 +1,10 @@ #!/bin/bash -. test_init.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d exitcode=$? -. test_complete.sh +. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh b/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh index 2a4a4916c3..de1dcd77fb 100644 --- a/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh +++ b/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh @@ -1,8 +1,10 @@ #!/bin/bash -. test_init.sh +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 exitcode=$? -. test_complete.sh +. $DIR/test_complete.sh From 0dba5427110725d197bd3072b34dd68013b28623 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 20 Jan 2018 16:57:54 -0600 Subject: [PATCH 329/365] CI: Install codecov on test jobs --- .circleci/config.yml | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9ee472b712..fb4ca226f7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,9 +46,8 @@ jobs: - attach_workspace: at: /tmp - run: - name: Get test dependencies and generate Dockerfiles + name: Generate Dockerfiles command: | - pip install --no-cache-dir codecov make gen-dockerfiles - run: name: Modify Nipype version if necessary @@ -130,6 +129,10 @@ jobs: docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype + - run: + name: Get codecov + command: | + pip install --no-cache-dir codecov - run: name: Download test data no_output_timeout: 20m @@ -172,6 +175,10 @@ jobs: docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype + - run: + name: Get codecov + command: | + pip install --no-cache-dir codecov - run: name: Download test data no_output_timeout: 20m @@ -214,6 +221,10 @@ jobs: docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype + - run: + name: Get codecov + command: | + pip install --no-cache-dir codecov - run: name: Download test data no_output_timeout: 20m @@ -256,6 +267,10 @@ jobs: docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype + - run: + name: Get codecov + command: | + pip install --no-cache-dir codecov - run: name: Download test data no_output_timeout: 20m @@ -298,6 +313,10 @@ jobs: docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype + - run: + name: Get codecov + command: | + pip install --no-cache-dir codecov - run: name: Download test data no_output_timeout: 20m @@ -340,6 +359,10 @@ jobs: docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype + - run: + name: Get codecov + command: | + pip install --no-cache-dir codecov - run: name: Download test data no_output_timeout: 20m @@ -382,6 +405,10 @@ jobs: docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype + - run: + name: Get codecov + command: | + pip install --no-cache-dir codecov - run: name: Download test data no_output_timeout: 20m @@ -424,6 +451,10 @@ jobs: docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype + - run: + name: Get codecov + command: | + pip install --no-cache-dir codecov - run: name: Download test data no_output_timeout: 20m @@ -466,6 +497,10 @@ jobs: docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - checkout: path: /home/circleci/nipype + - run: + name: Get codecov + command: | + pip install --no-cache-dir codecov - run: name: Download test data no_output_timeout: 20m From 83a15306d3a999639bd6e8528d03f0dab8b0a1b8 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Sat, 20 Jan 2018 20:57:04 -0600 Subject: [PATCH 330/365] CI: Use runtimes to regroup tests Runtimes aggregated from https://circleci.com/workflow-run/721d8f15-dac6-4b7d-87c9-7dbeb1709f1a Two workflows require pre-run of other workflows. --- .circleci/config.yml | 269 ++----------------------------------------- 1 file changed, 12 insertions(+), 257 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fb4ca226f7..b934029823 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -160,53 +160,7 @@ jobs: - store_artifacts: path: /home/circleci/work/tests - test_py2_fmri_spm_nested_multiproc_l2: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 - working_directory: /home/circleci/nipype - steps: - - attach_workspace: - at: /tmp - - run: - name: Load saved Docker images. - no_output_timeout: 60m - command: | - docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - checkout: - path: /home/circleci/nipype - - run: - name: Get codecov - command: | - pip install --no-cache-dir codecov - - run: - name: Download test data - no_output_timeout: 20m - working_directory: /home/circleci/examples - environment: - OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" - command: | - export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj - - export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz - - export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - - run: - name: Run tests - no_output_timeout: 2h - environment: - WORKDIR: /home/circleci/work - command: | - mkdir -p "$WORKDIR" - chmod -R 777 "$WORKDIR" - bash /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh - - store_artifacts: - path: /home/circleci/work/tests - - test_py3_fmri_fsl_feeds_linear_l1: + test_py3_fmri_fsl_spm: machine: # Ubuntu 14.04 with Docker 17.10.0-ce image: circleci/classic:201710-02 @@ -249,56 +203,13 @@ jobs: mkdir -p "$WORKDIR" chmod -R 777 "$WORKDIR" bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh - - store_artifacts: - path: /home/circleci/work/tests - - test_py3_fmri_fsl_reuse_linear_l1: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 - working_directory: /home/circleci/nipype - steps: - - attach_workspace: - at: /tmp - - run: - name: Load saved Docker images. - no_output_timeout: 60m - command: | - docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - checkout: - path: /home/circleci/nipype - - run: - name: Get codecov - command: | - pip install --no-cache-dir codecov - - run: - name: Download test data - no_output_timeout: 20m - working_directory: /home/circleci/examples - environment: - OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" - command: | - export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj - - export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz - - export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - - run: - name: Run tests - no_output_timeout: 2h - environment: - WORKDIR: /home/circleci/work - command: | - mkdir -p "$WORKDIR" - chmod -R 777 "$WORKDIR" bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh + bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh + bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh - store_artifacts: path: /home/circleci/work/tests - test_py3_fmri_spm_dartel_linear_l1: + test_py3_fmri_spm_dartel_linear: machine: # Ubuntu 14.04 with Docker 17.10.0-ce image: circleci/classic:201710-02 @@ -341,148 +252,11 @@ jobs: mkdir -p "$WORKDIR" chmod -R 777 "$WORKDIR" bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh - - store_artifacts: - path: /home/circleci/work/tests - - test_py3_fmri_spm_dartel_linear_l2: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 - working_directory: /home/circleci/nipype - steps: - - attach_workspace: - at: /tmp - - run: - name: Load saved Docker images. - no_output_timeout: 60m - command: | - docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - checkout: - path: /home/circleci/nipype - - run: - name: Get codecov - command: | - pip install --no-cache-dir codecov - - run: - name: Download test data - no_output_timeout: 20m - working_directory: /home/circleci/examples - environment: - OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" - command: | - export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj - - export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz - - export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - - run: - name: Run tests - no_output_timeout: 2h - environment: - WORKDIR: /home/circleci/work - command: | - mkdir -p "$WORKDIR" - chmod -R 777 "$WORKDIR" bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh - store_artifacts: path: /home/circleci/work/tests - test_py3_fmri_spm_linear_3d: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 - working_directory: /home/circleci/nipype - steps: - - attach_workspace: - at: /tmp - - run: - name: Load saved Docker images. - no_output_timeout: 60m - command: | - docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - checkout: - path: /home/circleci/nipype - - run: - name: Get codecov - command: | - pip install --no-cache-dir codecov - - run: - name: Download test data - no_output_timeout: 20m - working_directory: /home/circleci/examples - environment: - OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" - command: | - export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj - - export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz - - export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - - run: - name: Run tests - no_output_timeout: 2h - environment: - WORKDIR: /home/circleci/work - command: | - mkdir -p "$WORKDIR" - chmod -R 777 "$WORKDIR" - bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh - - store_artifacts: - path: /home/circleci/work/tests - - test_py3_fmri_spm_linear_4d: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 - working_directory: /home/circleci/nipype - steps: - - attach_workspace: - at: /tmp - - run: - name: Load saved Docker images. - no_output_timeout: 60m - command: | - docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - checkout: - path: /home/circleci/nipype - - run: - name: Get codecov - command: | - pip install --no-cache-dir codecov - - run: - name: Download test data - no_output_timeout: 20m - working_directory: /home/circleci/examples - environment: - OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" - command: | - export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj - - export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz - - export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - - run: - name: Run tests - no_output_timeout: 2h - environment: - WORKDIR: /home/circleci/work - command: | - mkdir -p "$WORKDIR" - chmod -R 777 "$WORKDIR" - bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh - - store_artifacts: - path: /home/circleci/work/tests - - test_py3_fmri_spm_nested_multiproc_l1: + test_fmri_spm_nested_multiproc: machine: # Ubuntu 14.04 with Docker 17.10.0-ce image: circleci/classic:201710-02 @@ -525,6 +299,7 @@ jobs: mkdir -p "$WORKDIR" chmod -R 777 "$WORKDIR" bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh + bash /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh - store_artifacts: path: /home/circleci/work/tests @@ -571,28 +346,13 @@ workflows: - test_pytest: requires: - build_images - - test_py2_fmri_spm_nested_multiproc_l2: - requires: - - build_images - - test_py3_fmri_fsl_feeds_linear_l1: - requires: - - build_images - - test_py3_fmri_fsl_reuse_linear_l1: - requires: - - build_images - - test_py3_fmri_spm_dartel_linear_l1: - requires: - - build_images - - test_py3_fmri_spm_dartel_linear_l2: - requires: - - build_images - - test_py3_fmri_spm_linear_3d: + - test_py3_fmri_fsl_spm: requires: - build_images - - test_py3_fmri_spm_linear_4d: + - test_py3_fmri_spm_dartel_linear: requires: - build_images - - test_py3_fmri_spm_nested_multiproc_l1: + - test_fmri_spm_nested_multiproc: requires: - build_images - deploy: @@ -601,11 +361,6 @@ workflows: only: master requires: - test_pytest - - test_py2_fmri_spm_nested_multiproc_l2 - - test_py3_fmri_fsl_feeds_linear_l1 - - test_py3_fmri_fsl_reuse_linear_l1 - - test_py3_fmri_spm_dartel_linear_l1 - - test_py3_fmri_spm_dartel_linear_l2 - - test_py3_fmri_spm_linear_3d - - test_py3_fmri_spm_linear_4d - - test_py3_fmri_spm_nested_multiproc_l1 + - test_fmri_spm_nested_multiproc + - test_py3_fmri_fsl_spm + - test_py3_fmri_spm_dartel_linear From a5c8228d7a9f9e1cc39c8d3d5e5172ff17c5cf69 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 24 Jan 2018 11:20:47 -0500 Subject: [PATCH 331/365] CI: Move to docker, attempt to use cache-from --- .circleci/config.yml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b934029823..60801dbc80 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,25 +36,25 @@ jobs: - docker/get_base_image.sh build_images: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 + docker: + - image: docker:17.10.0-ce-git working_directory: /home/circleci/nipype steps: + - setup_remote_docker - checkout: path: /home/circleci/nipype - attach_workspace: at: /tmp - - run: - name: Generate Dockerfiles - command: | - make gen-dockerfiles - run: name: Modify Nipype version if necessary command: | if [ "$CIRCLE_TAG" != "" ]; then sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py fi + - run: + name: Generate Dockerfiles + command: | + make gen-dockerfiles - run: name: Get base image (pull or build) no_output_timeout: 60m @@ -65,7 +65,7 @@ jobs: docker pull nipype/nipype:base elif [ "$GET_BASE" == "BUILD" ]; then e=1 && for i in {1..5}; do - docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 + docker build --cache-from=nipype/nipype -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 done && [ "$e" -eq "0" ] else echo "Error: method to get base image not understood" @@ -115,11 +115,11 @@ jobs: - docker/* test_pytest: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 + docker: + - image: docker:17.10.0-ce-git working_directory: /home/circleci/nipype steps: + - setup_remote_docker - attach_workspace: at: /tmp - run: @@ -166,6 +166,7 @@ jobs: image: circleci/classic:201710-02 working_directory: /home/circleci/nipype steps: + - setup_remote_docker - attach_workspace: at: /tmp - run: @@ -210,11 +211,11 @@ jobs: path: /home/circleci/work/tests test_py3_fmri_spm_dartel_linear: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 + docker: + - image: docker:17.10.0-ce-git working_directory: /home/circleci/nipype steps: + - setup_remote_docker - attach_workspace: at: /tmp - run: @@ -257,11 +258,11 @@ jobs: path: /home/circleci/work/tests test_fmri_spm_nested_multiproc: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 + docker: + - image: docker:17.10.0-ce-git working_directory: /home/circleci/nipype steps: + - setup_remote_docker - attach_workspace: at: /tmp - run: From 36e8f69549379eb8675fa41091eee5650a39918a Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 24 Jan 2018 11:23:43 -0500 Subject: [PATCH 332/365] CI: Install dependencies --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 60801dbc80..a717335db3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,6 +51,9 @@ jobs: if [ "$CIRCLE_TAG" != "" ]; then sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py fi + - run: + name: Install build dependencies + command: apk update && apk add make bash - run: name: Generate Dockerfiles command: | From 49f7c690ed15e42237bfab5bee521de5b82f7ff8 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 24 Jan 2018 21:37:57 -0500 Subject: [PATCH 333/365] REV: Restore 610e571 --- .circleci/config.yml | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a717335db3..b934029823 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,28 +36,25 @@ jobs: - docker/get_base_image.sh build_images: - docker: - - image: docker:17.10.0-ce-git + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 working_directory: /home/circleci/nipype steps: - - setup_remote_docker - checkout: path: /home/circleci/nipype - attach_workspace: at: /tmp + - run: + name: Generate Dockerfiles + command: | + make gen-dockerfiles - run: name: Modify Nipype version if necessary command: | if [ "$CIRCLE_TAG" != "" ]; then sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py fi - - run: - name: Install build dependencies - command: apk update && apk add make bash - - run: - name: Generate Dockerfiles - command: | - make gen-dockerfiles - run: name: Get base image (pull or build) no_output_timeout: 60m @@ -68,7 +65,7 @@ jobs: docker pull nipype/nipype:base elif [ "$GET_BASE" == "BUILD" ]; then e=1 && for i in {1..5}; do - docker build --cache-from=nipype/nipype -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 + docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 done && [ "$e" -eq "0" ] else echo "Error: method to get base image not understood" @@ -118,11 +115,11 @@ jobs: - docker/* test_pytest: - docker: - - image: docker:17.10.0-ce-git + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 working_directory: /home/circleci/nipype steps: - - setup_remote_docker - attach_workspace: at: /tmp - run: @@ -169,7 +166,6 @@ jobs: image: circleci/classic:201710-02 working_directory: /home/circleci/nipype steps: - - setup_remote_docker - attach_workspace: at: /tmp - run: @@ -214,11 +210,11 @@ jobs: path: /home/circleci/work/tests test_py3_fmri_spm_dartel_linear: - docker: - - image: docker:17.10.0-ce-git + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 working_directory: /home/circleci/nipype steps: - - setup_remote_docker - attach_workspace: at: /tmp - run: @@ -261,11 +257,11 @@ jobs: path: /home/circleci/work/tests test_fmri_spm_nested_multiproc: - docker: - - image: docker:17.10.0-ce-git + machine: + # Ubuntu 14.04 with Docker 17.10.0-ce + image: circleci/classic:201710-02 working_directory: /home/circleci/nipype steps: - - setup_remote_docker - attach_workspace: at: /tmp - run: From b6932b36b05fa4fffa147c93c370d219a1fcd2d9 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 24 Jan 2018 21:42:44 -0500 Subject: [PATCH 334/365] CI: Build images in each job --- .circleci/config.yml | 199 ++++++++++++++++++++++++++++++++----------- 1 file changed, 150 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b934029823..87052480c4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: - docker/Dockerfile.base-pruned - docker/get_base_image.sh - build_images: + test_pytest: machine: # Ubuntu 14.04 with Docker 17.10.0-ce image: circleci/classic:201710-02 @@ -100,35 +100,6 @@ jobs: --build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype \ && e=0 && break || sleep 15 done && [ "$e" -eq "0" ] - - run: - name: Save Docker images to workspace - no_output_timeout: 60m - command: | - docker save nipype/nipype:base \ - nipype/nipype:latest \ - nipype/nipype:py27 \ - nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-base-latest-py36-py27.tar.gz \ - && du -h /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - persist_to_workspace: - root: /tmp - paths: - - docker/* - - test_pytest: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 - working_directory: /home/circleci/nipype - steps: - - attach_workspace: - at: /tmp - - run: - name: Load saved Docker images. - no_output_timeout: 60m - command: | - docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - checkout: - path: /home/circleci/nipype - run: name: Get codecov command: | @@ -166,15 +137,50 @@ jobs: image: circleci/classic:201710-02 working_directory: /home/circleci/nipype steps: + - checkout: + path: /home/circleci/nipype - attach_workspace: at: /tmp - run: - name: Load saved Docker images. + name: Generate Dockerfiles + command: | + make gen-dockerfiles + - run: + name: Modify Nipype version if necessary + command: | + if [ "$CIRCLE_TAG" != "" ]; then + sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py + fi + - run: + name: Get base image (pull or build) no_output_timeout: 60m command: | - docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - checkout: - path: /home/circleci/nipype + source /tmp/docker/get_base_image.sh + if [ "$GET_BASE" == "PULL" ]; then + echo "Pulling base image ..." + docker pull nipype/nipype:base + elif [ "$GET_BASE" == "BUILD" ]; then + e=1 && for i in {1..5}; do + docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] + else + echo "Error: method to get base image not understood" + exit 1 + fi + - run: + name: Build main image (py36) + no_output_timeout: 60m + command: | + e=1 && for i in {1..5}; do + docker build \ + --rm=false \ + --tag nipype/nipype:latest \ + --tag nipype/nipype:py36 \ + --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ + --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ + && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] - run: name: Get codecov command: | @@ -215,15 +221,50 @@ jobs: image: circleci/classic:201710-02 working_directory: /home/circleci/nipype steps: + - checkout: + path: /home/circleci/nipype - attach_workspace: at: /tmp - run: - name: Load saved Docker images. + name: Generate Dockerfiles + command: | + make gen-dockerfiles + - run: + name: Modify Nipype version if necessary + command: | + if [ "$CIRCLE_TAG" != "" ]; then + sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py + fi + - run: + name: Get base image (pull or build) no_output_timeout: 60m command: | - docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - checkout: - path: /home/circleci/nipype + source /tmp/docker/get_base_image.sh + if [ "$GET_BASE" == "PULL" ]; then + echo "Pulling base image ..." + docker pull nipype/nipype:base + elif [ "$GET_BASE" == "BUILD" ]; then + e=1 && for i in {1..5}; do + docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] + else + echo "Error: method to get base image not understood" + exit 1 + fi + - run: + name: Build main image (py36) + no_output_timeout: 60m + command: | + e=1 && for i in {1..5}; do + docker build \ + --rm=false \ + --tag nipype/nipype:latest \ + --tag nipype/nipype:py36 \ + --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ + --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ + && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] - run: name: Get codecov command: | @@ -262,15 +303,65 @@ jobs: image: circleci/classic:201710-02 working_directory: /home/circleci/nipype steps: + - checkout: + path: /home/circleci/nipype - attach_workspace: at: /tmp - run: - name: Load saved Docker images. + name: Generate Dockerfiles + command: | + make gen-dockerfiles + - run: + name: Modify Nipype version if necessary + command: | + if [ "$CIRCLE_TAG" != "" ]; then + sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py + fi + - run: + name: Get base image (pull or build) no_output_timeout: 60m command: | - docker load < /tmp/docker/nipype-base-latest-py36-py27.tar.gz - - checkout: - path: /home/circleci/nipype + source /tmp/docker/get_base_image.sh + if [ "$GET_BASE" == "PULL" ]; then + echo "Pulling base image ..." + docker pull nipype/nipype:base + elif [ "$GET_BASE" == "BUILD" ]; then + e=1 && for i in {1..5}; do + docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] + else + echo "Error: method to get base image not understood" + exit 1 + fi + - run: + name: Build main image (py36) + no_output_timeout: 60m + command: | + e=1 && for i in {1..5}; do + docker build \ + --rm=false \ + --tag nipype/nipype:latest \ + --tag nipype/nipype:py36 \ + --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ + --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ + && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] + - run: + name: Build main image (py27) + no_output_timeout: 60m + command: | + e=1 && for i in {1..5}; do + docker build \ + --rm=false \ + --tag nipype/nipype:py27 \ + --build-arg PYTHON_VERSION_MAJOR=2 \ + --build-arg PYTHON_VERSION_MINOR=7 \ + --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ + --build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype \ + && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] - run: name: Get codecov command: | @@ -302,6 +393,19 @@ jobs: bash /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh - store_artifacts: path: /home/circleci/work/tests + - run: + name: Save Docker images to workspace + no_output_timeout: 60m + command: | + docker save nipype/nipype:base \ + nipype/nipype:latest \ + nipype/nipype:py27 \ + nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-base-latest-py36-py27.tar.gz \ + && du -h /tmp/docker/nipype-base-latest-py36-py27.tar.gz + - persist_to_workspace: + root: /tmp + paths: + - docker/* deploy: docker: @@ -340,21 +444,18 @@ workflows: build_test_deploy: jobs: - compare_base_dockerfiles - - build_images: - requires: - - compare_base_dockerfiles - test_pytest: requires: - - build_images + - compare_base_dockerfiles - test_py3_fmri_fsl_spm: requires: - - build_images + - compare_base_dockerfiles - test_py3_fmri_spm_dartel_linear: requires: - - build_images + - compare_base_dockerfiles - test_fmri_spm_nested_multiproc: requires: - - build_images + - compare_base_dockerfiles - deploy: filters: branches: From 7e6760b64eb797dd8ce6c6fbe95fb665a09f5ade Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 24 Jan 2018 21:50:35 -0500 Subject: [PATCH 335/365] TEST: Move DARTEL to MultiProc --- .circleci/config.yml | 10 +++++----- ..._l1.sh => test_py3_fmri_spm_dartel_multiproc_l1.sh} | 2 +- ..._l2.sh => test_py3_fmri_spm_dartel_multiproc_l2.sh} | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) rename .circleci/{test_py3_fmri_spm_dartel_linear_l1.sh => test_py3_fmri_spm_dartel_multiproc_l1.sh} (81%) rename .circleci/{test_py3_fmri_spm_dartel_linear_l2.sh => test_py3_fmri_spm_dartel_multiproc_l2.sh} (80%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 87052480c4..a4245c7959 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -215,7 +215,7 @@ jobs: - store_artifacts: path: /home/circleci/work/tests - test_py3_fmri_spm_dartel_linear: + test_py3_fmri_spm_dartel_multiproc: machine: # Ubuntu 14.04 with Docker 17.10.0-ce image: circleci/classic:201710-02 @@ -292,8 +292,8 @@ jobs: command: | mkdir -p "$WORKDIR" chmod -R 777 "$WORKDIR" - bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh - bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh + bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh + bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh - store_artifacts: path: /home/circleci/work/tests @@ -450,7 +450,7 @@ workflows: - test_py3_fmri_fsl_spm: requires: - compare_base_dockerfiles - - test_py3_fmri_spm_dartel_linear: + - test_py3_fmri_spm_dartel_multiproc: requires: - compare_base_dockerfiles - test_fmri_spm_nested_multiproc: @@ -464,4 +464,4 @@ workflows: - test_pytest - test_fmri_spm_nested_multiproc - test_py3_fmri_fsl_spm - - test_py3_fmri_spm_dartel_linear + - test_py3_fmri_spm_dartel_multiproc diff --git a/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh b/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh similarity index 81% rename from .circleci/test_py3_fmri_spm_dartel_linear_l1.sh rename to .circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh index d10550f2ed..ac17336b4b 100644 --- a/.circleci/test_py3_fmri_spm_dartel_linear_l1.sh +++ b/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh @@ -4,7 +4,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh -docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ level1 +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel MultiProc /data/examples/ level1 exitcode=$? . $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh b/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh similarity index 80% rename from .circleci/test_py3_fmri_spm_dartel_linear_l2.sh rename to .circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh index 398a308df6..ad4326eb47 100644 --- a/.circleci/test_py3_fmri_spm_dartel_linear_l2.sh +++ b/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh @@ -4,7 +4,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh -docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ l2pipeline +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel MultiProc /data/examples/ l2pipeline exitcode=$? . $DIR/test_complete.sh From 1e9e54182276fe8ccb8e9e09cde2cd977732a212 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 25 Jan 2018 11:03:01 -0500 Subject: [PATCH 336/365] CI: Split tests in config, for timing steps --- .circleci/config.yml | 78 ++++++++++++++++++++++++++++-------- .circleci/pytests.sh | 14 ------- .circleci/test_py2_pytest.sh | 10 +++++ .circleci/test_py3_docs.sh | 10 +++++ .circleci/test_py3_pytest.sh | 10 +++++ 5 files changed, 91 insertions(+), 31 deletions(-) delete mode 100644 .circleci/pytests.sh create mode 100644 .circleci/test_py2_pytest.sh create mode 100644 .circleci/test_py3_docs.sh create mode 100644 .circleci/test_py3_pytest.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index a4245c7959..c8de3f66ca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -120,14 +120,21 @@ jobs: export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - run: - name: Run tests - no_output_timeout: 2h + name: Prepare working directory environment: WORKDIR: /home/circleci/work command: | mkdir -p "$WORKDIR" chmod -R 777 "$WORKDIR" - bash /home/circleci/nipype/.circleci/pytests.sh + - run: + name: Run pytests (py36) + command: bash /home/circleci/nipype/.circleci/test_py3_pytest.sh + - run: + name: Run pytests (py27) + command: bash /home/circleci/nipype/.circleci/test_py2_pytest.sh + - run: + name: Build docs (py36) + command: bash /home/circleci/nipype/.circleci/test_py3_docs.sh - store_artifacts: path: /home/circleci/work/tests @@ -201,17 +208,36 @@ jobs: export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - run: - name: Run tests - no_output_timeout: 2h + name: Prepare working directory environment: WORKDIR: /home/circleci/work command: | mkdir -p "$WORKDIR" chmod -R 777 "$WORKDIR" - bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh - bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh - bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh - bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh + - run: + name: Run FSL FEEDS pipeline (py36) + no_output_timeout: 40m + environment: + WORKDIR: /home/circleci/work + command: bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh + - run: + name: Run FSL reuse pipeline (py36) + no_output_timeout: 40m + environment: + WORKDIR: /home/circleci/work + command: bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh + - run: + name: Run SPM test workflow - 3D inputs (py36) + no_output_timeout: 40m + environment: + WORKDIR: /home/circleci/work + command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh + - run: + name: Run SPM test workflow - 4D inputs (py36) + no_output_timeout: 40m + environment: + WORKDIR: /home/circleci/work + command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh - store_artifacts: path: /home/circleci/work/tests @@ -285,15 +311,24 @@ jobs: export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - run: - name: Run tests - no_output_timeout: 2h + name: Prepare working directory environment: WORKDIR: /home/circleci/work command: | mkdir -p "$WORKDIR" chmod -R 777 "$WORKDIR" - bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh - bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh + - run: + name: Run SPM DARTEL Level 1 pipeline (py36) + no_output_timeout: 1h + environment: + WORKDIR: /home/circleci/work + command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh + - run: + name: Run SPM DARTEL Level 2 pipeline (py36) + no_output_timeout: 30m + environment: + WORKDIR: /home/circleci/work + command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh - store_artifacts: path: /home/circleci/work/tests @@ -382,15 +417,24 @@ jobs: export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - run: - name: Run tests - no_output_timeout: 2h + name: Prepare working directory environment: WORKDIR: /home/circleci/work command: | mkdir -p "$WORKDIR" chmod -R 777 "$WORKDIR" - bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh - bash /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh + - run: + name: Run SPM Nested Level 1 pipeline (py36) + no_output_timeout: 1h + environment: + WORKDIR: /home/circleci/work + command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh + - run: + name: Run SPM Nested Level 2 pipeline (py27) + no_output_timeout: 30m + environment: + WORKDIR: /home/circleci/work + command: bash /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh - store_artifacts: path: /home/circleci/work/tests - run: diff --git a/.circleci/pytests.sh b/.circleci/pytests.sh deleted file mode 100644 index 7d8bb27553..0000000000 --- a/.circleci/pytests.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - -# These tests are manually balanced based on previous build timings. -# They may need to be rebalanced in the future. -docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py36" /usr/bin/run_pytests.sh \ -&& docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py27" /usr/bin/run_pytests.sh \ -&& docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /src/nipype/doc "${DOCKER_IMAGE}:py36" /usr/bin/run_builddocs.sh -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py2_pytest.sh b/.circleci/test_py2_pytest.sh new file mode 100644 index 0000000000..b89f44b046 --- /dev/null +++ b/.circleci/test_py2_pytest.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py27" /usr/bin/run_pytests.sh +exitcode=$? + +. $DIR/test_complete.sh diff --git a/.circleci/test_py3_docs.sh b/.circleci/test_py3_docs.sh new file mode 100644 index 0000000000..951a096f22 --- /dev/null +++ b/.circleci/test_py3_docs.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /src/nipype/doc "${DOCKER_IMAGE}:py36" /usr/bin/run_builddocs.sh +exitcode=$? + +. $DIR/test_complete.sh diff --git a/.circleci/test_py3_pytest.sh b/.circleci/test_py3_pytest.sh new file mode 100644 index 0000000000..dcb91209a3 --- /dev/null +++ b/.circleci/test_py3_pytest.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +. $DIR/test_init.sh + +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py36" /usr/bin/run_pytests.sh +exitcode=$? + +. $DIR/test_complete.sh From d0848ad0c1d629cd4e964c852c719cd0f33d7c1b Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 25 Jan 2018 11:03:55 -0500 Subject: [PATCH 337/365] Remove old test script --- .circleci/tests.sh | 54 ---------------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 .circleci/tests.sh diff --git a/.circleci/tests.sh b/.circleci/tests.sh deleted file mode 100644 index f55a3249d7..0000000000 --- a/.circleci/tests.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# Balance nipype testing workflows across CircleCI build nodes -# - -# Setting # $ help set -set -e # Exit immediately if a command exits with a non-zero status. -set -u # Treat unset variables as an error when substituting. -set -x # Print command traces before executing command. - -if [ "${CIRCLE_NODE_TOTAL:-}" != "4" ]; then - echo "These tests were designed to be run at 4x parallelism." - exit 1 -fi - -DOCKER_IMAGE="nipype/nipype" - -# These tests are manually balanced based on previous build timings. -# They may need to be rebalanced in the future. -case ${CIRCLE_NODE_INDEX} in - 0) - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py36" /usr/bin/run_pytests.sh \ - && docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py27" /usr/bin/run_pytests.sh \ - && docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /src/nipype/doc "${DOCKER_IMAGE}:py36" /usr/bin/run_builddocs.sh \ - && docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d \ - && docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d - exitcode=$? - ;; - 1) - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ level1 \ - && docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel Linear /data/examples/ l2pipeline - exitcode=$? - ;; - 2) - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 \ - && docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py27" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline - exitcode=$? - ;; - 3) - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 \ - && docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline \ - && docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow - exitcode=$? - ;; -esac - -# Exit with error if any of the tests failed -if [ "$exitcode" != "0" ]; then exit 1; fi - -codecov --file "${WORKDIR}/tests/coverage*.xml" \ - --root "${HOME}/nipype/" --flags unittests -e CIRCLE_NODE_INDEX - -codecov --file "${WORKDIR}/tests/smoketest*.xml" \ - --root "${HOME}/nipype/" --flags smoketests -e CIRCLE_NODE_INDEX From 3cf0d768cc41cfaf349dacc2b8a013d94e2f0302 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 25 Jan 2018 11:39:29 -0500 Subject: [PATCH 338/365] CI: Re-add WORKDIR variable, timeouts --- .circleci/config.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index c8de3f66ca..0f0113786b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,12 +128,21 @@ jobs: chmod -R 777 "$WORKDIR" - run: name: Run pytests (py36) + no_output_timeout: 30m + environment: + WORKDIR: /home/circleci/work command: bash /home/circleci/nipype/.circleci/test_py3_pytest.sh - run: name: Run pytests (py27) + no_output_timeout: 30m + environment: + WORKDIR: /home/circleci/work command: bash /home/circleci/nipype/.circleci/test_py2_pytest.sh - run: name: Build docs (py36) + no_output_timeout: 30m + environment: + WORKDIR: /home/circleci/work command: bash /home/circleci/nipype/.circleci/test_py3_docs.sh - store_artifacts: path: /home/circleci/work/tests From 98fd2c17f92fba0f808e02fe17f468bad87b7804 Mon Sep 17 00:00:00 2001 From: Jakub Kaczmarzyk Date: Sat, 10 Feb 2018 13:36:15 -0500 Subject: [PATCH 339/365] enh: use yaml pointers to reduce duplication --- .circleci/config.yml | 483 +++++++++++++------------------------------ 1 file changed, 147 insertions(+), 336 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0f0113786b..ee5683f1bd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,3 +1,101 @@ +_machine_kwds: &machine_kwds + image: circleci/classic:201710-02 + +_store_artifacts_kwds: &store_artifacts_kwds + path: /home/circleci/work/tests + +_test_environment: &test_environment + WORKDIR: /home/circleci/work + +_generate_dockerfiles: &generate_dockerfiles + name: Generate Dockerfiles + command: | + make gen-dockerfiles + +_modify_nipype_version: &modify_nipype_version + name: Modify Nipype version if necessary + command: | + if [ "$CIRCLE_TAG" != "" ]; then + sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py + fi + +_get_base_image: &get_base_image + name: Get base image (pull or build) + no_output_timeout: 60m + command: | + source /tmp/docker/get_base_image.sh + if [ "$GET_BASE" == "PULL" ]; then + echo "Pulling base image ..." + docker pull nipype/nipype:base + elif [ "$GET_BASE" == "BUILD" ]; then + e=1 && for i in {1..5}; do + docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] + else + echo "Error: method to get base image not understood" + exit 1 + fi + +_build_main_image_py36: &build_main_image_py36 + name: Build main image (py36) + no_output_timeout: 60m + command: | + e=1 && for i in {1..5}; do + docker build \ + --rm=false \ + --tag nipype/nipype:latest \ + --tag nipype/nipype:py36 \ + --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ + --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ + && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] + +_build_main_image_py27: &build_main_image_py27 + name: Build main image (py27) + no_output_timeout: 60m + command: | + e=1 && for i in {1..5}; do + docker build \ + --rm=false \ + --tag nipype/nipype:py27 \ + --build-arg PYTHON_VERSION_MAJOR=2 \ + --build-arg PYTHON_VERSION_MINOR=7 \ + --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ + --build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype \ + && e=0 && break || sleep 15 + done && [ "$e" -eq "0" ] + +_download_test_data: &_download_test_data + name: Download test data + no_output_timeout: 20m + working_directory: /home/circleci/examples + environment: + OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" + command: | + export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj + + export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz + + export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" + curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz + +_prepare_working_directory: &prepare_working_directory + name: Prepare working directory + environment: *test_environment + command: | + mkdir -p "$WORKDIR" + chmod -R 777 "$WORKDIR" + +_get_codecov: &_get_codecov + name: Get codecov + command: | + pip install --no-cache-dir codecov + + version: 2 jobs: @@ -36,416 +134,129 @@ jobs: - docker/get_base_image.sh test_pytest: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 + machine: *machine_kwds working_directory: /home/circleci/nipype steps: - checkout: path: /home/circleci/nipype - attach_workspace: at: /tmp - - run: - name: Generate Dockerfiles - command: | - make gen-dockerfiles - - run: - name: Modify Nipype version if necessary - command: | - if [ "$CIRCLE_TAG" != "" ]; then - sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py - fi - - run: - name: Get base image (pull or build) - no_output_timeout: 60m - command: | - source /tmp/docker/get_base_image.sh - if [ "$GET_BASE" == "PULL" ]; then - echo "Pulling base image ..." - docker pull nipype/nipype:base - elif [ "$GET_BASE" == "BUILD" ]; then - e=1 && for i in {1..5}; do - docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - else - echo "Error: method to get base image not understood" - exit 1 - fi - - run: - name: Build main image (py36) - no_output_timeout: 60m - command: | - e=1 && for i in {1..5}; do - docker build \ - --rm=false \ - --tag nipype/nipype:latest \ - --tag nipype/nipype:py36 \ - --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ - --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ - && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - - run: - name: Build main image (py27) - no_output_timeout: 60m - command: | - e=1 && for i in {1..5}; do - docker build \ - --rm=false \ - --tag nipype/nipype:py27 \ - --build-arg PYTHON_VERSION_MAJOR=2 \ - --build-arg PYTHON_VERSION_MINOR=7 \ - --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ - --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype \ - && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - - run: - name: Get codecov - command: | - pip install --no-cache-dir codecov - - run: - name: Download test data - no_output_timeout: 20m - working_directory: /home/circleci/examples - environment: - OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" - command: | - export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj - - export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz - - export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - - run: - name: Prepare working directory - environment: - WORKDIR: /home/circleci/work - command: | - mkdir -p "$WORKDIR" - chmod -R 777 "$WORKDIR" + - run: *generate_dockerfiles + - run: *modify_nipype_version + - run: *get_base_image + - run: *build_main_image_py36 + - run: *build_main_image_py27 + - run: *_get_codecov + - run: *_download_test_data + - run: *prepare_working_directory - run: name: Run pytests (py36) no_output_timeout: 30m - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_pytest.sh - run: name: Run pytests (py27) no_output_timeout: 30m - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py2_pytest.sh - run: name: Build docs (py36) no_output_timeout: 30m - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_docs.sh - - store_artifacts: - path: /home/circleci/work/tests + - store_artifacts: *store_artifacts_kwds test_py3_fmri_fsl_spm: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 + machine: *machine_kwds working_directory: /home/circleci/nipype steps: - checkout: path: /home/circleci/nipype - attach_workspace: at: /tmp - - run: - name: Generate Dockerfiles - command: | - make gen-dockerfiles - - run: - name: Modify Nipype version if necessary - command: | - if [ "$CIRCLE_TAG" != "" ]; then - sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py - fi - - run: - name: Get base image (pull or build) - no_output_timeout: 60m - command: | - source /tmp/docker/get_base_image.sh - if [ "$GET_BASE" == "PULL" ]; then - echo "Pulling base image ..." - docker pull nipype/nipype:base - elif [ "$GET_BASE" == "BUILD" ]; then - e=1 && for i in {1..5}; do - docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - else - echo "Error: method to get base image not understood" - exit 1 - fi - - run: - name: Build main image (py36) - no_output_timeout: 60m - command: | - e=1 && for i in {1..5}; do - docker build \ - --rm=false \ - --tag nipype/nipype:latest \ - --tag nipype/nipype:py36 \ - --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ - --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ - && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - - run: - name: Get codecov - command: | - pip install --no-cache-dir codecov - - run: - name: Download test data - no_output_timeout: 20m - working_directory: /home/circleci/examples - environment: - OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" - command: | - export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj - - export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz - - export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - - run: - name: Prepare working directory - environment: - WORKDIR: /home/circleci/work - command: | - mkdir -p "$WORKDIR" - chmod -R 777 "$WORKDIR" + - run: *generate_dockerfiles + - run: *modify_nipype_version + - run: *get_base_image + - run: *build_main_image_py36 + - run: *_get_codecov + - run: *_download_test_data + - run: *prepare_working_directory - run: name: Run FSL FEEDS pipeline (py36) no_output_timeout: 40m - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh - run: name: Run FSL reuse pipeline (py36) no_output_timeout: 40m - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh - run: name: Run SPM test workflow - 3D inputs (py36) no_output_timeout: 40m - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh - run: name: Run SPM test workflow - 4D inputs (py36) no_output_timeout: 40m - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh - - store_artifacts: - path: /home/circleci/work/tests + - store_artifacts: *store_artifacts_kwds test_py3_fmri_spm_dartel_multiproc: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 + machine: *machine_kwds working_directory: /home/circleci/nipype steps: - checkout: path: /home/circleci/nipype - attach_workspace: at: /tmp - - run: - name: Generate Dockerfiles - command: | - make gen-dockerfiles - - run: - name: Modify Nipype version if necessary - command: | - if [ "$CIRCLE_TAG" != "" ]; then - sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py - fi - - run: - name: Get base image (pull or build) - no_output_timeout: 60m - command: | - source /tmp/docker/get_base_image.sh - if [ "$GET_BASE" == "PULL" ]; then - echo "Pulling base image ..." - docker pull nipype/nipype:base - elif [ "$GET_BASE" == "BUILD" ]; then - e=1 && for i in {1..5}; do - docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - else - echo "Error: method to get base image not understood" - exit 1 - fi - - run: - name: Build main image (py36) - no_output_timeout: 60m - command: | - e=1 && for i in {1..5}; do - docker build \ - --rm=false \ - --tag nipype/nipype:latest \ - --tag nipype/nipype:py36 \ - --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ - --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ - && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - - run: - name: Get codecov - command: | - pip install --no-cache-dir codecov - - run: - name: Download test data - no_output_timeout: 20m - working_directory: /home/circleci/examples - environment: - OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" - command: | - export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj - - export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz - - export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - - run: - name: Prepare working directory - environment: - WORKDIR: /home/circleci/work - command: | - mkdir -p "$WORKDIR" - chmod -R 777 "$WORKDIR" + - run: *generate_dockerfiles + - run: *modify_nipype_version + - run: *get_base_image + - run: *build_main_image_py36 + - run: *_get_codecov + - run: *_download_test_data + - run: *prepare_working_directory - run: name: Run SPM DARTEL Level 1 pipeline (py36) no_output_timeout: 1h - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh - run: name: Run SPM DARTEL Level 2 pipeline (py36) no_output_timeout: 30m - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh - - store_artifacts: - path: /home/circleci/work/tests + - store_artifacts: *store_artifacts_kwds test_fmri_spm_nested_multiproc: - machine: - # Ubuntu 14.04 with Docker 17.10.0-ce - image: circleci/classic:201710-02 + machine: *machine_kwds working_directory: /home/circleci/nipype steps: - checkout: path: /home/circleci/nipype - attach_workspace: at: /tmp - - run: - name: Generate Dockerfiles - command: | - make gen-dockerfiles - - run: - name: Modify Nipype version if necessary - command: | - if [ "$CIRCLE_TAG" != "" ]; then - sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py - fi - - run: - name: Get base image (pull or build) - no_output_timeout: 60m - command: | - source /tmp/docker/get_base_image.sh - if [ "$GET_BASE" == "PULL" ]; then - echo "Pulling base image ..." - docker pull nipype/nipype:base - elif [ "$GET_BASE" == "BUILD" ]; then - e=1 && for i in {1..5}; do - docker build -t nipype/nipype:base - < docker/Dockerfile.base && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - else - echo "Error: method to get base image not understood" - exit 1 - fi - - run: - name: Build main image (py36) - no_output_timeout: 60m - command: | - e=1 && for i in {1..5}; do - docker build \ - --rm=false \ - --tag nipype/nipype:latest \ - --tag nipype/nipype:py36 \ - --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ - --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}" /home/circleci/nipype \ - && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - - run: - name: Build main image (py27) - no_output_timeout: 60m - command: | - e=1 && for i in {1..5}; do - docker build \ - --rm=false \ - --tag nipype/nipype:py27 \ - --build-arg PYTHON_VERSION_MAJOR=2 \ - --build-arg PYTHON_VERSION_MINOR=7 \ - --build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ - --build-arg VCS_REF="$(git rev-parse --short HEAD)" \ - --build-arg VERSION="${CIRCLE_TAG}-py27" /home/circleci/nipype \ - && e=0 && break || sleep 15 - done && [ "$e" -eq "0" ] - - run: - name: Get codecov - command: | - pip install --no-cache-dir codecov - - run: - name: Download test data - no_output_timeout: 20m - working_directory: /home/circleci/examples - environment: - OSF_NIPYPE_URL: "https://files.osf.io/v1/resources/nefdp/providers/osfstorage" - command: | - export DATA_NIPYPE_TUTORIAL_URL="${OSF_NIPYPE_URL}/57f4739cb83f6901ed94bf21" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_TUTORIAL_URL" | tar xj - - export DATA_NIPYPE_FSL_COURSE="${OSF_NIPYPE_URL}/57f472cf9ad5a101f977ecfe" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_COURSE" | tar xz - - export DATA_NIPYPE_FSL_FEEDS="${OSF_NIPYPE_URL}/57f473066c613b01f113e7af" - curl -sSL --retry 5 --connect-timeout 15 "$DATA_NIPYPE_FSL_FEEDS" | tar xz - - run: - name: Prepare working directory - environment: - WORKDIR: /home/circleci/work - command: | - mkdir -p "$WORKDIR" - chmod -R 777 "$WORKDIR" + - run: *generate_dockerfiles + - run: *modify_nipype_version + - run: *get_base_image + - run: *build_main_image_py36 + - run: *build_main_image_py27 + - run: *_get_codecov + - run: *_download_test_data + - run: *prepare_working_directory - run: name: Run SPM Nested Level 1 pipeline (py36) no_output_timeout: 1h - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh - run: name: Run SPM Nested Level 2 pipeline (py27) no_output_timeout: 30m - environment: - WORKDIR: /home/circleci/work + environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh - - store_artifacts: - path: /home/circleci/work/tests + - store_artifacts: *store_artifacts_kwds - run: name: Save Docker images to workspace no_output_timeout: 60m From c1487e7e6b9d8142e49503d4ea2200daab606eae Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 13 Feb 2018 21:16:35 -0500 Subject: [PATCH 340/365] TEST: Set WORKDIR if WORKDIR unset --- docker/files/run_examples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/files/run_examples.sh b/docker/files/run_examples.sh index 7959bdb597..1914f53be9 100644 --- a/docker/files/run_examples.sh +++ b/docker/files/run_examples.sh @@ -3,7 +3,7 @@ set -e set -x set -u -WORKDIR=${WORK:-/work} +WORKDIR=${WORKDIR:-/work} arr=$@ tmp_var=$( IFS=$' '; echo "${arr[*]}" ) example_id=${tmp_var//[^A-Za-z0-9_-]/_} From d2048482793dd93120c6211af70b293d38007d94 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 13 Feb 2018 21:24:51 -0500 Subject: [PATCH 341/365] CI: Move codecov into CI step --- .circleci/config.yml | 10 ++++++++++ .circleci/test_complete.sh | 12 ------------ .circleci/test_py2_fmri_spm_nested_multiproc_l2.sh | 3 --- .circleci/test_py2_pytest.sh | 3 --- .circleci/test_py3_docs.sh | 3 --- .circleci/test_py3_fmri_fsl_feeds_linear_l1.sh | 3 --- .circleci/test_py3_fmri_fsl_reuse_linear_l1.sh | 3 --- .circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh | 3 --- .circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh | 3 --- .circleci/test_py3_fmri_spm_linear_3d.sh | 3 --- .circleci/test_py3_fmri_spm_linear_4d.sh | 3 --- .circleci/test_py3_fmri_spm_nested_multiproc_l1.sh | 3 --- .circleci/test_py3_pytest.sh | 3 --- 13 files changed, 10 insertions(+), 45 deletions(-) delete mode 100644 .circleci/test_complete.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index ee5683f1bd..f31cf1ed3b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,6 +95,12 @@ _get_codecov: &_get_codecov command: | pip install --no-cache-dir codecov +_run_codecov: &_run_codecov + name: Run codecov + command: | + codecov --file "$WORKDIR/tests/coverage*.xml" --root "$HOME/nipype" --flags unittests -e "$CIRCLE_JOB" + codecov --file "$WORKDIR/tests/smoketest*.xml" --root "$HOME/nipype" --flags smoketests -e "$CIRCLE_JOB" + version: 2 jobs: @@ -164,6 +170,7 @@ jobs: no_output_timeout: 30m environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_docs.sh + - run: *_run_codecov - store_artifacts: *store_artifacts_kwds test_py3_fmri_fsl_spm: @@ -201,6 +208,7 @@ jobs: no_output_timeout: 40m environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh + - run: *_run_codecov - store_artifacts: *store_artifacts_kwds test_py3_fmri_spm_dartel_multiproc: @@ -228,6 +236,7 @@ jobs: no_output_timeout: 30m environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh + - run: *_run_codecov - store_artifacts: *store_artifacts_kwds test_fmri_spm_nested_multiproc: @@ -256,6 +265,7 @@ jobs: no_output_timeout: 30m environment: *test_environment command: bash /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh + - run: *_run_codecov - store_artifacts: *store_artifacts_kwds - run: name: Save Docker images to workspace diff --git a/.circleci/test_complete.sh b/.circleci/test_complete.sh deleted file mode 100644 index 5c138a2d82..0000000000 --- a/.circleci/test_complete.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# -# Source after running test and storing relevant return code in $exitcode - -# Exit with error if any of the tests failed -if [ "$exitcode" != "0" ]; then exit 1; fi - -codecov --file "${WORKDIR}/tests/coverage*.xml" \ - --root "${HOME}/nipype/" --flags unittests -e SCRIPT_NAME - -codecov --file "${WORKDIR}/tests/smoketest*.xml" \ - --root "${HOME}/nipype/" --flags smoketests -e SCRIPT_NAME diff --git a/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh b/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh index f575e40e0d..3def0151d1 100644 --- a/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh +++ b/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py27" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py2_pytest.sh b/.circleci/test_py2_pytest.sh index b89f44b046..a00a14c659 100644 --- a/.circleci/test_py2_pytest.sh +++ b/.circleci/test_py2_pytest.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py27" /usr/bin/run_pytests.sh -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py3_docs.sh b/.circleci/test_py3_docs.sh index 951a096f22..f2c10a7c7b 100644 --- a/.circleci/test_py3_docs.sh +++ b/.circleci/test_py3_docs.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /src/nipype/doc "${DOCKER_IMAGE}:py36" /usr/bin/run_builddocs.sh -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh b/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh index 435d08738a..6c7eeffc93 100644 --- a/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh +++ b/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh b/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh index 9ac6d77d91..d00c863619 100644 --- a/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh +++ b/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh b/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh index ac17336b4b..52153780c9 100644 --- a/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh +++ b/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel MultiProc /data/examples/ level1 -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh b/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh index ad4326eb47..f86f7aa6e3 100644 --- a/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh +++ b/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel MultiProc /data/examples/ l2pipeline -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_linear_3d.sh b/.circleci/test_py3_fmri_spm_linear_3d.sh index dd3542b542..58a5de6b02 100644 --- a/.circleci/test_py3_fmri_spm_linear_3d.sh +++ b/.circleci/test_py3_fmri_spm_linear_3d.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_linear_4d.sh b/.circleci/test_py3_fmri_spm_linear_4d.sh index 05a21fc786..5d18e977c0 100644 --- a/.circleci/test_py3_fmri_spm_linear_4d.sh +++ b/.circleci/test_py3_fmri_spm_linear_4d.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh b/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh index de1dcd77fb..7be9bd5b75 100644 --- a/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh +++ b/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 -exitcode=$? - -. $DIR/test_complete.sh diff --git a/.circleci/test_py3_pytest.sh b/.circleci/test_py3_pytest.sh index dcb91209a3..bcae56ecf2 100644 --- a/.circleci/test_py3_pytest.sh +++ b/.circleci/test_py3_pytest.sh @@ -5,6 +5,3 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" . $DIR/test_init.sh docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py36" /usr/bin/run_pytests.sh -exitcode=$? - -. $DIR/test_complete.sh From e5be9ac6808d8d2e571bc4ec2cf0ef018578cdeb Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 13 Feb 2018 21:36:11 -0500 Subject: [PATCH 342/365] CI: Replace test_init with DOCKER_IMAGE, -ux --- .circleci/config.yml | 23 ++++++++++--------- .circleci/test_init.sh | 12 ---------- .../test_py2_fmri_spm_nested_multiproc_l2.sh | 4 ---- .circleci/test_py2_pytest.sh | 4 ---- .circleci/test_py3_docs.sh | 4 ---- .../test_py3_fmri_fsl_feeds_linear_l1.sh | 4 ---- .../test_py3_fmri_fsl_reuse_linear_l1.sh | 4 ---- .../test_py3_fmri_spm_dartel_multiproc_l1.sh | 4 ---- .../test_py3_fmri_spm_dartel_multiproc_l2.sh | 4 ---- .circleci/test_py3_fmri_spm_linear_3d.sh | 4 ---- .circleci/test_py3_fmri_spm_linear_4d.sh | 4 ---- .../test_py3_fmri_spm_nested_multiproc_l1.sh | 4 ---- .circleci/test_py3_pytest.sh | 4 ---- 13 files changed, 12 insertions(+), 67 deletions(-) delete mode 100644 .circleci/test_init.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index f31cf1ed3b..267d9f448d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,7 @@ _store_artifacts_kwds: &store_artifacts_kwds _test_environment: &test_environment WORKDIR: /home/circleci/work + DOCKER_IMAGE: "nipype/nipype" _generate_dockerfiles: &generate_dockerfiles name: Generate Dockerfiles @@ -159,17 +160,17 @@ jobs: name: Run pytests (py36) no_output_timeout: 30m environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py3_pytest.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py3_pytest.sh - run: name: Run pytests (py27) no_output_timeout: 30m environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py2_pytest.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py2_pytest.sh - run: name: Build docs (py36) no_output_timeout: 30m environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py3_docs.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py3_docs.sh - run: *_run_codecov - store_artifacts: *store_artifacts_kwds @@ -192,22 +193,22 @@ jobs: name: Run FSL FEEDS pipeline (py36) no_output_timeout: 40m environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh - run: name: Run FSL reuse pipeline (py36) no_output_timeout: 40m environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh - run: name: Run SPM test workflow - 3D inputs (py36) no_output_timeout: 40m environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_3d.sh - run: name: Run SPM test workflow - 4D inputs (py36) no_output_timeout: 40m environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh - run: *_run_codecov - store_artifacts: *store_artifacts_kwds @@ -230,12 +231,12 @@ jobs: name: Run SPM DARTEL Level 1 pipeline (py36) no_output_timeout: 1h environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh - run: name: Run SPM DARTEL Level 2 pipeline (py36) no_output_timeout: 30m environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh - run: *_run_codecov - store_artifacts: *store_artifacts_kwds @@ -259,12 +260,12 @@ jobs: name: Run SPM Nested Level 1 pipeline (py36) no_output_timeout: 1h environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh - run: name: Run SPM Nested Level 2 pipeline (py27) no_output_timeout: 30m environment: *test_environment - command: bash /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh + command: bash -ux /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh - run: *_run_codecov - store_artifacts: *store_artifacts_kwds - run: diff --git a/.circleci/test_init.sh b/.circleci/test_init.sh deleted file mode 100644 index 373d5efe7a..0000000000 --- a/.circleci/test_init.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# -# Source before running tests - -# Setting # $ help set -set -e # Exit immediately if a command exits with a non-zero status. -set -u # Treat unset variables as an error when substituting. -set -x # Print command traces before executing command. - -export DOCKER_IMAGE="nipype/nipype" - -export SCRIPT_NAME=`basename $0` diff --git a/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh b/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh index 3def0151d1..1aa2a4f8c5 100644 --- a/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh +++ b/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py27" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ l2pipeline diff --git a/.circleci/test_py2_pytest.sh b/.circleci/test_py2_pytest.sh index a00a14c659..6ea0ddedfc 100644 --- a/.circleci/test_py2_pytest.sh +++ b/.circleci/test_py2_pytest.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py27" /usr/bin/run_pytests.sh diff --git a/.circleci/test_py3_docs.sh b/.circleci/test_py3_docs.sh index f2c10a7c7b..a050caf66c 100644 --- a/.circleci/test_py3_docs.sh +++ b/.circleci/test_py3_docs.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /src/nipype/doc "${DOCKER_IMAGE}:py36" /usr/bin/run_builddocs.sh diff --git a/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh b/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh index 6c7eeffc93..9666829b74 100644 --- a/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh +++ b/.circleci/test_py3_fmri_fsl_feeds_linear_l1.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_feeds Linear /data/examples/ l1pipeline diff --git a/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh b/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh index d00c863619..48be49d80d 100644 --- a/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh +++ b/.circleci/test_py3_fmri_fsl_reuse_linear_l1.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_fsl_reuse Linear /data/examples/ level1_workflow diff --git a/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh b/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh index 52153780c9..4208eed506 100644 --- a/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh +++ b/.circleci/test_py3_fmri_spm_dartel_multiproc_l1.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel MultiProc /data/examples/ level1 diff --git a/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh b/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh index f86f7aa6e3..86119e7654 100644 --- a/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh +++ b/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_dartel MultiProc /data/examples/ l2pipeline diff --git a/.circleci/test_py3_fmri_spm_linear_3d.sh b/.circleci/test_py3_fmri_spm_linear_3d.sh index 58a5de6b02..27c2c92a1a 100644 --- a/.circleci/test_py3_fmri_spm_linear_3d.sh +++ b/.circleci/test_py3_fmri_spm_linear_3d.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow3d diff --git a/.circleci/test_py3_fmri_spm_linear_4d.sh b/.circleci/test_py3_fmri_spm_linear_4d.sh index 5d18e977c0..cd255d60ca 100644 --- a/.circleci/test_py3_fmri_spm_linear_4d.sh +++ b/.circleci/test_py3_fmri_spm_linear_4d.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh test_spm Linear /data/examples/ workflow4d diff --git a/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh b/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh index 7be9bd5b75..a6d2133a42 100644 --- a/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh +++ b/.circleci/test_py3_fmri_spm_nested_multiproc_l1.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e NIPYPE_NUMBER_OF_CPUS=4 "${DOCKER_IMAGE}:py36" /usr/bin/run_examples.sh fmri_spm_nested MultiProc /data/examples/ level1 diff --git a/.circleci/test_py3_pytest.sh b/.circleci/test_py3_pytest.sh index bcae56ecf2..545f430308 100644 --- a/.circleci/test_py3_pytest.sh +++ b/.circleci/test_py3_pytest.sh @@ -1,7 +1,3 @@ #!/bin/bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -. $DIR/test_init.sh - docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py36" /usr/bin/run_pytests.sh From 60d822b84a764b8a25e2da8792cd0a99ed6cf8d0 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 13 Feb 2018 21:51:49 -0500 Subject: [PATCH 343/365] ENH: Move doc building, save artifacts --- .circleci/config.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 267d9f448d..baa1da9eef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -166,11 +166,6 @@ jobs: no_output_timeout: 30m environment: *test_environment command: bash -ux /home/circleci/nipype/.circleci/test_py2_pytest.sh - - run: - name: Build docs (py36) - no_output_timeout: 30m - environment: *test_environment - command: bash -ux /home/circleci/nipype/.circleci/test_py3_docs.sh - run: *_run_codecov - store_artifacts: *store_artifacts_kwds @@ -268,6 +263,13 @@ jobs: command: bash -ux /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh - run: *_run_codecov - store_artifacts: *store_artifacts_kwds + - run: + name: Build docs (py36) + no_output_timeout: 30m + environment: *test_environment + command: bash -ux /home/circleci/nipype/.circleci/test_py3_docs.sh + - store_artifacts: + path: /home/circleci/work/docs - run: name: Save Docker images to workspace no_output_timeout: 60m From e32cbccb1c4c7747d2364aef947c5f8bcac1f05b Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 13 Feb 2018 22:29:06 -0500 Subject: [PATCH 344/365] CI: Run codecov in WORKDIR --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index baa1da9eef..67ccee11d0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -98,6 +98,7 @@ _get_codecov: &_get_codecov _run_codecov: &_run_codecov name: Run codecov + environment: *test_environment command: | codecov --file "$WORKDIR/tests/coverage*.xml" --root "$HOME/nipype" --flags unittests -e "$CIRCLE_JOB" codecov --file "$WORKDIR/tests/smoketest*.xml" --root "$HOME/nipype" --flags smoketests -e "$CIRCLE_JOB" From a06530eaad35ace1e96a8ef5ad30f337280cf3c9 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 14 Feb 2018 08:46:33 -0500 Subject: [PATCH 345/365] CI: Split coverage and smoke tests, un-quote asterisks --- .circleci/config.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67ccee11d0..78443e6ff0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,12 +96,17 @@ _get_codecov: &_get_codecov command: | pip install --no-cache-dir codecov -_run_codecov: &_run_codecov - name: Run codecov +_run_codecov_coverage: &_run_codecov_coverage + name: Run codecov (coverage) environment: *test_environment command: | - codecov --file "$WORKDIR/tests/coverage*.xml" --root "$HOME/nipype" --flags unittests -e "$CIRCLE_JOB" - codecov --file "$WORKDIR/tests/smoketest*.xml" --root "$HOME/nipype" --flags smoketests -e "$CIRCLE_JOB" + codecov --file $WORKDIR/tests/coverage*.xml --root "$HOME/nipype" --flags unittests -e CIRCLE_JOB + +_run_codecov_smoke: &_run_codecov_smoke + name: Run codecov (smoke tests) + environment: *test_environment + command: | + codecov --file $WORKDIR/tests/smoketest*.xml --root "$HOME/nipype" --flags smoketests -e CIRCLE_JOB version: 2 @@ -167,7 +172,7 @@ jobs: no_output_timeout: 30m environment: *test_environment command: bash -ux /home/circleci/nipype/.circleci/test_py2_pytest.sh - - run: *_run_codecov + - run: *_run_codecov_coverage - store_artifacts: *store_artifacts_kwds test_py3_fmri_fsl_spm: @@ -205,7 +210,7 @@ jobs: no_output_timeout: 40m environment: *test_environment command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_linear_4d.sh - - run: *_run_codecov + - run: *_run_codecov_smoke - store_artifacts: *store_artifacts_kwds test_py3_fmri_spm_dartel_multiproc: @@ -233,7 +238,7 @@ jobs: no_output_timeout: 30m environment: *test_environment command: bash -ux /home/circleci/nipype/.circleci/test_py3_fmri_spm_dartel_multiproc_l2.sh - - run: *_run_codecov + - run: *_run_codecov_smoke - store_artifacts: *store_artifacts_kwds test_fmri_spm_nested_multiproc: @@ -262,7 +267,7 @@ jobs: no_output_timeout: 30m environment: *test_environment command: bash -ux /home/circleci/nipype/.circleci/test_py2_fmri_spm_nested_multiproc_l2.sh - - run: *_run_codecov + - run: *_run_codecov_smoke - store_artifacts: *store_artifacts_kwds - run: name: Build docs (py36) From a9c170a189a46a444725bbd1bd2f23cf701c03a3 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 14 Feb 2018 09:56:03 -0500 Subject: [PATCH 346/365] CI: Do not save docker images pointlessly --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 78443e6ff0..b18f3998ed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -277,18 +277,20 @@ jobs: - store_artifacts: path: /home/circleci/work/docs - run: - name: Save Docker images to workspace + name: Save Docker images to workspace if on master no_output_timeout: 60m command: | + if [ "$CIRCLE_BRANCH" = "master" -a -z "$CIRCLE_PULL_REQUEST" ]; then docker save nipype/nipype:base \ nipype/nipype:latest \ nipype/nipype:py27 \ nipype/nipype:py36 | gzip -1 > /tmp/docker/nipype-base-latest-py36-py27.tar.gz \ && du -h /tmp/docker/nipype-base-latest-py36-py27.tar.gz + fi - persist_to_workspace: root: /tmp paths: - - docker/* + - docker deploy: docker: From f28c47942a159f6e1d3c4f8eccdec60280d4978f Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 14 Feb 2018 13:06:50 -0500 Subject: [PATCH 347/365] CI: Store test results --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b18f3998ed..e9bcc0657e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -174,6 +174,7 @@ jobs: command: bash -ux /home/circleci/nipype/.circleci/test_py2_pytest.sh - run: *_run_codecov_coverage - store_artifacts: *store_artifacts_kwds + - store_test_results: *store_artifacts_kwds test_py3_fmri_fsl_spm: machine: *machine_kwds From 8982b27ddde2b3c6759182222bb7d2c61d680b82 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 14 Feb 2018 14:52:06 -0500 Subject: [PATCH 348/365] CI: Update environment in attempt to bump codecov --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e9bcc0657e..0f2077a3ab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,7 @@ _store_artifacts_kwds: &store_artifacts_kwds _test_environment: &test_environment WORKDIR: /home/circleci/work DOCKER_IMAGE: "nipype/nipype" + CIRCLE_PR_NUMBER: "${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}" _generate_dockerfiles: &generate_dockerfiles name: Generate Dockerfiles From d424f919d0eeeced4ce28c2a5eb16b05fad0e5bb Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Wed, 14 Feb 2018 16:31:45 -0500 Subject: [PATCH 349/365] CI: Attempt #2 setting PR number --- .circleci/config.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0f2077a3ab..569a18fc20 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,13 @@ _store_artifacts_kwds: &store_artifacts_kwds _test_environment: &test_environment WORKDIR: /home/circleci/work DOCKER_IMAGE: "nipype/nipype" - CIRCLE_PR_NUMBER: "${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}" + +_set_pr_number: &set_pr_number + name: Set PR number + command: | + echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV + source $BASH_ENV + echo $CIRCLE_PR_NUMBER _generate_dockerfiles: &generate_dockerfiles name: Generate Dockerfiles @@ -155,6 +161,7 @@ jobs: path: /home/circleci/nipype - attach_workspace: at: /tmp + - run: *set_pr_number - run: *generate_dockerfiles - run: *modify_nipype_version - run: *get_base_image @@ -185,6 +192,7 @@ jobs: path: /home/circleci/nipype - attach_workspace: at: /tmp + - run: *set_pr_number - run: *generate_dockerfiles - run: *modify_nipype_version - run: *get_base_image @@ -223,6 +231,7 @@ jobs: path: /home/circleci/nipype - attach_workspace: at: /tmp + - run: *set_pr_number - run: *generate_dockerfiles - run: *modify_nipype_version - run: *get_base_image @@ -251,6 +260,7 @@ jobs: path: /home/circleci/nipype - attach_workspace: at: /tmp + - run: *set_pr_number - run: *generate_dockerfiles - run: *modify_nipype_version - run: *get_base_image From 832fecfb3a646645335e5b3b5f594f22eb829d7b Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 15 Feb 2018 19:45:49 -0500 Subject: [PATCH 350/365] RF: Update and factor mount table parsing code --- nipype/utils/filemanip.py | 59 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 6773d19d8b..842ea9f916 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -275,49 +275,48 @@ def hash_timestamp(afile): return md5hex -def _generate_cifs_table(): - """Construct a reverse-length-ordered list of mount points that - fall under a CIFS mount. +def _parse_mount_table(exit_code, output): + """Parses the output of ``mount`` to produce (path, fs_type) pairs - This precomputation allows efficient checking for whether a given path - would be on a CIFS filesystem. - - On systems without a ``mount`` command, or with no CIFS mounts, returns an - empty list. + Separated from _generate_cifs_table to enable testing logic with real + outputs """ - exit_code, output = sp.getstatusoutput("mount") # Not POSIX if exit_code != 0: return [] + # Linux mount example: sysfs on /sys type sysfs (rw,nosuid,nodev,noexec) + # ^^^^ ^^^^^ + # OSX mount example: /dev/disk2 on / (hfs, local, journaled) + # ^ ^^^ + pattern = re.compile(r'.*? on (/.*?) (?:type |\()([^\s,]+)(?:, |\)| )') + # (path, fstype) tuples, sorted by path length (longest first) - mount_info = sorted( - (line.split()[2:5:2] for line in output.splitlines()), - key=lambda x: len(x[0]), - reverse=True) - - # find which mount points are CIFS - # init to empty list - cifs_paths = [] - - try: - for path_and_fstype in mount_info: - # need to check for tables that have only path and no fstype - if len(path_and_fstype) == 2: - # if this entry is cifs, add it to list - if path_and_fstype[1] == 'cifs': - cifs_paths.append(path_and_fstype[0]) - else: - fmlogger.debug('mount file system types not described by fstype') - except: - fmlogger.debug('mount file system type check for CIFS error') - return [] + mount_info = sorted((pattern.match(l).groups() for l in output.splitlines()), + key=lambda x: len(x[0]), reverse=True) + cifs_paths = [path for path, fstype in mount_info + if fstype.lower() == 'cifs'] + return [ mount for mount in mount_info if any(mount[0].startswith(path) for path in cifs_paths) ] +def _generate_cifs_table(): + """Construct a reverse-length-ordered list of mount points that + fall under a CIFS mount. + + This precomputation allows efficient checking for whether a given path + would be on a CIFS filesystem. + + On systems without a ``mount`` command, or with no CIFS mounts, returns an + empty list. + """ + exit_code, output = sp.getstatusoutput("mount") + return _parse_mount_table(exit_code, output) + + _cifs_table = _generate_cifs_table() From 0f4b40b3fac73218b0d9d8ac798c22338ed18845 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 15 Feb 2018 19:46:21 -0500 Subject: [PATCH 351/365] TEST: Add tests for mount table parsing --- nipype/utils/tests/test_filemanip.py | 131 ++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 2 deletions(-) diff --git a/nipype/utils/tests/test_filemanip.py b/nipype/utils/tests/test_filemanip.py index acaa261d72..966fb9b230 100644 --- a/nipype/utils/tests/test_filemanip.py +++ b/nipype/utils/tests/test_filemanip.py @@ -12,8 +12,9 @@ from ...testing import TempFATFS from ...utils.filemanip import ( save_json, load_json, fname_presuffix, fnames_presuffix, hash_rename, - check_forhash, _cifs_table, on_cifs, copyfile, copyfiles, filename_to_list, - list_to_filename, check_depends, split_filename, get_related_files) + check_forhash, _parse_mount_table, _cifs_table, on_cifs, copyfile, + copyfiles, filename_to_list, list_to_filename, check_depends, + split_filename, get_related_files) import numpy as np @@ -335,6 +336,132 @@ def test_related_files(file, length, expected_files): assert ef in related_files +MOUNT_OUTPUTS = ( +# Linux, no CIFS +(r'''sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) +proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) +udev on /dev type devtmpfs (rw,nosuid,relatime,size=8121732k,nr_inodes=2030433,mode=755) +devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) +tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=1628440k,mode=755) +/dev/nvme0n1p2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered) +securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) +tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) +tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) +cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd) +pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) +efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime) +cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct) +cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) +cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids) +cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) +systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=26,pgrp=1,timeout=0,minproto=5,maxproto=5,direct) +hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime) +debugfs on /sys/kernel/debug type debugfs (rw,relatime) +mqueue on /dev/mqueue type mqueue (rw,relatime) +fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime) +/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) +/dev/nvme0n1p2 on /var/lib/docker/aufs type ext4 (rw,relatime,errors=remount-ro,data=ordered) +gvfsd-fuse on /run/user/1002/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1002,group_id=1002) +''', 0, []), +# OS X, no CIFS +(r'''/dev/disk2 on / (hfs, local, journaled) +devfs on /dev (devfs, local, nobrowse) +map -hosts on /net (autofs, nosuid, automounted, nobrowse) +map auto_home on /home (autofs, automounted, nobrowse) +map -fstab on /Network/Servers (autofs, automounted, nobrowse) +/dev/disk3s2 on /Volumes/MyBookData (hfs, local, nodev, nosuid, journaled) +afni:/elrond0 on /Volumes/afni (nfs) +afni:/var/www/INCOMING on /Volumes/INCOMING (nfs) +afni:/fraid on /Volumes/afni (nfs, asynchronous) +boromir:/raid.bot on /Volumes/raid.bot (nfs) +elros:/volume2/AFNI_SHARE on /Volumes/AFNI_SHARE (nfs) +map -static on /Volumes/safni (autofs, automounted, nobrowse) +map -static on /Volumes/raid.top (autofs, automounted, nobrowse) +/dev/disk1s3 on /Volumes/Boot OS X (hfs, local, journaled, nobrowse) +''', 0, []), +# Non-zero exit code +('', 1, []), +# Variant of Linux example with CIFS added manually +(r'''sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) +proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) +udev on /dev type devtmpfs (rw,nosuid,relatime,size=8121732k,nr_inodes=2030433,mode=755) +devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) +tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=1628440k,mode=755) +/dev/nvme0n1p2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered) +securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) +tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) +tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) +cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd) +pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) +efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime) +cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct) +cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) +cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids) +cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) +systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=26,pgrp=1,timeout=0,minproto=5,maxproto=5,direct) +hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime) +debugfs on /sys/kernel/debug type debugfs (rw,relatime) +mqueue on /dev/mqueue type mqueue (rw,relatime) +fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime) +/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) +/dev/nvme0n1p2 on /var/lib/docker/aufs type ext4 (rw,relatime,errors=remount-ro,data=ordered) +gvfsd-fuse on /run/user/1002/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1002,group_id=1002) +''', 0, []), +# Variant of OS X example with CIFS added manually +(r'''/dev/disk2 on / (hfs, local, journaled) +devfs on /dev (devfs, local, nobrowse) +afni:/elrond0 on /Volumes/afni (cifs) +afni:/var/www/INCOMING on /Volumes/INCOMING (nfs) +afni:/fraid on /Volumes/afni/fraid (nfs, asynchronous) +boromir:/raid.bot on /Volumes/raid.bot (nfs) +elros:/volume2/AFNI_SHARE on /Volumes/AFNI_SHARE (nfs) +''', 0, [('/Volumes/afni/fraid', 'nfs'), ('/Volumes/afni', 'cifs')]), +# From Windows: docker run --rm -it -v C:\:/data busybox mount +(r'''overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/26UTYITLF24YE7KEGTMHUNHPPG:/var/lib/docker/overlay2/l/SWGNP3T2EEB4CNBJFN3SDZLXHP,upperdir=/var/lib/docker/overlay2/a4c54ab1aa031bb5a14a424abd655510521e183ee4fa4158672e8376c89df394/diff,workdir=/var/lib/docker/overlay2/a4c54ab1aa031bb5a14a424abd655510521e183ee4fa4158672e8376c89df394/work) +proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) +tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755) +devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666) +sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime) +tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,relatime,mode=755) +cpuset on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset) +cpu on /sys/fs/cgroup/cpu type cgroup (ro,nosuid,nodev,noexec,relatime,cpu) +cpuacct on /sys/fs/cgroup/cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpuacct) +blkio on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio) +memory on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory) +devices on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices) +freezer on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer) +net_cls on /sys/fs/cgroup/net_cls type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls) +perf_event on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event) +net_prio on /sys/fs/cgroup/net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_prio) +hugetlb on /sys/fs/cgroup/hugetlb type cgroup (ro,nosuid,nodev,noexec,relatime,hugetlb) +pids on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids) +cgroup on /sys/fs/cgroup/systemd type cgroup (ro,nosuid,nodev,noexec,relatime,name=systemd) +mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime) +//10.0.75.1/C on /data type cifs (rw,relatime,vers=3.02,sec=ntlmsspi,cache=strict,username=filo,domain=MSI,uid=0,noforceuid,gid=0,noforcegid,addr=10.0.75.1,file_mode=0755,dir_mode=0755,iocharset=utf8,nounix,serverino,mapposix,nobrl,mfsymlinks,noperm,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1) +/dev/sda1 on /etc/resolv.conf type ext4 (rw,relatime,data=ordered) +/dev/sda1 on /etc/hostname type ext4 (rw,relatime,data=ordered) +/dev/sda1 on /etc/hosts type ext4 (rw,relatime,data=ordered) +shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k) +devpts on /dev/console type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666) +proc on /proc/bus type proc (ro,relatime) +proc on /proc/fs type proc (ro,relatime) +proc on /proc/irq type proc (ro,relatime) +proc on /proc/sys type proc (ro,relatime) +proc on /proc/sysrq-trigger type proc (ro,relatime) +tmpfs on /proc/kcore type tmpfs (rw,nosuid,size=65536k,mode=755) +tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755) +tmpfs on /proc/sched_debug type tmpfs (rw,nosuid,size=65536k,mode=755) +tmpfs on /proc/scsi type tmpfs (ro,relatime) +tmpfs on /sys/firmware type tmpfs (ro,relatime) +''', 0, [('/data', 'cifs')]) +) + + +@pytest.mark.parametrize("output, exit_code, expected", MOUNT_OUTPUTS) +def test_parse_mount_table(output, exit_code, expected): + assert _parse_mount_table(exit_code, output) == expected + + def test_cifs_check(): assert isinstance(_cifs_table, list) assert isinstance(on_cifs('/'), bool) From e8b0341fc5873fd80bca14b4c8d494d58be48918 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 15 Feb 2018 20:38:37 -0500 Subject: [PATCH 352/365] STY: flake8 --- nipype/utils/filemanip.py | 7 ++++--- nipype/utils/tests/test_filemanip.py | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index 842ea9f916..4b4942227e 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -292,7 +292,8 @@ def _parse_mount_table(exit_code, output): pattern = re.compile(r'.*? on (/.*?) (?:type |\()([^\s,]+)(?:, |\)| )') # (path, fstype) tuples, sorted by path length (longest first) - mount_info = sorted((pattern.match(l).groups() for l in output.splitlines()), + mount_info = sorted((pattern.match(l).groups() + for l in output.splitlines()), key=lambda x: len(x[0]), reverse=True) cifs_paths = [path for path, fstype in mount_info if fstype.lower() == 'cifs'] @@ -777,8 +778,8 @@ def emptydirs(path, noexist_ok=False): elcont = os.listdir(path) if ex.errno == errno.ENOTEMPTY and not elcont: fmlogger.warning( - 'An exception was raised trying to remove old %s, but the path ' - 'seems empty. Is it an NFS mount?. Passing the exception.', + 'An exception was raised trying to remove old %s, but the path' + ' seems empty. Is it an NFS mount?. Passing the exception.', path) elif ex.errno == errno.ENOTEMPTY and elcont: fmlogger.debug('Folder %s contents (%d items).', path, len(elcont)) diff --git a/nipype/utils/tests/test_filemanip.py b/nipype/utils/tests/test_filemanip.py index 966fb9b230..e8c0f7da30 100644 --- a/nipype/utils/tests/test_filemanip.py +++ b/nipype/utils/tests/test_filemanip.py @@ -16,8 +16,6 @@ copyfiles, filename_to_list, list_to_filename, check_depends, split_filename, get_related_files) -import numpy as np - def _ignore_atime(stat): return stat[:7] + stat[8:] @@ -124,7 +122,7 @@ def test_copyfiles(_temp_analyze_files, _temp_analyze_files_prime): pth, fname = os.path.split(orig_img2) new_img2 = os.path.join(pth, 'secondfile.img') new_hdr2 = os.path.join(pth, 'secondfile.hdr') - newfiles = copyfiles([orig_img1, orig_img2], [new_img1, new_img2]) + copyfiles([orig_img1, orig_img2], [new_img1, new_img2]) assert os.path.exists(new_img1) assert os.path.exists(new_hdr1) assert os.path.exists(new_img2) From 0e3ea76aa1799de2275be553d54cd4b26d9e3ae1 Mon Sep 17 00:00:00 2001 From: Hao Date: Fri, 10 Feb 2017 19:31:30 +0100 Subject: [PATCH 353/365] Datagrabber bug with the flag raise_on_empty --- nipype/interfaces/io.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index 5687b3f77e..3af35b6ff5 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -1242,8 +1242,11 @@ def _list_outputs(self): if self.inputs.sort_filelist: outfiles = human_order_sorted(outfiles) outputs[key].append(list_to_filename(outfiles)) - if any([val is None for val in outputs[key]]): - outputs[key] = [] + if self.inputs.raise_on_empty: # if the raise_on_empty is True by default, make sure no None in outputs + if any([val is None for val in outputs[key]]): + outputs[key] = [] + else: # if the raise_on_empty is False remove the Nones in outputs + outputs[key] = [[] if x is None else x for x in outputs[key]] if len(outputs[key]) == 0: outputs[key] = None elif len(outputs[key]) == 1: From d573790fb8820101036b7b3130d34e8e1af28ef5 Mon Sep 17 00:00:00 2001 From: Hao Date: Thu, 15 Feb 2018 18:15:00 +0100 Subject: [PATCH 354/365] bug for datagrabber #1783 --- nipype/interfaces/io.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index 3af35b6ff5..5baf0bc9eb 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -1242,11 +1242,11 @@ def _list_outputs(self): if self.inputs.sort_filelist: outfiles = human_order_sorted(outfiles) outputs[key].append(list_to_filename(outfiles)) - if self.inputs.raise_on_empty: # if the raise_on_empty is True by default, make sure no None in outputs + if self.inputs.drop_blank_outputs: + outputs[key] = [x for x in outputs[key] if x is not None] + else: if any([val is None for val in outputs[key]]): outputs[key] = [] - else: # if the raise_on_empty is False remove the Nones in outputs - outputs[key] = [[] if x is None else x for x in outputs[key]] if len(outputs[key]) == 0: outputs[key] = None elif len(outputs[key]) == 1: From b8eda2d15755b9e3ff9c6572c223f86e2df2f732 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Fri, 16 Feb 2018 08:25:47 -0500 Subject: [PATCH 355/365] ENH: Add drop_blank_outputs input field --- nipype/interfaces/io.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index 5baf0bc9eb..c4fdd75216 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -1044,6 +1044,10 @@ class DataGrabberInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): True, usedefault=True, desc='Generate exception if list is empty for a given field') + drop_blank_outputs = traits.Bool( + False, usedefault=True, + desc="Remove ``None`` entries from output lists" + ) sort_filelist = traits.Bool( mandatory=True, desc='Sort the filelist that matches the template') template = Str( From c372aae23ad151147390c4e6b9ffc3fec871a3b2 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Thu, 15 Feb 2018 11:04:39 -0500 Subject: [PATCH 356/365] COV: Ignore tests in calculating coverage --- codecov.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codecov.yml b/codecov.yml index 8a1ce2c18a..76b93e79be 100644 --- a/codecov.yml +++ b/codecov.yml @@ -26,3 +26,4 @@ coverage: - "nipype/external/*" - "tools/*" - "doc/*" + - "**/tests" From 415b0b8a5cded460ed93f7bb3d728d7f6a103697 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Fri, 16 Feb 2018 20:55:12 -0500 Subject: [PATCH 357/365] COV: Drop examples, superfluous globs --- codecov.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/codecov.yml b/codecov.yml index 76b93e79be..6da7db86f4 100644 --- a/codecov.yml +++ b/codecov.yml @@ -23,7 +23,8 @@ coverage: flags: - "smoketests" ignore: # files and folders that will be removed during processing - - "nipype/external/*" - - "tools/*" - - "doc/*" + - "nipype/external" + - "tools" + - "doc" - "**/tests" + - "examples" From 60f3d26643448a844f506c0b0cfc644e804b24a8 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Sat, 17 Feb 2018 18:44:03 -0500 Subject: [PATCH 358/365] CI: Add doctests to pytest script --- docker/files/run_pytests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/files/run_pytests.sh b/docker/files/run_pytests.sh index 76935b42f8..d20fe625ba 100644 --- a/docker/files/run_pytests.sh +++ b/docker/files/run_pytests.sh @@ -26,7 +26,7 @@ fi # Run tests using pytest export COVERAGE_FILE=${WORKDIR}/tests/.coverage.py${PYTHON_VERSION} -py.test -v --junitxml=${WORKDIR}/tests/pytests_py${PYTHON_VERSION}.xml --cov nipype --cov-config /src/nipype/.coveragerc --cov-report xml:${WORKDIR}/tests/coverage_py${PYTHON_VERSION}.xml ${TESTPATH} +py.test -v --junitxml=${WORKDIR}/tests/pytests_py${PYTHON_VERSION}.xml --cov nipype --cov-config /src/nipype/.coveragerc --cov-report xml:${WORKDIR}/tests/coverage_py${PYTHON_VERSION}.xml --doctest-modules ${TESTPATH} exit_code=$? # Collect crashfiles From 5f365a659750c6a6d646ccf0baf27b162a14d9f9 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Sat, 17 Feb 2018 20:42:21 -0500 Subject: [PATCH 359/365] TEST: Use pytest.ini to enable doctests --- docker/files/run_pytests.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/files/run_pytests.sh b/docker/files/run_pytests.sh index d20fe625ba..24d9466f80 100644 --- a/docker/files/run_pytests.sh +++ b/docker/files/run_pytests.sh @@ -26,7 +26,10 @@ fi # Run tests using pytest export COVERAGE_FILE=${WORKDIR}/tests/.coverage.py${PYTHON_VERSION} -py.test -v --junitxml=${WORKDIR}/tests/pytests_py${PYTHON_VERSION}.xml --cov nipype --cov-config /src/nipype/.coveragerc --cov-report xml:${WORKDIR}/tests/coverage_py${PYTHON_VERSION}.xml --doctest-modules ${TESTPATH} +py.test -v --junitxml=${WORKDIR}/tests/pytests_py${PYTHON_VERSION}.xml \ + --cov nipype --cov-config /src/nipype/.coveragerc \ + --cov-report xml:${WORKDIR}/tests/coverage_py${PYTHON_VERSION}.xml \ + -c ${TESTPATH}/pytest.ini ${TESTPATH} exit_code=$? # Collect crashfiles From e2571dc2709a1f73c45163f7820d9e42f2f22aad Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Mon, 19 Feb 2018 10:48:45 -0500 Subject: [PATCH 360/365] fix: create both workflow options --- nipype/workflows/dmri/fsl/tbss.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nipype/workflows/dmri/fsl/tbss.py b/nipype/workflows/dmri/fsl/tbss.py index d055bbd31b..ac45323c7e 100644 --- a/nipype/workflows/dmri/fsl/tbss.py +++ b/nipype/workflows/dmri/fsl/tbss.py @@ -387,8 +387,14 @@ def create_tbss_all(name='tbss_all', estimate_skeleton=True): ------- >>> from nipype.workflows.dmri.fsl import tbss - >>> tbss = tbss.create_tbss_all('tbss') + >>> tbss = tbss.create_tbss_all('tbss', estimate_skeleton=True) >>> tbss.inputs.inputnode.skeleton_thresh = 0.2 + >>> tbss.inputs.inputnode.fa_list = ['s1_wrapped_FA.nii', 's2_wrapped_FA.nii', 's3_wrapped_FA.nii'] + + >>> tbss = tbss.create_tbss_all('tbss', estimate_skeleton=False) + >>> tbss.inputs.inputnode.skeleton_thresh = 0.2 + >>> tbss.inputs.inputnode.fa_list = ['s1_wrapped_FA.nii', 's2_wrapped_FA.nii', 's3_wrapped_FA.nii'] + Inputs:: From 40aa316c0810011025a70e40abc6f0748374c27b Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Mon, 19 Feb 2018 10:49:17 -0500 Subject: [PATCH 361/365] tst: remove workflows/dmri/fsl regression tests from pytests --- .circleci/test_py2_pytest.sh | 2 +- .circleci/test_py3_pytest.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/test_py2_pytest.sh b/.circleci/test_py2_pytest.sh index 6ea0ddedfc..df1489d240 100644 --- a/.circleci/test_py2_pytest.sh +++ b/.circleci/test_py2_pytest.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py27" /usr/bin/run_pytests.sh +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py27" /usr/bin/run_pytests.sh diff --git a/.circleci/test_py3_pytest.sh b/.circleci/test_py3_pytest.sh index 545f430308..b93208f395 100644 --- a/.circleci/test_py3_pytest.sh +++ b/.circleci/test_py3_pytest.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 -e FSL_COURSE_DATA="/data/examples/nipype-fsl_course_data" "${DOCKER_IMAGE}:py36" /usr/bin/run_pytests.sh +docker run --rm=false -t -v $WORKDIR:/work -v $HOME/examples:/data/examples:ro -w /work -e CI_SKIP_TEST=1 -e NIPYPE_RESOURCE_MONITOR=1 "${DOCKER_IMAGE}:py36" /usr/bin/run_pytests.sh From 951bacd613da072ec3cae213528fbf20c2ddd5a9 Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Mon, 19 Feb 2018 11:24:35 -0500 Subject: [PATCH 362/365] fix: rename variable to not reflect imported module --- nipype/workflows/dmri/fsl/tbss.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nipype/workflows/dmri/fsl/tbss.py b/nipype/workflows/dmri/fsl/tbss.py index ac45323c7e..e601b9b3fb 100644 --- a/nipype/workflows/dmri/fsl/tbss.py +++ b/nipype/workflows/dmri/fsl/tbss.py @@ -387,13 +387,13 @@ def create_tbss_all(name='tbss_all', estimate_skeleton=True): ------- >>> from nipype.workflows.dmri.fsl import tbss - >>> tbss = tbss.create_tbss_all('tbss', estimate_skeleton=True) - >>> tbss.inputs.inputnode.skeleton_thresh = 0.2 - >>> tbss.inputs.inputnode.fa_list = ['s1_wrapped_FA.nii', 's2_wrapped_FA.nii', 's3_wrapped_FA.nii'] + >>> tbss_wf = tbss.create_tbss_all('tbss', estimate_skeleton=True) + >>> tbss_wf.inputs.inputnode.skeleton_thresh = 0.2 + >>> tbss_wf.inputs.inputnode.fa_list = ['s1_wrapped_FA.nii', 's2_wrapped_FA.nii', 's3_wrapped_FA.nii'] - >>> tbss = tbss.create_tbss_all('tbss', estimate_skeleton=False) - >>> tbss.inputs.inputnode.skeleton_thresh = 0.2 - >>> tbss.inputs.inputnode.fa_list = ['s1_wrapped_FA.nii', 's2_wrapped_FA.nii', 's3_wrapped_FA.nii'] + >>> tbss_wf = tbss.create_tbss_all('tbss', estimate_skeleton=False) + >>> tbss_wf.inputs.inputnode.skeleton_thresh = 0.2 + >>> tbss_wf.inputs.inputnode.fa_list = ['s1_wrapped_FA.nii', 's2_wrapped_FA.nii', 's3_wrapped_FA.nii'] Inputs:: From 4a71c12a5ef0f536cd356644b6fdbc9676d249bd Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Mon, 19 Feb 2018 12:14:49 -0500 Subject: [PATCH 363/365] fix: tbss3 should warn and return workflow when FSL not available --- nipype/workflows/dmri/fsl/tbss.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nipype/workflows/dmri/fsl/tbss.py b/nipype/workflows/dmri/fsl/tbss.py index e601b9b3fb..22a1540ea9 100644 --- a/nipype/workflows/dmri/fsl/tbss.py +++ b/nipype/workflows/dmri/fsl/tbss.py @@ -264,8 +264,11 @@ def create_tbss_3_postreg(name='tbss_3_postreg', estimate_skeleton=True): # $FSLDIR/bin/fslmaths $FSLDIR/data/standard/FMRIB58_FA_1mm -mas mean_FA_mask mean_FA maskstd = pe.Node( fsl.ImageMaths(op_string="-mas", suffix="_masked"), name="maskstd") - maskstd.inputs.in_file = fsl.Info.standard_image( - "FMRIB58_FA_1mm.nii.gz") + if fsl.no_fsl(): + warn('NO FSL found') + else: + maskstd.inputs.in_file = fsl.Info.standard_image( + "FMRIB58_FA_1mm.nii.gz") # $FSLDIR/bin/fslmaths mean_FA -bin mean_FA_mask binmaskstd = pe.Node( From 6a026ac22e50852ab065925da5964cc52180c305 Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Mon, 19 Feb 2018 12:44:52 -0500 Subject: [PATCH 364/365] fix: tbss3 should warn and return workflow when FSL not available --- nipype/workflows/dmri/fsl/tbss.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nipype/workflows/dmri/fsl/tbss.py b/nipype/workflows/dmri/fsl/tbss.py index 22a1540ea9..3aef3e734a 100644 --- a/nipype/workflows/dmri/fsl/tbss.py +++ b/nipype/workflows/dmri/fsl/tbss.py @@ -284,8 +284,11 @@ def create_tbss_3_postreg(name='tbss_3_postreg', estimate_skeleton=True): (maskgroup, maskgroup2, [("out_file", "in_file")]), (binmaskstd, maskgroup2, [("out_file", "in_file2")])]) - outputnode.inputs.skeleton_file = fsl.Info.standard_image( - "FMRIB58_FA-skeleton_1mm.nii.gz") + if fsl.no_fsl(): + warn('NO FSL found') + else: + outputnode.inputs.skeleton_file = fsl.Info.standard_image( + "FMRIB58_FA-skeleton_1mm.nii.gz") tbss3.connect([(binmaskstd, outputnode, [('out_file', 'groupmask')]), (maskstd, outputnode, [('out_file', 'meanfa_file')]), (maskgroup2, outputnode, [('out_file', From b44bce4c0a1a8d7fa64f45faea029913b7e0f2f5 Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Mon, 19 Feb 2018 15:39:56 -0500 Subject: [PATCH 365/365] fix: use matlab_cmd provided as input closes #2442 --- nipype/interfaces/spm/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/interfaces/spm/base.py b/nipype/interfaces/spm/base.py index cb0416392a..75ab60ffbd 100644 --- a/nipype/interfaces/spm/base.py +++ b/nipype/interfaces/spm/base.py @@ -186,7 +186,7 @@ def getinfo(klass, matlab_cmd=None, paths=None, use_mcr=None): } use_mcr = use_mcr or 'FORCE_SPMMCR' in os.environ - matlab_cmd = ((use_mcr and os.getenv('SPMMCRCMD')) + matlab_cmd = matlab_cmd or ((use_mcr and os.getenv('SPMMCRCMD')) or os.getenv('MATLABCMD', 'matlab -nodesktop -nosplash')) mlab = MatlabCommand(matlab_cmd=matlab_cmd, resource_monitor=False)