mailr27204 - /trunk/specific_analyses/relax_disp/optimisation.py


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

Header


Content

Posted by tlinnet on January 16, 2015 - 23:19:
Author: tlinnet
Date: Fri Jan 16 23:19:51 2015
New Revision: 27204

URL: http://svn.gna.org/viewcvs/relax?rev=27204&view=rev
Log:
Stored the sums of squares of the residuals "sos" and standard deviation of 
this "sos_std" per spin after optimisation.

Task #7882 (https://gna.org/task/?7882): Implement Monte-Carlo simulation, 
where errors are generated with width of standard deviation or residuals.

Modified:
    trunk/specific_analyses/relax_disp/optimisation.py

Modified: trunk/specific_analyses/relax_disp/optimisation.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/optimisation.py?rev=27204&r1=27203&r2=27204&view=diff
==============================================================================
--- trunk/specific_analyses/relax_disp/optimisation.py  (original)
+++ trunk/specific_analyses/relax_disp/optimisation.py  Fri Jan 16 23:19:51 
2015
@@ -646,6 +646,9 @@
                 return
             param_vector, chi2, iter_count, f_count, g_count, h_count, 
warning = results
 
+            # Get the sum of squares of the residuals and the standard 
deviation of this.
+            sos, sos_std = model.get_sum_of_squares()
+
         # Optimisation printout.
         if self.verbosity:
             print("\nOptimised parameter values:")
@@ -653,7 +656,7 @@
                 print("%-20s %25.15f" % (self.param_names[i], 
param_vector[i]*self.scaling_matrix[i, i]))
 
         # Create the result command object to send back to the master.
-        processor.return_object(Disp_result_command(processor=processor, 
memo_id=self.memo_id, param_vector=param_vector, chi2=chi2, 
iter_count=iter_count, f_count=f_count, g_count=g_count, h_count=h_count, 
warning=warning, missing=self.missing, back_calc=model.get_back_calc(), 
completed=False))
+        processor.return_object(Disp_result_command(processor=processor, 
memo_id=self.memo_id, param_vector=param_vector, chi2=chi2, sos=sos, 
sos_std=sos_std, iter_count=iter_count, f_count=f_count, g_count=g_count, 
h_count=h_count, warning=warning, missing=self.missing, 
back_calc=model.get_back_calc(), completed=False))
 
 
 
@@ -663,7 +666,7 @@
     This object will be sent from the slave back to the master to have its 
run() method executed.
     """
 
-    def __init__(self, processor=None, memo_id=None, param_vector=None, 
chi2=None, iter_count=None, f_count=None, g_count=None, h_count=None, 
warning=None, missing=None, back_calc=None, completed=True):
+    def __init__(self, processor=None, memo_id=None, param_vector=None, 
chi2=None, sos=None, sos_std=None, iter_count=None, f_count=None, 
g_count=None, h_count=None, warning=None, missing=None, back_calc=None, 
completed=True):
         """Set up this class object on the slave, placing the minimisation 
results here.
 
         @keyword processor:     The processor object.
@@ -674,6 +677,10 @@
         @type param_vector:     numpy rank-1 array
         @keyword chi2:          The final target function value.
         @type chi2:             float
+        @keyword sos:           The sums of squares of residuals between 
measured values and fitted values.
+        @type sos:              float
+        @keyword sos_std:       The standard deviation of sums of squares of 
residuals between measured values and fitted values.
+        @type sos_std:          float
         @keyword iter_count:    The number of optimisation iterations.
         @type iter_count:       int
         @keyword f_count:       The total function call count.
@@ -699,6 +706,8 @@
         self.memo_id = memo_id
         self.param_vector = param_vector
         self.chi2 = chi2
+        self.sos = sos
+        self.sos_std = sos_std
         self.iter_count = iter_count
         self.f_count = f_count
         self.g_count = g_count
@@ -740,6 +749,12 @@
                 # Chi-squared statistic.
                 spin.chi2_sim[memo.sim_index] = self.chi2
 
+                # Sums of squares of residuals.
+                spin.sos_sim[memo.sim_index] = self.sos
+
+                # Standard deviation of sums of squares of residuals.
+                spin.sos_std_sim[memo.sim_index] = self.sos_std
+
                 # Iterations.
                 spin.iter_sim[memo.sim_index] = self.iter_count
 
@@ -765,6 +780,12 @@
                 # Chi-squared statistic.
                 spin.chi2 = self.chi2
 
+                # Sums of squares of residuals.
+                spin.sos = self.sos
+
+                # Standard deviation of sums of squares of residuals.
+                spin.sos_std = self.sos_std
+
                 # Iterations.
                 spin.iter = self.iter_count
 




Related Messages


Powered by MHonArc, Updated Fri Jan 16 23:20:02 2015