Package data :: Class Relax_data_store
[hide private]
[frames] | no frames]

Class Relax_data_store

source code


The relax data storage object.

Instance Methods [hide private]
 
__repr__(self)
The string representation of the object.
source code
 
__reset__(self)
Delete all the data from the relax data storage object.
source code
 
add(self, pipe_name, pipe_type, switch=True)
Method for adding a new data pipe container to the dictionary.
source code
bool
is_empty(self)
Method for testing if the relax data store is empty.
source code
 
from_xml(self, file, dir=None, pipe_to=None, verbosity=1)
Parse a XML document representation of a data pipe, and load it into the relax data store.
source code
 
to_xml(self, file, pipes=None)
Create a XML document representation of the current data pipe.
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __init__, __iter__, __le__, __len__, __lt__, __ne__, __setitem__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(self, *args, **kargs)
Replacement function for implementing the singleton design pattern.
source code
Class Variables [hide private]
  current_pipe = None
hash(x)
  instance = The relax data storage obje...

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__new__(self, *args, **kargs)
Static Method

source code 

Replacement function for implementing the singleton design pattern.

Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(self)
(Representation operator)

source code 

The string representation of the object.

Rather than using the standard Python conventions (either the string representation of the value or the "<...desc...>" notation), a rich-formatted description of the object is given.

Overrides: object.__repr__

__reset__(self)

source code 

Delete all the data from the relax data storage object.

This method is to make the current single instance of the Data object identical to a newly created instance of Data, hence resetting the relax program state.

add(self, pipe_name, pipe_type, switch=True)

source code 

Method for adding a new data pipe container to the dictionary.

This method should be used rather than importing the PipeContainer class and using the statement 'D[pipe] = PipeContainer()', where D is the relax data storage object and pipe is the name of the data pipe.

Parameters:
  • pipe_name (str) - The name of the new data pipe.
  • pipe_type (str) - The data pipe type.
  • switch (bool) - A flag which if True will cause the new data pipe to be set to the current data pipe.

is_empty(self)

source code 

Method for testing if the relax data store is empty.

Returns: bool
True if the data store is empty, False otherwise.

from_xml(self, file, dir=None, pipe_to=None, verbosity=1)

source code 

Parse a XML document representation of a data pipe, and load it into the relax data store.

Parameters:
  • file (file) - The open file object.
  • dir (str) - The name of the directory containing the results file (needed for loading external files).
  • pipe_to (str) - The data pipe to load the XML data pipe into (the file must only contain one data pipe).
  • verbosity (int) - A flag specifying the amount of information to print. The higher the value, the greater the verbosity.
Raises:
  • RelaxError - If pipe_to is given and the file contains multiple pipe elements; or if the data pipes in the XML file already exist in the relax data store; or if the data pipe type is invalid; or if the target data pipe is not empty.
  • RelaxNoPipeError - If pipe_to is given but the data pipe does not exist.
  • RelaxError - If the data pipes in the XML file already exist in the relax data store, or if the data pipe type is invalid.
  • RelaxPipeError - If the data pipes of the XML file are already present in the relax data store.

to_xml(self, file, pipes=None)

source code 

Create a XML document representation of the current data pipe.

This method creates the top level XML document including all the information needed about relax, calls the PipeContainer.xml_write() method to fill in the document contents, and writes the XML into the file object.

Parameters:
  • file (file) - The open file object.
  • pipes (str or list of str) - The name of the pipe, or list of pipes to place in the XML file.

Class Variable Details [hide private]

instance

Value:
The relax data storage object.

Data pipes:
  None

Data store objects:
  __dict__ <type 'dict'>: dict() -> new empty dictionary
  __doc__ <type 'str'>: The relax data storage object.
...