Skip to content

FIX: Repair aftermath of docs refactor #3133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .circleci/build_docs.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions nipype/algorithms/icc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion nipype/interfaces/afni/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 3 additions & 1 deletion nipype/interfaces/afni/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/camino/dti.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
)


Expand Down
125 changes: 67 additions & 58 deletions nipype/interfaces/spm/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
8 changes: 1 addition & 7 deletions nipype/sphinxext/apidoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down