algorithms.diagnostics.commands

Module: algorithms.diagnostics.commands

Implementation of diagnostic command line tools

Tools are:

  • nipy_diagnose

  • nipy_tsdiffana

This module has the logic for each command.

The command script files deal with argument parsing and any custom imports. The implementation here accepts the args object from argparse and does the work.

Functions

nipy.algorithms.diagnostics.commands.diagnose(args)[source]

Calculate, write results from diagnostic screen

Parameters

args : object

object with attributes:

  • filename : str - 4D image filename

  • time_axis : str - name or number of time axis in filename

  • slice_axis : str - name or number of slice axis in filename

  • out_path : None or str - path to which to write results

  • out_fname_label : None or filename - suffix of output results files

  • ncomponents : int - number of PCA components to write images for

Returns

res : dict

Results of running screen() on filename

nipy.algorithms.diagnostics.commands.parse_fname_axes(img_fname, time_axis, slice_axis)[source]

Load img_fname, check time_axis, slice_axis or use default

Parameters

img_fname : str

filename of image on which to do diagnostics

time_axis : None or str or int, optional

Axis indexing time-points. None is default, will be replaced by a value of ‘t’. If time_axis is an integer, gives the index of the input (domain) axis of img. If time_axis is a str, can be an input (domain) name, or an output (range) name, that maps to an input (domain) name.

slice_axis : None or str or int, optional

Axis indexing MRI slices. If slice_axis is an integer, gives the index of the input (domain) axis of img. If slice_axis is a str, can be an input (domain) name, or an output (range) name, that maps to an input (domain) name. If None (the default) then 1) try the name ‘slice’ to select the axis - if this fails, and fname refers to an Analyze type image (such as Nifti), then 2) default to the third image axis, otherwise 3) raise a ValueError

Returns

img : Image instance

Image as loaded from img_fname

time_axis : int or str

Time axis, possibly filled with default

slice_axis : int or str

Slice axis, possibly filled with default

nipy.algorithms.diagnostics.commands.tsdiffana(args)[source]

Generate tsdiffana plots from command line params args

Parameters

args : object

object with attributes

  • filename : str - 4D image filename

  • out_file : str - graphics file to write to instead of leaving graphics on screen

  • time_axis : str - name or number of time axis in filename

  • slice_axis : str - name or number of slice axis in filename

  • write_results : bool - if True, write images and plots to files

  • out_path : None or str - path to which to write results

  • out_fname_label : None or filename - suffix of output results files

Returns

axes : Matplotlib axes

Axes on which we have done the plots.