mailr27782 - /trunk/data_store/align_tensor.py


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

Header


Content

Posted by edward on March 05, 2015 - 11:02:
Author: bugman
Date: Thu Mar  5 11:02:08 2015
New Revision: 27782

URL: http://svn.gna.org/viewcvs/relax?rev=27782&view=rev
Log:
Huge speed up for loading results and state files with Monte Carlo simulation 
alignment tensors.

The reading of the alignment tensor component of XML formatted results and 
state files has been
modified.  Previously the 
data_store.align_tensor.AlignTensorData._update_object() method for
updating the alignment tensor object (for values, errors, simulations) was 
being called once for
each Monte Carlo simulation.  Now is it called only once for all simulations. 
 In one test, the
reading of the save file with 500 simulations dropped from 253.7 to 10.0 
seconds.


Modified:
    trunk/data_store/align_tensor.py

Modified: trunk/data_store/align_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/data_store/align_tensor.py?rev=27782&r1=27781&r2=27782&view=diff
==============================================================================
--- trunk/data_store/align_tensor.py    (original)
+++ trunk/data_store/align_tensor.py    Thu Mar  5 11:02:08 2015
@@ -1129,11 +1129,11 @@
 
                 # Normal parameters.
                 if category == 'val':
-                    self[-1].set(param=param, value=value)
+                    self[-1].set(param=param, value=value, 
category=category, update=False)
 
                 # Errors.
                 elif category == 'err':
-                    self[-1].set(param=param, value=value, category='err')
+                    self[-1].set(param=param, value=value, 
category=category, update=False)
 
                 # Simulation objects objects.
                 else:
@@ -1143,7 +1143,11 @@
 
                     # Recreate the list elements.
                     for i in range(len(value)):
-                        self[-1].set(param=param, value=value[i], 
category='sim', sim_index=i)
+                        self[-1].set(param=param, value=value[i], 
category=category, sim_index=i, update=False)
+
+                # Update the data structures.
+                for target, update_if_set, depends in dependency_generator():
+                    self[-1]._update_object(param, target, update_if_set, 
depends, category)
 
             # Delete the temporary object.
             del temp_obj
@@ -1375,7 +1379,7 @@
                         self.__dict__[target+'_sim']._set(value=value, 
sim_index=i)
 
 
-    def set(self, param=None, value=None, category='val', sim_index=None):
+    def set(self, param=None, value=None, category='val', sim_index=None, 
update=True):
         """Set a alignment tensor parameter.
 
         @keyword param:     The name of the parameter to set.
@@ -1386,6 +1390,8 @@
         @type category:     str
         @keyword sim_index: The index for a Monte Carlo simulation for 
simulated parameter.
         @type sim_index:    int or None
+        @keyword update:    A flag which if True will cause all the 
alignment tensor objects to be updated correctly.  This can be turned off for 
speed, as long as the _update_object() method is called prior to using the 
tensor.
+        @type update:       bool
         """
 
         # Check the type.
@@ -1428,8 +1434,9 @@
             return
 
         # Update the data structures.
-        for target, update_if_set, depends in dependency_generator():
-            self._update_object(param, target, update_if_set, depends, 
category)
+        if update:
+            for target, update_if_set, depends in dependency_generator():
+                self._update_object(param, target, update_if_set, depends, 
category)
 
 
     def set_fixed(self, flag):




Related Messages


Powered by MHonArc, Updated Thu Mar 05 15:00:03 2015