grail.compass.responsevar module

Version: 16.2

Table of Contents

Description

Provides a way to manage the response variables stored within a MineSight® Compass project file.

ResponseVar Class

class ResponseVar(procfilename, projectpath)

Abstraction of the response variables stored within a given project file for a given procedure.

All access to project file is done on a call by call basis. In other words the project file is only opened (and closed) on a need-only basis.

Arguments:
procfilename : string
A procedure filename. This is where the response variables are stored within the project file.
projectpath : string
Path to the project file which contain the response variables you are interested in. A ResponseVarError exception will be generated if you supplied either an invalid path, or a invalid project file.

Example,

rv = responsevar.ResponseVar("epit.py", "c:\project\msop.prj")
projectpath
Indicates the project path used for this response set. This value is read-only.
delete(foldername)
Removes a variable set for the given foldername.
description(foldername)
Returns the description for the given foldername. If the foldername is not present a ResponseVarError is generated.
last_modified(foldername)

Returns the last modified time for the foldername as the number of seconds since the start of the epoch. This is usable with Python's time.gmtime [1] function.

If the foldername has no last modified time this function will return -1.

listing()

Returns a listing of variable save names and descriptions.

Each procedure (specified when you created the object), has a set of response variables associated with it. The listing will return a valid set of response variables that you can access.

At the very least, there will be a 'default' set, if a save has been made before.

Returns:

A listing of all the responsevar sets available to load. What load() refers to to as a folder. The listing is of the format,

{folder1:description1, ..., folderN:descriptionN}

Note

If a response var set is corrupt (for example missing its description field), it will be ignored.

load([folder])

Returns the responsevars, in dictionary format, for the given folder. If the folder is not specified it is assumed to be set to the 'default'.

Returns:
A variable dictionary suitable for passing to the grail.rtv module.
meta_info(foldername)
Returns a MetaResponseInfo object for the given foldername.
meta_listing()
Returns a list of MetaResponseInfo objects. These objects give meta information about the responses sets defined for the ResponseVar object.
save([folder, description, variables])

Stores a variable list under the specified folder.

Arguments:
folder : string
Name of the folder you want to save the variable map under. If not specified this assumed to be 'default'.
description : string
Description of that folder. If not set, this is will be set to 'default'.
variables : dictionary
A dictionary of the variables that you wish to store. The format is the same as the one you get from load().

Note

Typically the variables would come from something like rtv.getvariablemap().

MetaResponseInfo Class

class MetaResponseInfo(foldername, description, lastmodified)

This is returned by the ResponseVar object's meta_listing function. It defines the meta information for one folder defined within the ResponseVar object.

This object should not be created directly.

foldername
Defines the name of the folder. This is also known as the Response Set Name.
description
The description of the folder.
lastmodified
Defines the time in seconds since the start of the epoch since the folder was last modified. This value is useable with the time.gmtime [1] function.

Exception

exception ResponseVarError
Accounts for errors having to do with ResponseVar manipulation.

Reference

[1](1, 2) "time -- Time access and conversions" Python Library Reference. 19 December 2003. 9 September 2004. <http://www.python.org/doc/2.3.3/lib/module-time.html>