diff --git a/.circleci/build_docs.sh b/.circleci/build_docs.sh deleted file mode 100644 index a050caf66c..0000000000 --- a/.circleci/build_docs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -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/config.yml b/.circleci/config.yml index b8150456cf..c8058c48b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -157,13 +157,6 @@ jobs: - run: *_run_codecov_coverage - store_artifacts: *store_artifacts_kwds - store_test_results: *store_artifacts_kwds - - run: - name: Build docs - no_output_timeout: 30m - environment: *test_environment - command: bash -ux /home/circleci/nipype/.circleci/build_docs.sh - - store_artifacts: - path: /home/circleci/work/docs - run: name: Save Docker images to workspace if on master no_output_timeout: 60m diff --git a/nipype/algorithms/icc.py b/nipype/algorithms/icc.py index 568f71fa7e..a3b72b00d1 100644 --- a/nipype/algorithms/icc.py +++ b/nipype/algorithms/icc.py @@ -44,10 +44,7 @@ def _run_interface(self, runtime): maskdata = np.logical_not(np.logical_or(maskdata == 0, np.isnan(maskdata))) session_datas = [ - [ - nb.load(fname).get_fdata()[maskdata].reshape(-1, 1) - for fname in sessions - ] + [nb.load(fname).get_fdata()[maskdata].reshape(-1, 1) for fname in sessions] for sessions in self.inputs.subjects_sessions ] list_of_sessions = [np.dstack(session_data) for session_data in session_datas] diff --git a/nipype/interfaces/afni/base.py b/nipype/interfaces/afni/base.py index dbe0882d8a..20a4a9b4d6 100644 --- a/nipype/interfaces/afni/base.py +++ b/nipype/interfaces/afni/base.py @@ -121,7 +121,9 @@ class AFNICommandBase(CommandLine): def _run_interface(self, runtime, correct_return_codes=(0,)): if platform == "darwin": runtime.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/usr/local/afni/" - return super(AFNICommandBase, self)._run_interface(runtime, correct_return_codes) + return super(AFNICommandBase, self)._run_interface( + runtime, correct_return_codes + ) class AFNICommandInputSpec(CommandLineInputSpec): diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index cace949d3c..1d53aac98c 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -1842,7 +1842,9 @@ def _parse_inputs(self, skip=None): return super(OutlierCount, self)._parse_inputs(skip) def _run_interface(self, runtime, correct_return_codes=(0,)): - runtime = super(OutlierCount, self)._run_interface(runtime, correct_return_codes) + runtime = super(OutlierCount, self)._run_interface( + runtime, correct_return_codes + ) # Read from runtime.stdout or runtime.merged with open(op.abspath(self.inputs.out_file), "w") as outfh: diff --git a/nipype/interfaces/camino/dti.py b/nipype/interfaces/camino/dti.py index 0504def61e..6d210c1b0b 100644 --- a/nipype/interfaces/camino/dti.py +++ b/nipype/interfaces/camino/dti.py @@ -1049,7 +1049,7 @@ class TrackBedpostxProbaInputSpec(TrackInputSpec): iterations = traits.Int( argstr="-iterations %d", units="NA", - desc="Number of streamlines to generate at each " "seed point. The default is 1.", + desc="Number of streamlines to generate at each seed point. The default is 1.", ) diff --git a/nipype/interfaces/spm/model.py b/nipype/interfaces/spm/model.py index 045051af6e..2d09f23e90 100644 --- a/nipype/interfaces/spm/model.py +++ b/nipype/interfaces/spm/model.py @@ -437,8 +437,7 @@ class EstimateContrast(SPMCommand): _jobname = "con" def _make_matlab_command(self, _): - """validates spm options and generates job structure - """ + """Validate spm options and generate job structure.""" contrasts = [] cname = [] for i, cont in enumerate(self.inputs.contrasts): @@ -457,80 +456,90 @@ def _make_matlab_command(self, _): contrasts[i].weights = cont[3] if len(cont) >= 5: contrasts[i].sessions = cont[4] - script = "% generated by nipype.interfaces.spm\n" - script += "spm_defaults;\n" - script += "jobs{1}.stats{1}.con.spmmat = {'%s'};\n" % self.inputs.spm_mat_file - script += "load(jobs{1}.stats{1}.con.spmmat{:});\n" - script += "SPM.swd = '%s';\n" % os.getcwd() - script += "save(jobs{1}.stats{1}.con.spmmat{:},'SPM');\n" - script += "names = SPM.xX.name;\n" + script = [ + """\ +%% generated by nipype.interfaces.spm +spm_defaults; +jobs{1}.stats{1}.con.spmmat = {'%s'}; +load(jobs{1}.stats{1}.con.spmmat{:}); +SPM.swd = '%s'; +save(jobs{1}.stats{1}.con.spmmat{:},'SPM'); +names = SPM.xX.name;""" + % (self.inputs.spm_mat_file, os.getcwd()) + ] # get names for columns if isdefined(self.inputs.group_contrast) and self.inputs.group_contrast: - script += "condnames=names;\n" + script += ["condnames=names;"] else: if self.inputs.use_derivs: - script += r"pat = 'Sn\([0-9]*\) (.*)';\n" + script += [r"pat = 'Sn\([0-9]*\) (.*)';"] else: - script += ( + script += [ r"pat = 'Sn\([0-9]*\) (.*)\*bf\(1\)|Sn\([0-9]*\) " r".*\*bf\([2-9]\)|Sn\([0-9]*\) (.*)';" - "\n" - ) - script += "t = regexp(names,pat,'tokens');\n" + ] + + script += ["t = regexp(names,pat,'tokens');"] # get sessidx for columns - script += r"pat1 = 'Sn\(([0-9].*)\)\s.*';\n" - script += "t1 = regexp(names,pat1,'tokens');\n" - script += ( - "for i0=1:numel(t),condnames{i0}='';condsess(i0)=0;if " - "~isempty(t{i0}{1}),condnames{i0} = t{i0}{1}{1};" - "condsess(i0)=str2num(t1{i0}{1}{1});end;end;\n" - ) + script += [r"pat1 = 'Sn\(([0-9].*)\)\s.*';"] + script += ["t1 = regexp(names,pat1,'tokens');"] + script += [ + """\ +for i0=1:numel(t) + condnames{i0}=''; + condsess(i0)=0; + if ~isempty(t{i0}{1}) + condnames{i0} = t{i0}{1}{1}; + condsess(i0)=str2num(t1{i0}{1}{1}); + end; +end;""" + ] + # BUILD CONTRAST SESSION STRUCTURE for i, contrast in enumerate(contrasts): if contrast.stat == "T": - script += "consess{%d}.tcon.name = '%s';\n" % (i + 1, contrast.name) - script += "consess{%d}.tcon.convec = zeros(1,numel(names));\n" % (i + 1) + script += ["consess{%d}.tcon.name = '%s';" % (i + 1, contrast.name)] + script += ["consess{%d}.tcon.convec = zeros(1,numel(names));" % (i + 1)] for c0, cond in enumerate(contrast.conditions): - script += "idx = strmatch('%s',condnames,'exact');\n" % (cond) - script += ( - "if isempty(idx), throw(MException(" - "'CondName:Chk', sprintf('Condition %%s not " - "found in design','%s'))); end;\n" - ) % cond + script += ["idx = strmatch('%s',condnames,'exact');" % cond] + script += [ + """\ +if isempty(idx) + throw(MException('CondName:Chk', sprintf('Condition %%s not found in design','%s'))); +end;""" + % cond + ] if contrast.sessions: for sno, sw in enumerate(contrast.sessions): - script += "sidx = find(condsess(idx)==%d);\n" % (sno + 1) - script += "consess{%d}.tcon.convec(idx(sidx)) = %f;\n" % ( - i + 1, - sw * contrast.weights[c0], - ) + script += ["sidx = find(condsess(idx)==%d);" % (sno + 1)] + script += [ + "consess{%d}.tcon.convec(idx(sidx)) = %f;" + % (i + 1, sw * contrast.weights[c0],) + ] else: - script += "consess{%d}.tcon.convec(idx) = %f;\n" % ( - i + 1, - contrast.weights[c0], - ) + script += [ + "consess{%d}.tcon.convec(idx) = %f;" + % (i + 1, contrast.weights[c0],) + ] for i, contrast in enumerate(contrasts): if contrast.stat == "F": - script += "consess{%d}.fcon.name = '%s';\n" % (i + 1, contrast.name) + script += ["consess{%d}.fcon.name = '%s';" % (i + 1, contrast.name)] for cl0, fcont in enumerate(contrast.conditions): - try: - tidx = cname.index(fcont[0]) - except: - Exception( - "Contrast Estimate: could not get index of" - " T contrast. probably not defined prior " - "to the F contrasts" - ) - script += ( - "consess{%d}.fcon.convec{%d} = consess{%d}.tcon.convec;\n" - ) % (i + 1, cl0 + 1, tidx + 1) - script += "jobs{1}.stats{1}.con.consess = consess;\n" - script += ( - "if strcmp(spm('ver'),'SPM8'), spm_jobman('initcfg');" - "jobs=spm_jobman('spm5tospm8',{jobs});end\n" - ) - script += "spm_jobman('run',jobs);" - return script + tidx = cname.index(fcont[0]) + script += [ + "consess{%d}.fcon.convec{%d} = consess{%d}.tcon.convec;" + % (i + 1, cl0 + 1, tidx + 1) + ] + script += ["jobs{1}.stats{1}.con.consess = consess;"] + script += [ + """\ +if strcmp(spm('ver'),'SPM8') + spm_jobman('initcfg'); + jobs=spm_jobman('spm5tospm8',{jobs}); +end;""" + ] + script += ["spm_jobman('run',jobs);"] + return "\n".join(script) def _list_outputs(self): import scipy.io as sio diff --git a/nipype/sphinxext/apidoc/__init__.py b/nipype/sphinxext/apidoc/__init__.py index 67cb00c59a..9c64cb4fb9 100644 --- a/nipype/sphinxext/apidoc/__init__.py +++ b/nipype/sphinxext/apidoc/__init__.py @@ -40,13 +40,7 @@ class Config(NapoleonConfig): """ _config_values = { "nipype_skip_classes": ( - [ - "Tester", - "InputSpec", - "OutputSpec", - "Numpy", - "NipypeTester", - ], + ["Tester", "InputSpec", "OutputSpec", "Numpy", "NipypeTester",], "env", ), **NapoleonConfig._config_values,