Skip to content

Commit 356422b

Browse files
committed
fix: miscellaneous improvements and fixes
In particular, after allowing printing the inheritance of interfaces, links for ZZZCommandBase interfaces were broken, as originally filtered out and not built. Now they are being built and we are back to 5 warnings.
1 parent 7be74f9 commit 356422b

File tree

6 files changed

+49
-31
lines changed

6 files changed

+49
-31
lines changed

doc/interfaces.rst

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
========================
66
Interfaces and Workflows
77
========================
8+
:Release: |version|
9+
:Date: |today|
10+
11+
Previous versions: `1.3.0 <http://nipype.readthedocs.io/en/1.3.0/>`_ `1.2.3 <http://nipype.readthedocs.io/en/1.2.3/>`_
12+
813
Workflows
914
---------
1015
.. important::

examples/fmri_spm_auditory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def makelist(item):
316316
317317
Use the :class:`~nipype.pipeline.engine.workflows.Workflow` to create a
318318
graph-based execution pipeline for first level analysis.
319-
Set the :py:attr:`~nipype.pipeline.engine.workflows.Workflow.base_dir`
319+
Set the :py:attr:`~nipype.pipeline.engine.workflows.base.EngineBase.base_dir`
320320
option to instruct the pipeline engine to use ``spm_auditory_tutorial/workingdir``
321321
as the filesystem location to use when running the processes and keeping their
322322
outputs.

nipype/interfaces/afni/__init__.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# -*- coding: utf-8 -*-
22
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
33
# vi: set ft=python sts=4 ts=4 sw=4 et:
4-
"""The afni module provides classes for interfacing with the `AFNI
5-
<http://afni.nimh.nih.gov/afni>`_ command line tools.
4+
"""
5+
AFNI_ is a software suite for the analysis and display of anatomical and functional MRI data.
6+
7+
.. include:: ../../../doc/links_names.txt
68
7-
Top-level namespace for afni.
89
"""
910

1011
from .base import Info

nipype/interfaces/afni/base.py

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
33
# vi: set ft=python sts=4 ts=4 sw=4 et:
4-
"""Provide interface to AFNI commands."""
4+
"""Provide a base interface to AFNI commands."""
55
import os
66
from sys import platform
77
from distutils import spawn
@@ -108,12 +108,17 @@ def standard_image(img_name):
108108

109109
class AFNICommandBase(CommandLine):
110110
"""
111-
A base class to fix a linking problem in OSX and afni.
111+
A base class to fix a linking problem in OSX and AFNI.
112+
113+
See Also
114+
--------
115+
`This thread
116+
<http://afni.nimh.nih.gov/afni/community/board/read.php?1,145346,145347#msg-145347>`__
117+
about the particular environment variable that fixes this problem.
112118
113-
See http://afni.nimh.nih.gov/afni/community/board/read.php?1,145346,145347#msg-145347
114119
"""
115120

116-
def _run_interface(self, runtime):
121+
def _run_interface(self, runtime, correct_return_codes=(0,)):
117122
if platform == "darwin":
118123
runtime.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/usr/local/afni/"
119124
return super(AFNICommandBase, self)._run_interface(runtime)
@@ -294,13 +299,6 @@ def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, ext=None)
294299
return fname
295300

296301

297-
def no_afni():
298-
"""Check whether AFNI is not available."""
299-
if Info.version() is None:
300-
return True
301-
return False
302-
303-
304302
class AFNIPythonCommandInputSpec(CommandLineInputSpec):
305303
outputtype = traits.Enum(
306304
"AFNI", list(Info.ftypes.keys()), desc="AFNI output filetype"
@@ -323,3 +321,10 @@ def cmd(self):
323321
@property
324322
def _cmd_prefix(self):
325323
return "{} ".format(self.inputs.py27_path)
324+
325+
326+
def no_afni():
327+
"""Check whether AFNI is not available."""
328+
if Info.version() is None:
329+
return True
330+
return False

nipype/pipeline/engine/base.py

+23-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
43
# vi: set ft=python sts=4 ts=4 sw=4 et:
5-
"""Defines functionality for pipelined execution of interfaces
6-
7-
The `EngineBase` class implements the more general view of a task.
8-
"""
4+
"""Defines functionality for pipelined execution of interfaces."""
95
from copy import deepcopy
106
import re
117
import numpy as np
@@ -16,10 +12,15 @@
1612

1713

1814
class EngineBase(object):
19-
"""Defines common attributes and functions for workflows and nodes."""
15+
"""
16+
Defines common attributes and functions for workflows and nodes.
17+
18+
Implements the more general view of a task.
19+
"""
2020

2121
def __init__(self, name=None, base_dir=None):
22-
""" Initialize base parameters of a workflow or node
22+
"""
23+
Initialize base parameters of a workflow or node.
2324
2425
Parameters
2526
----------
@@ -31,15 +32,19 @@ def __init__(self, name=None, base_dir=None):
3132
default=None, which results in the use of mkdtemp
3233
3334
"""
35+
self._name = None
3436
self._hierarchy = None
3537
self.name = name
3638
self._id = self.name # for compatibility with node expansion using iterables
3739

3840
self.base_dir = base_dir
41+
"""Define the work directory for this instance of workflow element."""
42+
3943
self.config = deepcopy(config._sections)
4044

4145
@property
4246
def name(self):
47+
"""Set the unique name of this workflow element."""
4348
return self._name
4449

4550
@name.setter
@@ -50,6 +55,7 @@ def name(self, name):
5055

5156
@property
5257
def fullname(self):
58+
"""Build the full name down the hierarchy."""
5359
if self._hierarchy:
5460
return "%s.%s" % (self._hierarchy, self.name)
5561
return self.name
@@ -64,20 +70,22 @@ def outputs(self):
6470

6571
@property
6672
def itername(self):
67-
"""Name for expanded iterable"""
73+
"""Get the name of the expanded iterable."""
6874
itername = self._id
6975
if self._hierarchy:
7076
itername = "%s.%s" % (self._hierarchy, self._id)
7177
return itername
7278

7379
def clone(self, name):
74-
"""Clone an EngineBase object
80+
"""
81+
Clone an EngineBase object.
7582
7683
Parameters
7784
----------
7885
7986
name : string (mandatory)
8087
A clone of node or workflow must have a new name
88+
8189
"""
8290
if name == self.name:
8391
raise ValueError('Cloning requires a new name, "%s" is ' "in use." % name)
@@ -96,15 +104,20 @@ def _check_inputs(self, parameter):
96104
return hasattr(self.inputs, parameter)
97105

98106
def __str__(self):
107+
"""Convert to string."""
99108
return self.fullname
100109

101110
def __repr__(self):
111+
"""Get Python representation."""
102112
return self.itername
103113

104114
def save(self, filename=None):
115+
"""Store this workflow element to a file."""
105116
if filename is None:
106117
filename = "temp.pklz"
107118
savepkl(filename, self)
108119

109-
def load(self, filename):
120+
@staticmethod
121+
def load(filename):
122+
"""Load this workflow element from a file."""
110123
return loadpkl(filename)

nipype/sphinxext/apidoc/__init__.py

-6
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ class Config(NapoleonConfig):
4141
_config_values = {
4242
"nipype_skip_classes": (
4343
[
44-
"AFNI(Python)?Command",
45-
"ANTS",
46-
"FSLCommand",
47-
"FS(Command|Script)",
48-
"Info",
49-
"^SPM",
5044
"Tester",
5145
"InputSpec",
5246
"OutputSpec",

0 commit comments

Comments
 (0)