mailr6402 - /1.3/generic_fns/xml_data_pipe.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on June 22, 2008 - 16:18:
Author: bugman
Date: Sun Jun 22 16:07:46 2008
New Revision: 6402

URL: http://svn.gna.org/viewcvs/relax?rev=6402&view=rev
Log:
Added the structural information to the XML results 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=6402&r1=6401&r2=6402&view=diff
==============================================================================
--- 1.3/generic_fns/xml_data_pipe.py (original)
+++ 1.3/generic_fns/xml_data_pipe.py Sun Jun 22 16:07:46 2008
@@ -100,6 +100,24 @@
 
     # Return the pipe element.
     return pipe_elem
+
+
+def create_str_elem(doc, elem):
+    """Create an element for the structural information.
+
+    @param doc:     The XML document object.
+    @type doc:      xml.dom.minidom.Document instance
+    @param elem:    The element to add the structural info to.
+    @type elem:     XML element object
+    """
+
+    # Create the structural element and add it to the higher level element.
+    str_elem = doc.createElement('structure')
+    elem.appendChild(str_elem)
+
+    # Set the structural attributes.
+    str_elem.setAttribute('desc', 'Structural information')
+    str_elem.setAttribute('id', ds[ds.current_pipe].structure.id)
 
 
 def create_top_level(doc):
@@ -178,6 +196,9 @@
     @type file:         file
     """
 
+    # The current data pipe.
+    cdp = ds[ds.current_pipe]
+
     # Create the XML document object.
     xmldoc = xml.dom.minidom.Document()
 
@@ -191,13 +212,17 @@
     global_elem = xmldoc.createElement('global')
     pipe_elem.appendChild(global_elem)
     global_elem.setAttribute('desc', 'Global data located in the top level 
of the data pipe')
-    fill_object_contents(xmldoc, global_elem, object=ds[ds.current_pipe], 
blacklist=['diff_tensor', 'hybrid_pipes', 'is_empty', 'mol', 'pipe_type', 
'structure'])
+    fill_object_contents(xmldoc, global_elem, object=cdp, 
blacklist=['diff_tensor', 'hybrid_pipes', 'is_empty', 'mol', 'pipe_type', 
'structure'])
 
     # Hybrid info.
     create_hybrid_elem(xmldoc, pipe_elem)
 
     # Add the diffusion tensor data.
     create_diff_elem(xmldoc, pipe_elem)
+
+    # Add the structural data, if it exists.
+    if hasattr(cdp, 'structure'):
+        create_str_elem(xmldoc, pipe_elem)
 
     # Write out the XML file.
     xml.dom.ext.PrettyPrint(xmldoc, file)




Related Messages


Powered by MHonArc, Updated Sun Jun 22 16:20:11 2008