Skip to content

Commit

Permalink
Fix the apidoc Note delimiter.
Browse files Browse the repository at this point in the history
  • Loading branch information
FredLoney committed Jun 20, 2017
1 parent ea02def commit 017b3dd
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 49 deletions.
22 changes: 11 additions & 11 deletions qipipe/interfaces/ants/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft = python sts = 4 ts = 4 sw = 4 et:
"""ANTS Affine Initializer interface
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
Expand All @@ -21,22 +21,22 @@

class AffineInitializerInputSpec(ANTSCommandInputSpec):
"""
:Note: The antsAffineInitializer command line options are positional
.. Note:: The antsAffineInitializer command line options are positional
rather than keyword, e.g.::
antsAffineInitializer 3 fixed.nii.gz moving.nii.gz initial_xform.mat \
10 0.3
rather than::
antsAffineInitializer 3 fixed.nii.gz moving.nii.gz initial_xform.mat \
--search_factor 10 --radian_fraction 0.3
Therefore, each optional input field requires the prior input field,
e.g. *radian_fraction* requires a *search_factor* input. Reasonable
starting option values are shown in the :class:`AffineInitializer`
example.
In particular, note that since an image mask is the last positional
argument, if the *image_mask* input option is set, then all other
options must be set as well.
Expand Down Expand Up @@ -79,7 +79,7 @@ class AffineInitializer(ANTSCommand):
"""
Examples
--------
>>> initalizer = AffineInitializer()
>>> initalizer.inputs.dimension = 3
>>> initalizer.inputs.fixed_image = 'NIFTI/volume003.nii.gz'
Expand All @@ -96,16 +96,16 @@ class AffineInitializer(ANTSCommand):
_cmd = 'antsAffineInitializer'
input_spec = AffineInitializerInputSpec
output_spec = AffineInitializerOutputSpec


def _format_arg(self, opt, spec, val):
if opt == 'radian_fraction':
# Suppress extraneous trailing zeros.
# Cf. http://stackoverflow.com/questions/2440692/formatting-floats-in-python-without-superfluous-zeros
return ('%f' % val).rstrip('0').rstrip('.')
else:
return super(AffineInitializer, self)._format_arg(opt, spec, val)

def _list_outputs(self):
outputs = self._outputs().get()
out_file = os.path.abspath(self.inputs.output_affine_transform)
Expand Down
2 changes: 1 addition & 1 deletion qipipe/interfaces/fastfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
OHSU - This module wraps the proprietary OHSU AIRC ``fastfit``
software. ``fastfit`` optimizes the input pharmacokinetic model.
:Note: this interface is adapted from the OHSU AIRC cluster file
.. Note:: this interface is adapted from the OHSU AIRC cluster file
``/usr/global/scripts/fastfit_iface.py``.
"""

Expand Down
2 changes: 1 addition & 1 deletion qipipe/interfaces/sticky_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class StickyIdentityInterface(IOBase):
>> output_res.outputs.get()['a'] # bad!
<undefined>
:Note: a better solution is to set a *preserve* flag on
.. Note:: a better solution is to set a *preserve* flag on
IdentityInterface. If this solution is implemented by Nipype,
then this :class:`StickyIdentityInterface` class will be
deprecated.
Expand Down
2 changes: 1 addition & 1 deletion qipipe/interfaces/xnat_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class XNATDownload(BaseInterface):
The ``XNATDownload`` Nipype interface wraps the
:meth:`qixnat.facade.XNAT.download` method.
:Note: only one XNAT operation can run at a time.
.. Note:: only one XNAT operation can run at a time.
Examples:
Expand Down
2 changes: 1 addition & 1 deletion qipipe/interfaces/xnat_find.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class XNATFind(BaseInterface):
The ``XNATFind`` Nipype interface wraps the ``qixnat.facade.XNAT``
``find_one`` and ``find_or_create`` methods.
:Note: concurrent XNAT operations can fail. See the
.. Note:: concurrent XNAT operations can fail. See the
:class:`qipipe.pipeline.staging.StagingWorkflow` note.
"""

Expand Down
4 changes: 2 additions & 2 deletions qipipe/pipeline/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class ModelingWorkflow(WorkflowBase):
This workflow is adapted from the `AIRC DCE`_ implementation.
:Note: This workflow uses proprietary OHSU AIRC software, notably the
.. Note:: This workflow uses proprietary OHSU AIRC software, notably the
OHSU implementation of the shutter speed model.
.. reST substitutions:
Expand Down Expand Up @@ -443,7 +443,7 @@ def _create_airc_workflow(self, **opts):
:class:`qipipe.pipeline.modeling.ModelingWorkflow` with the
exception of XNAT upload.
:Note: This workflow is adapted from the AIRC workflow at
.. Note:: This workflow is adapted from the AIRC workflow at
https://everett.ohsu.edu/hg/qin_dce. The AIRC workflow time
series merge is removed and added as input to the workflow
created by this method. The modeling optimization parameters
Expand Down
8 changes: 4 additions & 4 deletions qipipe/pipeline/qipipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,14 +1151,14 @@ def _register(subject, session, scan, in_files, opts,
A facade for the :meth:`qipipe.pipeline.registration.register
method.
:Note: The *mask* and *reference_index* parameters are
.. Note:: The *mask* and *reference_index* parameters are
registration options, but can't be included in the *opts*
parameter, since they are potential upstream workflow node
connection points. Since a mock registration technique
does not connect these inputs, they have default values
in the method signature as well.
:Note: contrary to Python convention, the *opts* method
.. Note:: contrary to Python convention, the *opts* method
parameter is a required dictionary rather than a keyword
double-splat argument (i.e., ``**opts``). The Nipype
``Function`` interface does not support double-splat
Expand Down Expand Up @@ -1186,7 +1186,7 @@ def register(subject, session, scan, reference_index, *in_files, **opts):
"""
Runs the registration workflow on the given session scan images.
:Note: There is always a mask and resource argument. The mask
.. Note:: There is always a mask and resource argument. The mask
file and resource name are either specified as an input or
built by the workflow. The mask and resource are options in
the registration run function. Therefore, we check that these
Expand Down Expand Up @@ -1341,7 +1341,7 @@ def roi(subject, session, scan, time_series, in_rois, opts):
"""
Runs the ROI workflow on the given session scan images.
:Note: see the :meth:`register` note.
.. Note:: see the :meth:`register` note.
:param subject: the subject name
:param session: the session name
Expand Down
2 changes: 1 addition & 1 deletion qipipe/pipeline/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class RegistrationWorkflow(WorkflowBase):
- ``fsl.FNIRT``: the FSL `FNIRT interface`_ options
:Note: Since the XNAT *resource* name is unique, a
.. Note:: Since the XNAT *resource* name is unique, a
:class:`qipipe.pipeline.registration.RegistrationWorkflow`
instance can be used for only one registration workflow.
Different registration inputs require different
Expand Down
12 changes: 7 additions & 5 deletions qipipe/pipeline/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,17 @@ class VolumeStagingWorkflow(WorkflowBase):
- *image*: the 3D volume stack NIfTI image file
:Note: Concurrent XNAT upload fails unpredictably due to one of
the causes described in the ``qixnat.facade.XNAT.find`` method
documentation.
.. Note:: Concurrent XNAT upload fails unpredictably due to one of
the causes described in the ``qixnat.facade.XNAT.find`` method
documentation.
The errors are addressed by the following measures:
* setting an isolated pyxnat cache_dir for each execution node
* setting an isolated ``pyxnat`` *cache_dir* for each execution
node
* serializing the XNAT find-or-create access points with JoinNodes
* serializing the XNAT find-or-create access points with
``JoinNode``s
* increasing the SGE submission resource parameters as shown in
the ``conf/staging.cfg [upload]`` section
Expand Down
2 changes: 1 addition & 1 deletion qipipe/pipeline/workflow_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def _configure_nodes(self, workflow):
each WorkflowBase subclass after the workflow is built and
prior to execution.
:Note: nested workflow nodes are not configured, e.g. if the
.. Note:: nested workflow nodes are not configured, e.g. if the
``registration`` workflow connects a `realign`` workflow
node ``fnirt``, then the nested ``realign.fnirt`` node in
``registration`` is not configured by the parent workflow.
Expand Down
4 changes: 2 additions & 2 deletions qipipe/staging/ohsu.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@
"""
The Sarcoma ROI .bqf ROI file match pattern.
:Note: The Sarcoma ROI directories are inconsistently named, with several
.. Note:: The Sarcoma ROI directories are inconsistently named, with several
alternatives and duplicates.
TODO - clarify which of the Sarcoma ROI naming variations should be used.
:Note: There are no apparent lesion number indicators in the Sarcoma ROI
.. Note:: There are no apparent lesion number indicators in the Sarcoma ROI
input.
TODO - confirm that there is no Sarcoma lesion indicator.
Expand Down
2 changes: 1 addition & 1 deletion test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
The test XNAT project name.
:Note: this test project must be created in XNAT prior to running the
.. Note:: this test project must be created in XNAT prior to running the
tests.
"""

Expand Down
34 changes: 17 additions & 17 deletions test/unit/pipeline/test_staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,38 @@

class TestStagingWorkflow(object):
"""Staging workflow unit tests."""

def setUp(self):
shutil.rmtree(RESULTS, True)

def tearDown(self):
shutil.rmtree(RESULTS, True)

def test_breast(self):
self._test_collection('Breast')

def test_sarcoma(self):
self._test_collection('Sarcoma')

def _test_collection(self, collection):
"""
Run the staging workflow on the given collection and verify that
the sessions are created in XNAT.
:Note: This test does not verify the CTP staging area nor the
uploaded image file content. These features should be verified
manually.
Run the staging workflow on the given collection and verify
that the sessions are created in XNAT.
.. Note:: This test does not verify the CTP staging area nor
the uploaded image file content. These features should be
verified manually.
:param collection: the image collection name
"""
fixture = os.path.join(FIXTURES, collection.lower())
logger(__name__).debug("Testing the staging workflow on %s..." %
fixture)

# The staging destination and work area.
dest = os.path.join(RESULTS, 'staged')
work = os.path.join(RESULTS, 'work')

# The test {subject: directory} dictionary.
sbj_dir_dict = subject_sources(collection, fixture)
# The test subjects.
Expand All @@ -60,7 +60,7 @@ def _test_collection(self, collection):
# The test input session directories.
sess_dir_lists = (glob(d + '/*') for d in sbj_dirs)
inputs = concat(*sess_dir_lists)

with qixnat.connect() as xnat:
# Delete any existing test subjects.
for sbj in subjects:
Expand Down Expand Up @@ -101,13 +101,13 @@ def _test_collection(self, collection):
"The %s %s scan %s file %s was not created in XNAT" %
(scan_input.subject, scan_input.session,
scan_input.scan, base_name))

# Delete the test subjects.
for sbj in subjects:
xnat.delete(PROJECT, sbj)


if __name__ == "__main__":
import nose

nose.main(defaultTest=__name__)
2 changes: 1 addition & 1 deletion test/unit/qiprofile/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
The qiprofile update tests.
:Note: most of the test cases require that the MongoDB and qiprofile REST
.. Note:: most of the test cases require that the MongoDB and qiprofile REST
servers are running on localhost.
"""

Expand Down

0 comments on commit 017b3dd

Please sign in to comment.