mailr6408 - in /1.3: data/pipe_container.py generic_fns/results.py 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:33:
Author: bugman
Date: Sun Jun 22 16:33:19 2008
New Revision: 6408

URL: http://svn.gna.org/viewcvs/relax?rev=6408&view=rev
Log:
Shifted the generic_fns.xml_data_pipe.write() fn to the 
PipeContainer.xml_write() method.


Modified:
    1.3/data/pipe_container.py
    1.3/generic_fns/results.py
    1.3/generic_fns/xml_data_pipe.py

Modified: 1.3/data/pipe_container.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/data/pipe_container.py?rev=6408&r1=6407&r2=6408&view=diff
==============================================================================
--- 1.3/data/pipe_container.py (original)
+++ 1.3/data/pipe_container.py Sun Jun 22 16:33:19 2008
@@ -129,3 +129,48 @@
 
         # The data pipe is empty.
         return True
+
+
+    def xml_write(self, file):
+        """Create a XML document representation of the current data pipe.
+
+        @param file:        The open file object.
+        @type file:         file
+        """
+
+        # The current data pipe.
+        cdp = ds[ds.current_pipe]
+
+        # Create the XML document object.
+        xmldoc = xml.dom.minidom.Document()
+
+        # Create the top level element.
+        top_elem = create_top_level(xmldoc)
+
+        # Create the data pipe element.
+        pipe_elem = create_pipe_elem(xmldoc, top_elem)
+
+        # Add all simple python objects within the PipeContainer to the 
global element.
+        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=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.
+        if hasattr(cdp, 'diff_tensor'):
+            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)
+
+        # Print out.
+        print ds[ds.current_pipe]
+        print "\n\nXML:"
+        xml.dom.ext.PrettyPrint(xmldoc)

Modified: 1.3/generic_fns/results.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/results.py?rev=6408&r1=6407&r2=6408&view=diff
==============================================================================
--- 1.3/generic_fns/results.py (original)
+++ 1.3/generic_fns/results.py Sun Jun 22 16:33:19 2008
@@ -25,7 +25,6 @@
 
 # relax module imports.
 from data import Relax_data_store; ds = Relax_data_store()
-from generic_fns import xml_data_pipe
 from relax_errors import RelaxError, RelaxFileEmptyError, RelaxNoPipeError
 from relax_io import extract_data, open_write_file, strip
 from specific_fns.setup import get_specific_fn, get_string
@@ -64,7 +63,7 @@
 
     # Specific results writing function.
     if format == 'xml':
-        self.write_function = xml_data_pipe.write
+        self.write_function = ds[ds.current_pipe].xml_write
     elif format == 'columnar':
         self.write_function = 
self.relax.specific_setup.setup('write_columnar_results', function_type, 
raise_error=0)
     else:
@@ -87,7 +86,7 @@
 
     # Specific results writing function.
     if format == 'xml':
-        read_function = xml_data_pipe.read
+        read_function = ds[ds.current_pipe].xml_read
     elif format == 'columnar':
         read_function = get_specific_fn('read_columnar_results', 
ds[ds.current_pipe].pipe_type, raise_error=False)
     else:
@@ -128,7 +127,7 @@
 
     # Specific results writing function.
     if format == 'xml':
-        write_function = xml_data_pipe.write
+        write_function = ds[ds.current_pipe].xml_write
     elif format == 'columnar':
         write_function = get_specific_fn('write_columnar_results', 
ds[ds.current_pipe].pipe_type, raise_error=False)
     else:

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=6408&r1=6407&r2=6408&view=diff
==============================================================================
--- 1.3/generic_fns/xml_data_pipe.py (original)
+++ 1.3/generic_fns/xml_data_pipe.py Sun Jun 22 16:33:19 2008
@@ -188,48 +188,3 @@
                         the greater the verbosity.
     @type verbosity:    int
     """
-
-
-def write(file):
-    """Create a XML document representation of the current data pipe.
-
-    @param file:        The open file object.
-    @type file:         file
-    """
-
-    # The current data pipe.
-    cdp = ds[ds.current_pipe]
-
-    # Create the XML document object.
-    xmldoc = xml.dom.minidom.Document()
-
-    # Create the top level element.
-    top_elem = create_top_level(xmldoc)
-
-    # Create the data pipe element.
-    pipe_elem = create_pipe_elem(xmldoc, top_elem)
-
-    # Add all simple python objects within the PipeContainer to the global 
element.
-    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=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.
-    if hasattr(cdp, 'diff_tensor'):
-        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)
-
-    # Print out.
-    print ds[ds.current_pipe]
-    print "\n\nXML:"
-    xml.dom.ext.PrettyPrint(xmldoc)




Related Messages


Powered by MHonArc, Updated Sun Jun 22 16:40:14 2008