Author: bugman Date: Sat Jun 28 23:22:42 2008 New Revision: 6541 URL: http://svn.gna.org/viewcvs/relax?rev=6541&view=rev Log: Created the DiffTensorData.from_xml() method. Modified: 1.3/data/diff_tensor.py Modified: 1.3/data/diff_tensor.py URL: http://svn.gna.org/viewcvs/relax/1.3/data/diff_tensor.py?rev=6541&r1=6540&r2=6541&view=diff ============================================================================== --- 1.3/data/diff_tensor.py (original) +++ 1.3/data/diff_tensor.py Sat Jun 28 23:22:42 2008 @@ -29,7 +29,7 @@ # relax module imports. from data_classes import Element from relax_errors import RelaxError -from relax_xml import fill_object_contents +from relax_xml import fill_object_contents, node_value_to_python, xml_to_object @@ -826,6 +826,20 @@ self.__dict__[target+'_sim'] = DiffTensorSimList(target, self) + def from_xml(self, diff_tensor_node): + """Recreate the diffusion tensor data structure from the XML diffusion tensor node. + + @param diff_tensor_node: The diffusion tensor XML node. + @type diff_tensor_node: xml.dom.minicompat.Element instance + """ + + # First set the diffusion type. Doing this first is essential for the proper reconstruction of the object. + setattr(self, 'type', str(diff_tensor_node.getAttribute('type'))) + + # Recreate all the other data structures. + xml_to_object(diff_tensor_node, self) + + def xml_create_element(self, doc, element): """Create an XML element for the diffusion tensor.