mailr6775 - in /1.3/data: mol_res_spin.py relax_xml.py


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

Header


Content

Posted by edward on July 06, 2008 - 02:23:
Author: bugman
Date: Sun Jul  6 01:54:56 2008
New Revision: 6775

URL: http://svn.gna.org/viewcvs/relax?rev=6775&view=rev
Log:
The IEEE-754 byte arrays are now restored from the results files, giving full 
precision.


Modified:
    1.3/data/mol_res_spin.py
    1.3/data/relax_xml.py

Modified: 1.3/data/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/data/mol_res_spin.py?rev=6775&r1=6774&r2=6775&view=diff
==============================================================================
--- 1.3/data/mol_res_spin.py (original)
+++ 1.3/data/mol_res_spin.py Sun Jul  6 01:54:56 2008
@@ -270,7 +270,7 @@
                 # Get the object.
                 object = getattr(self[i], name)
 
-                # Store floats as IEEE-754 byte arrays, for higher precision.
+                # Store floats as IEEE-754 byte arrays (for full precision 
storage).
                 if type(object) == float or type(object) == numpy.float64:
                     sub_element.setAttribute('ieee_754_byte_array', 
`floatAsByteArray(object)`)
 

Modified: 1.3/data/relax_xml.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/data/relax_xml.py?rev=6775&r1=6774&r2=6775&view=diff
==============================================================================
--- 1.3/data/relax_xml.py (original)
+++ 1.3/data/relax_xml.py Sun Jul  6 01:54:56 2008
@@ -29,7 +29,7 @@
 from string import strip
 
 # relax module imports.
-from float import floatAsByteArray
+from float import floatAsByteArray, packBytesAsPyFloat
 
 
 def fill_object_contents(doc, elem, object=None, blacklist=None):
@@ -66,7 +66,7 @@
         # Get the sub-object.
         subobj = getattr(object, name)
 
-        # Store floats as IEEE-754 byte arrays, for higher precision.
+        # Store floats as IEEE-754 byte arrays (for full precision storage).
         if type(subobj) == float or type(subobj) == float64:
             sub_elem.setAttribute('ieee_754_byte_array', 
`floatAsByteArray(subobj)`)
 
@@ -110,8 +110,14 @@
         # The name of the python object to recreate.
         name = str(node.localName)
 
+        # IEEE-754 floats (for full precision restoration).
+        ieee_array = node.getAttribute('ieee_754_byte_array')
+        if ieee_array:
+            val = packBytesAsPyFloat(eval(ieee_array))
+
         # Get the node contents.
-        val = node_value_to_python(node.childNodes[0])
+        else:
+            val = node_value_to_python(node.childNodes[0])
 
         # Set the value.
         setattr(base_object, name, val)




Related Messages


Powered by MHonArc, Updated Sun Jul 06 03:00:35 2008