To help users document their Nipype-based code, the software is shipped with a set of extensions (currently only one) to customize the appearance and simplify the generation process.
nipype.sphinxext.plot_workflow - Workflow plotting extension¶A directive for including a nipype workflow graph in a Sphinx document.
This code is forked from the plot_figure sphinx extension of matplotlib.
By default, in HTML output, workflow will include a .png file with a link to a high-res .png. In LaTeX output, it will include a .pdf. The source code for the workflow may be included as inline content to the directive workflow:
.. workflow ::
:graph2use: flat
:simple_form: no
from nipype.workflows.dmri.camino.connectivity_mapping import create_connectivity_pipeline
wf = create_connectivity_pipeline()
For example, the following graph has been generated inserting the previous code block in this documentation:
The workflow directive supports the following options:
graph2use: {'hierarchical', 'colored', 'flat', 'orig', 'exec'}simple_form: boolformat: {'python', 'doctest'}include-source: boolworkflow_include_source variable in conf.pyencoding: str:encoding: option. The encoding will not be inferred using the -*- coding -*- metacomment.Additionally, this directive supports all of the options of the image directive, except for target (since workflow will add its own target). These include alt, height, width, scale, align and class.
The workflow directive has the following configuration options:
graph2usesimple_formwf_include_sourcewf_html_show_source_linkwf_pre_codewf_basedirworkflow:: file names are relative to. (If None or empty, file names are relative to the directory where the file containing the directive is.)wf_formats [(suffix, dpi), suffix, ...]
that determine the file format and the DPI. For entries whose DPI was omitted, sensible defaults are chosen. When passing from the command line through sphinx_build the list should be passed as suffix:dpi,suffix:dpi, ....wf_html_show_formatswf_rcparamswf_apply_rcparamscontext option is not used in a workflow directive. This configuration option overrides this behavior and applies rcParams before each workflow.wf_working_directorysys.path so it can import any helper modules sitting beside it. This configuration option can be used to specify a central directory (also added to sys.path) where data files and helper modules for all code are located.wf_template