grail.data.multirun Module

Version: 16.2

Table of Contents

Overview

This module provides the ability to obtain information about Multirun packages and responses, and change variable values in a particular response set.

The procedures in a Multirun are stored in a Package. The parameters which vary in a package are stored in a Response set. There can be several Response sets per Package.

Examples

The following snippet illustrates how to read a varaible value from a multirun:

mr = multirun.Multirun('project_path')          #create a Multirun instance
pkg = mr.getPackage('package_name')             #create a Package instance
res = pkg.getResponse('response_name')          #create a Response instance
val = res.getVariableValue("?01", 1)
print val

The following snippet illustrates how to write a values to a varaible:

mr = multirun.Multirun('project_path')          #create a Multirun instance
pkg = mr.getPackage('package_name')             #create a Package instance
res = pkg.getResponse('response_name')          #create a Response instance
res.setVariableValue("?01", 1, "new_value")
res.setVariableValue("?02", 1, "next_value")

Multirun

Multirun(project_path)

Multirun is the top-level class. The constructor takes the prj file path as it's only argument. A Multirun can contain multiple Packages.

Methods

getPackageCount()
Returns the number of packages in the multirun.
getPackageNames()
Returns a list of package names.
getPackage(package_name)
Returns a reference to a Package object (see below).
execute(package_name, response_name)
Runs the multirun (from the command line) using the given package and response.

Attributes

project
This is the path to the project file.

Package

Package

Package is an inner-class of Multirun (you must create an instance of a Multirun before you can create a Package object). A Package can contain multiple Responses.

Methods

getProcedureNames()
Returns a list of procedures in the package.
getResponseCount()
Returns the number of response sets in the package.
getResponseNames()
Returns a list of response set names in the package.
getResponse(response_name)
Returns a reference to a Response object (see below).

Attributes

name
This is the name of the package.

Response

Response

Response is an inner-class of Package (you must create an instance of a Package before you can create a Response object).

Methods

getVariableCount()
Returns the number of variables in the response set.
getVariableNames()
Returns a list of variable names in the response set.
getRunCount()
Return the number of runs (the number of possible values for the variable).
getVariableValue(variable, runID)
Return the value of the variable for the given run number. Run numbers begin at 1.
setVariableValue(variable, runID, value)
Change the value of the variable for the given run number. Run numbers begin at 1. A TypeError will be raised of the value is not of type String.

Attributes

name
This is the name of the response set.