Author: bugman Date: Sun Jun 22 15:29:16 2008 New Revision: 6394 URL: http://svn.gna.org/viewcvs/relax?rev=6394&view=rev Log: The diffusion tensor info is now placed into the XML file. Modified: 1.3/generic_fns/xml_data_pipe.py Modified: 1.3/generic_fns/xml_data_pipe.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/xml_data_pipe.py?rev=6394&r1=6393&r2=6394&view=diff ============================================================================== --- 1.3/generic_fns/xml_data_pipe.py (original) +++ 1.3/generic_fns/xml_data_pipe.py Sun Jun 22 15:29:16 2008 @@ -31,6 +31,27 @@ # relax module imports. from data import Relax_data_store; ds = Relax_data_store() from version import version + + +def create_diff_elem(doc, elem): + """Create an element for the diffusion tensor. + + @param doc: The XML document object. + @type doc: xml.dom.minidom.Document instance + @param elem: The element to add the diffusion tensor element to. + @type elem: XML element object + """ + + # Create the diffusion tensor element and add it to the higher level element. + tensor_elem = doc.createElement('diff_tensor') + elem.appendChild(tensor_elem) + + # Set the diffusion tensor attributes. + tensor_elem.setAttribute('desc', 'Diffusion tensor') + tensor_elem.setAttribute('type', ds[ds.current_pipe].diff_tensor.type) + + # Add all simple python objects within the PipeContainer to the pipe element. + fill_object_contents(doc, tensor_elem, object=ds[ds.current_pipe].diff_tensor, blacklist=['is_empty', 'type']) def create_pipe_elem(doc, elem): @@ -136,5 +157,13 @@ # Add all simple python objects within the PipeContainer to the pipe element. fill_object_contents(xmldoc, pipe_elem, object=ds[ds.current_pipe], blacklist=['diff_tensor', 'hybrid_pipes', 'is_empty', 'mol', 'pipe_type', 'structure']) + # Add the diffusion tensor data. + create_diff_elem(xmldoc, pipe_elem) + # Write out the XML file. xml.dom.ext.PrettyPrint(xmldoc, file) + + # Print out. + print ds[ds.current_pipe].diff_tensor + print "\n\nXML:" + xml.dom.ext.PrettyPrint(xmldoc)