Download & The ni. Python Toolbox - Aging in Vision and Action

Transcript
4.4.3 Tools ni.tools - .project - Project Management
35
Figure 4.4.2: A Project can manage several sessions of the same task (eg. with
some parameters changed). Each Session can contain several jobs from a python
file containing job statements. This file is parsed into several job script files.
character “:”. Code that should be part of the job has to be indented after the
job statement. When the indentation level is lost again, following code will no
longer be part of this job.
""" An example job file that will generate 110 jobs. """
## Parameters:
cells = range(10)
## End of Parameters
job "Printing a cell" for cell in cells:
print cell
job "Printing more cells" for cell_1 in cells for cell_2 in cells:
requires previous
# only do this if the previous job is
completed
print cell_1, cell_2
The block between the ## Parameters and ## End of Parameters comments
can be edited on a per-session basis and saved as a text file ’parameters.txt’
into the session directory and will be replaced in the source code. It can also
be passed as an argument to the function parsing the source file into job files.
An example use case of setting up a session with new jobs would be:
import ni
p = ni.tools.project.load("TestProject")