==================================== ``grail.compass.responsevar`` module ==================================== .. include:: ..\version.h .. contents:: Table of Contents :backlinks: top ----------- Description ----------- Provides a way to manage the response variables stored within a MineSightŪ Compass project file. ----------------- ResponseVar Class ----------------- class :dc:`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: :a:`procfilename` : string A procedure filename. This is where the response variables are stored within the project file. :a:`projectpath` : string Path to the project file which contain the response variables you are interested in. A :e:`ResponseVarError` exception will be generated if you supplied either an invalid path, or a invalid project file. Example, .. Python:: rv = responsevar.ResponseVar("epit.py", "c:\project\msop.prj") :dd:`projectpath` Indicates the project path used for this response set. This value is read-only. :df:`delete(foldername)` Removes a variable set for the given :a:`foldername`. :df:`description(foldername)` Returns the description for the given :a:`foldername`. If the :a:`foldername` is not present a :e:`ResponseVarError` is generated. :df:`last_modified(foldername)` Returns the last modified time for the :a:`foldername` as the number of seconds since the start of the epoch. This is usable with Python's :f:`time.gmtime` [#python-time]_ function. If the :a:`foldername` has no last modified time this function will return -1. :df:`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 :f:`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. :df:`load([folder])` Returns the responsevars, in dictionary format, for the given :a:`folder`. If the :a:`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. :df:`meta_info(foldername)` Returns a :c:`MetaResponseInfo` object for the given foldername. :df:`meta_listing()` Returns a list of :c:`MetaResponseInfo` objects. These objects give meta information about the responses sets defined for the :c:`ResponseVar` object. :df:`save([folder, description, variables])` Stores a variable list under the specified :a:`folder`. Arguments: :a:`folder` : string Name of the folder you want to save the variable map under. If not specified this assumed to be 'default'. :a:`description` : string Description of that folder. If not set, this is will be set to 'default'. :a:`variables` : dictionary A dictionary of the variables that you wish to store. The format is the same as the one you get from :f:`load()`. .. Note:: Typically the variables would come from something like :f:`rtv.getvariablemap()`. ---------------------- MetaResponseInfo Class ---------------------- class :dc:`MetaResponseInfo(foldername, description, lastmodified)` This is returned by the :c:`ResponseVar` object's :f:`meta_listing` function. It defines the meta information for one folder defined within the :c:`ResponseVar` object. This object should not be created directly. :dd:`foldername` Defines the name of the folder. This is also known as the *Response Set Name*. :dd:`description` The description of the folder. :dd:`lastmodified` Defines the time in seconds since the start of the epoch since the folder was last modified. This value is useable with the :f:`time.gmtime` [#python-time]_ function. --------- Exception --------- exception :de:`ResponseVarError` Accounts for errors having to do with ResponseVar manipulation. --------- Reference --------- .. [#python-time] "time -- Time access and conversions" *Python Library Reference*. 19 December 2003. 9 September 2004. .. _grail.rtv: ../lib-grail-rtv.html