Man page for execΒΆ

NAME

pymvpa2-exec - evaluate arbitrary Python expressions for tests and assertions  

SYNOPSIS

pymvpa2 ,exec /[,--version/] [,-h/] [,-i /[,DATASET /[,DATASET /...]]] ,-e EXPR /[,-s NAME /[,NAME /...]] [,-o OUTPUT/] [,--hdf5-compression TYPE/]  

DESCRIPTION

Execute arbitrary Python expressions (on datasets)

This command can be used to execute arbitrary Python scripts while avoiding unnecessary boilerplate code to load datasets and store results. This command is also useful for testing functionality and results via the commandline interface and for asserting arbitrary conditions in scripts.

First, optional dataset(s) are loaded from one or more sources. Afterwards any number of given expressions (see --exec) are executed. An expression can be given as an argument on the command line, read from a file, or from STDIN. The return value of any given expression is ignored (not evaluated anyhow), only exceptions are treated as errors and cause the command to exit with a non-zero return value. To implement tests and assertions it is best to utilize a Python unittest framework such as 'nose'.

In the namespace in which all expressions are evaluated the NumPy module is available via the alias 'np', and the nose.tools under the alias 'nt' (if installed). Any loaded datasets are available as a list named ``dss``. The first dataset in that list (if any) is available under the name ``ds``.  

OPTIONS

--version
show program's version and license information and exit
-h, --help, --help-np
show this help message and exit. --help-np forcefully disables the use of a pager for displaying the help.
-i [DATASET [DATASET ...]], --input [DATASET [DATASET ...]]
path(s) to one or more PyMVPA dataset files. All datasets will be merged into a single dataset (vstack'ed) in order of specification. In some cases this option may need to be specified more than once if multiple, but separate, input datasets are required.
-e EXPR, --exec EXPR
Python expression, or filename of a Python script, or '-' to read expressions from STDIN.
 

Output options:

-s NAME [NAME ...], --store NAME [NAME ...]
One or more names of variables or objects to extract from the local name space after all expressions have been executed. They will be stored in a dictionary in HDF5 format (requires --output).
-o OUTPUT, --output OUTPUT
output filename ('.hdf5' extension is added automatically if necessary). NOTE: The output format is suitable for data exchange between PyMVPA commands, but is not recommended for long-term storage or exchange as its specific content may vary depending on the actual software environment. For long-term storage consider conversion into other data formats (see 'dump' command).
--hdf5-compression TYPE
compression type for HDF5 storage. Available values depend on the specific HDF5 installation. Typical values are: 'gzip', 'lzf', 'szip', or integers from 1 to 9 indicating gzip compression levels.
 

EXAMPLES

Assert some condition
$ pymvpa2 exec -e 'assert(4==4)'

Check for the presence of a particular sample attribute in a dataset

$ pymvpa2 exec -e 'dss[0].sa.subj3' -i mydata.hdf5

Extract and store results

$ pymvpa2 exec -e 'a=5' -e 'print a' --store a -o mylittlea.hdf5
 

AUTHOR

Written by Michael Hanke & Yaroslav Halchenko, and numerous other contributors.  

COPYRIGHT

Copyright © 2006-2015 PyMVPA developers

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.