Package MDSplus :: Module tree :: Class Tree
[frames | no frames]

Type Tree

object --+
         |
        Tree

Known Subclasses:
CachedTree

Open an MDSplus Data Storage Hierarchy
Method Summary
  __init__(self, tree, shot, mode)
Create a Tree instance.
None __del__(self)
Delete Tree instance
various __getattr__(self, name)
Implements value=tree.attribute
None __setattr__(self, name, value)
Implements tree.attribute=value
str __str__(self)
Return string representation
TreeNode addDevice(self, nodename, model)
Add a device to the tree of the specified device model type.
TreeNode addNode(self, nodename, usage)
Add a node to the tree.
None createPulse(self, shot)
Create pulse.
None deleteNode(self, wild)
Delete nodes (and all their descendants) from the tree.
None deletePulse(self, shot)
Delete pulse.
  doMethod(nid, method)
For internal use only. (Static method)
None edit(self)
Open tree for editing.
ndarray findTags(self, wild)
Find tags matching wildcard expression
Tree getActiveTree()
Get active tree. (Static method)
int getCurrent(treename)
Return current shot for specificed treename (Static method)
TreeNode getDefault(self)
Return current default TreeNode
TreeNode getNode(self, name)
Locate node in tree.
TreeNodeArray getNodeWild(self, name, *usage)
Find nodes in tree using a wildcard specification.
str getVersionDate()
Get date used for retrieving versions (Static method)
bool isModified(self)
Check to see if tree is open for edit and has been modified
bool isOpenForEdit(self)
Check to see if tree is open for edit
bool isReadOnly(self)
Check to see if tree was opened readonly
  lock(cls)
Internal use only. (Class method)
None quit(self)
Close edit session discarding node structure and tag changes.
None removeTag(self, tag)
Remove a tagname from the tree
  restoreContext(self)
Internal use only.
Tree setActiveTree(cls, tree)
Set active tree. (Class method)
  setCurrent(treename, shot)
Set current shot for specified treename (Static method)
TreeNode setDefault(self, node)
Set current default TreeNode.
None setTimeContext(begin, end, delta)
Set time context for retrieving segmented records (Static method)
None setVersionDate(date)
Set date for retrieving versions if versioning is enabled in tree. (Static method)
None setVersionsInModel(self, flag)
Enable/Disable versions in model
None setVersionsInPulse(self, flag)
Enable/Disable versions in pulse
  unlock(cls)
Internal use only. (Class method)
  usePrivateCtx(cls, on)
(Class method)
bool versionsInModelEnabled(self)
Check to see if versions in the model are enabled
bool versionsInPulseEnabled(self)
Check to see if versions in the pulse are enabled
None write(self)
Write out edited tree.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)

Instance Method Details

__init__(self, tree=None, shot=-1, mode='NORMAL')
(Constructor)

Create a Tree instance. Specify a tree and shot and optionally a mode. If providing the mode argument it should be one of the following strings: 'Normal','Edit','New','ReadOnly'. If no arguments provided, create instance of the active tree. (i.e. Tree())
Parameters:
tree - Name of tree to open
           (type=str)
shot - Shot number
           (type=int)
mode - Optional mode, one of 'Normal','Edit','New','Readonly'
           (type=str)
Overrides:
__builtin__.object.__init__

__del__(self)
(Destructor)

Delete Tree instance
Returns:
None

__getattr__(self, name)
(Qualification operator)

Implements value=tree.attribute

Attributes defined:
  • default - TreeNode, Current default node
  • modified - bool, True if tree structure has been modified
  • name - str, Tree name
  • open_for_edit - bool, True if tree open for edit
  • open_readonly - boo, True if tree was opened readonly
  • shot - int, Shot number
  • shotid - int, Shot number
  • tree - str, Tree name
  • versions_in_model - bool, True if versions enabled in the model
  • versions_in_pulse - bool, True if versions enabled in the pulse
Parameters:
name - Name of attribute
           (type=str)
Returns:
Value of attribute
           (type=various)

__setattr__(self, name, value)

Implements tree.attribute=value

Attributes defined:
  • default - TreeNode, default node in tree
  • versions_in_model - bool, True to enable versions in model
  • versions_in_pulse - bool, True to enable versions in pulse
Parameters:
name - Name of attribute to set
           (type=str)
value - Value of attribute
           (type=various)
Returns:
None
Overrides:
__builtin__.object.__setattr__

__str__(self)
(Informal representation operator)

Return string representation
Returns:
String representation of open tree
           (type=str)
Overrides:
__builtin__.object.__str__

addDevice(self, nodename, model)

Add a device to the tree of the specified device model type.
Parameters:
nodename - Absolute or relative path specification of the head node of the device. All ancestors of node must exist.
           (type=str)
model - Model name of the device being added.
           (type=str)
Returns:
Head node of device added
           (type=TreeNode)

addNode(self, nodename, usage='ANY')

Add a node to the tree. Tree must be in edit mode.
Parameters:
nodename - Absolute or relative path specification of new node. All ancestors of node must exist.
           (type=str)
usage - Usage of node.
           (type=str)
Returns:
Node created.
           (type=TreeNode)

createPulse(self, shot)

Create pulse.
Parameters:
shot - Shot number to create
           (type=int)
Returns:
None

deleteNode(self, wild)

Delete nodes (and all their descendants) from the tree. Note: If node is a member of a device, all nodes from that device are also deleted as well as any descendants that they might have.
Parameters:
wild - Wildcard path speficier of nodes to delete from tree.
           (type=str)
Returns:
None

deletePulse(self, shot)

Delete pulse.
Parameters:
shot - Shot number to delete
           (type=int)
Returns:
None

edit(self)

Open tree for editing.
Returns:
None

findTags(self, wild)

Find tags matching wildcard expression
Parameters:
wild - wildcard string to match tagnames.
           (type=str)
Returns:
Array of tag names matching wildcard expression
           (type=ndarray)

getDefault(self)

Return current default TreeNode
Returns:
Current default node
           (type=TreeNode)

getNode(self, name)

Locate node in tree. Returns TreeNode if found. Use double backslashes in node names.
Parameters:
name - Name of node. Absolute or relative path. No wildcards.
           (type=str)
Returns:
Node if found
           (type=TreeNode)

getNodeWild(self, name, *usage)

Find nodes in tree using a wildcard specification. Returns TreeNodeArray if nodes found.
Parameters:
name - Node name. May include wildcards.
           (type=str)
usage - Optional list of node usages (i.e. "Numeric","Signal",...). Reduces return set by including only nodes with these usages.
           (type=str)
Returns:
TreeNodeArray of nodes matching the wildcard path specification and usage types.
           (type=TreeNodeArray)

isModified(self)

Check to see if tree is open for edit and has been modified
Returns:
True if tree structure has been modified.
           (type=bool)

isOpenForEdit(self)

Check to see if tree is open for edit
Returns:
True if tree is open for edit
           (type=bool)

isReadOnly(self)

Check to see if tree was opened readonly
Returns:
True if tree is open readonly
           (type=bool)

quit(self)

Close edit session discarding node structure and tag changes.
Returns:
None

removeTag(self, tag)

Remove a tagname from the tree
Parameters:
tag - Tagname to remove.
           (type=str)
Returns:
None

restoreContext(self)

Internal use only. Use internal context associated with this tree.

setDefault(self, node)

Set current default TreeNode.
Parameters:
node - Node to make current default. Relative node paths will use the current default when resolving node lookups.
           (type=TreeNode)
Returns:
Previous default node
           (type=TreeNode)

setVersionsInModel(self, flag)

Enable/Disable versions in model
Parameters:
flag - True or False. True enables versions
           (type=bool)
Returns:
None

setVersionsInPulse(self, flag)

Enable/Disable versions in pulse
Parameters:
flag - True or False. True enabled versions
           (type=bool)
Returns:
None

versionsInModelEnabled(self)

Check to see if versions in the model are enabled
Returns:
True if versions in model is enabled
           (type=bool)

versionsInPulseEnabled(self)

Check to see if versions in the pulse are enabled
Returns:
True if versions in pulse is enabled
           (type=bool)

write(self)

Write out edited tree.
Returns:
None

Static Method Details

doMethod(nid, method)

For internal use only. Support for PyDoMethod.fun used for python device support

getActiveTree()

Get active tree.
Returns:
Current active tree
           (type=Tree)

getCurrent(treename)

Return current shot for specificed treename
Parameters:
treename - Name of tree
           (type=str)
Returns:
Current shot number for the specified tree
           (type=int)

getVersionDate()

Get date used for retrieving versions
Returns:
Reference date for retrieving data is versions enabled
           (type=str)

setCurrent(treename, shot)

Set current shot for specified treename
Parameters:
treename - Name of tree
           (type=str)
shot - Shot number
           (type=int @rtype None)

setTimeContext(begin, end, delta)

Set time context for retrieving segmented records
Parameters:
begin - Time value for beginning of segment.
           (type=Data)
end - Ending time value for segment of data
           (type=Data)
delta - Delta time for sampling segment
           (type=Data)
Returns:
None

setVersionDate(date)

Set date for retrieving versions if versioning is enabled in tree.
Parameters:
date - Reference date for data retrieval. Must be specified in the format: 'mmm-dd-yyyy hh:mm:ss' or 'now','today' or 'yesterday'.
           (type=str)
Returns:
None

Class Method Details

lock(cls)

Internal use only. Thread synchronization locking.

setActiveTree(cls, tree)

Set active tree. Use supplied tree context when performing tree operations in tdi expressions.
Parameters:
tree - Tree to use as active tree
           (type=Tree)
Returns:
Previous active tree
           (type=Tree)

unlock(cls)

Internal use only. Thread synchronization locking.

Generated by Epydoc 2.1 on Wed Aug 18 13:35:32 2010 http://epydoc.sf.net