Author: bugman Date: Wed Aug 13 11:55:56 2008 New Revision: 7191 URL: http://svn.gna.org/viewcvs/relax?rev=7191&view=rev Log: Added the ability to reload alignment tensors from the XML results file into the relax data store. Modified: branches/rdc_analysis/data/align_tensor.py branches/rdc_analysis/data/pipe_container.py Modified: branches/rdc_analysis/data/align_tensor.py URL: http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/data/align_tensor.py?rev=7191&r1=7190&r2=7191&view=diff ============================================================================== --- branches/rdc_analysis/data/align_tensor.py (original) +++ branches/rdc_analysis/data/align_tensor.py Wed Aug 13 11:55:56 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, xml_to_object @@ -594,6 +594,22 @@ self.append(AlignTensorData(name)) + def from_xml(self, align_tensor_nodes): + """Recreate the alignment tensor data structure from the XML alignment tensor node. + + @param align_tensor_nodes: The alignment tensor XML nodes. + @type align_tensor_nodes: list of xml.dom.minicompat.Element instances + """ + + # Loop over the child nodes. + for align_tensor_node in align_tensor_nodes: + # Add the alignment tensor data container. + self.add_item(align_tensor_node.getAttribute('name')) + + # Recreate all the other data structures. + xml_to_object(align_tensor_node, self[-1]) + + def to_xml(self, doc, element): """Create an XML element for the alignment tensors. Modified: branches/rdc_analysis/data/pipe_container.py URL: http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/data/pipe_container.py?rev=7191&r1=7190&r2=7191&view=diff ============================================================================== --- branches/rdc_analysis/data/pipe_container.py (original) +++ branches/rdc_analysis/data/pipe_container.py Wed Aug 13 11:55:56 2008 @@ -24,6 +24,7 @@ from re import match # relax module imports. +from align_tensor import AlignTensorList from data_classes import Element from diff_tensor import DiffTensorData import generic_fns @@ -122,6 +123,16 @@ # Fill its contents. self.diff_tensor.from_xml(diff_tensor_nodes[0]) + # Get the alignment tensor data nodes and, if they exist, fill the contents. + align_tensor_super_node = relax_node.getElementsByTagName('align_tensors') + align_tensor_nodes = align_tensor_super_node[0].getElementsByTagName('align_tensor') + if align_tensor_nodes: + # Create the diffusion tensor object. + self.align_tensors = AlignTensorList() + + # Fill its contents. + self.align_tensors.from_xml(align_tensor_nodes) + # Recreate the molecule, residue, and spin data structure. mol_nodes = relax_node.getElementsByTagName('mol') self.mol.from_xml(mol_nodes)