RAVE
Lib.rave_info.INFO Class Reference
Inheritance diagram for Lib.rave_info.INFO:

Public Member Functions

 __init__ (self, tag="h5rad", attrib={}, **extra)
 
 __repr__ (self)
 
 eval (self, path=None)
 
 parse (self, filename)
 
 put (self, path, value)
 
 delete (self, path)
 
 asXML (self, file=None, encoding=ENCODING)
 
 pureXML (self, file, encoding=ENCODING)
 
 addDataset (self, prefix=None, set=None, **args)
 
 CopyDatasetAttributes (self, info, ipath='', oset=1)
 

Public Attributes

 tag = tag
 
 attrib = attrib.copy()
 

Protected Attributes

list _children = []
 

Detailed Description

Fundamental object for managing metadata.
Based almost entirely on Fredrik Lundh's ElementTree project.
http://effbot.org/zone/element-index.htm

Arguments:

Returns:

Constructor & Destructor Documentation

◆ __init__()

Lib.rave_info.INFO.__init__ ( self,
tag = "h5rad",
attrib = {},
** extra )
Initializes an INFO object.

Arguments:

Returns:

Member Function Documentation

◆ __repr__()

Lib.rave_info.INFO.__repr__ ( self)
Internal method; don't bother asking...

◆ addDataset()

Lib.rave_info.INFO.addDataset ( self,
prefix = None,
set = None,
** args )
Adds a dataset Group to this INFO.

Arguments:

Returns:

◆ asXML()

Lib.rave_info.INFO.asXML ( self,
file = None,
encoding = ENCODING )
Outputs a metadata representation of an INFO object to XML
with line breaks, either to file or to stdout.

Arguments:

Returns:

◆ CopyDatasetAttributes()

Lib.rave_info.INFO.CopyDatasetAttributes ( self,
info,
ipath = '',
oset = 1 )
Copies the contents of "self" to output "info" object, optionally
starting at "ipath". The output dataset attributes to write are given
by the "oset" argument. This will only work for non-recursive Elements,
ie. not for a complete INFO object. Suitable for copying the contents
of e.g. /imageN/what

Arguments:
INFO object: object to which attributes are copied
string ipath: absolute path to the element from which to copy
              attributes
int oset: index of the dataset, starting at 1, to which to write

Returns: nothing

◆ delete()

Lib.rave_info.INFO.delete ( self,
path )
Deletes infoset element specified by "path".

Arguments:
string path: The element to delete, given in the infoset format, ie.
             "/path/name".

Returns: Nothing if successful, otherwise exceptions cast by
         the ElementTree module if the data type is invalid or the
         payload is illegal. 

◆ eval()

Lib.rave_info.INFO.eval ( self,
path = None )
Evaluates the attribute given by "path" and returns it as its proper
type. This method queries the "type" attribute of the given Element
and uses it to cast the Element's text properly.
Opposite of the put() method.

Arguments:
  string path: the attribute's path. If this path doesn't exist in this
               INFO object, then an AttributeError exception is raised.

Returns: a Python int, float, string, or sequence, depending on
         the contents of the given attribute.

◆ parse()

Lib.rave_info.INFO.parse ( self,
filename )
Reads the contents XML file and adds them to this instance.

Arguments:
  string filename: the name of the file to parse.

  Returns: Nothing. NOTE that this method can only read XML
                    written by asXML() or pureXML().

◆ pureXML()

Lib.rave_info.INFO.pureXML ( self,
file,
encoding = ENCODING )
Outputs a metadata representation of an INFO object to XML
without line breaks, either to file or to stdout.

Arguments:

Returns:

◆ put()

Lib.rave_info.INFO.put ( self,
path,
value )
Creates and sets the value of a new infoset element. 

Arguments:
  string path: This is given in the infoset format, ie. "/path/name".
               If the payload already exists, it will be modified with
               the new value. If not, it will be created. Groups are
               created automatically.

  value: The value to set. This must be an int, float, string, or list
         of strings. numpy arrays will just be recycled...

Returns: Nothing if successful, a ValueError exception if the data
         type is invalid or the payload is illegal.

The documentation for this class was generated from the following file: