mailr2739 - in /1.3: dx/isosurface_3D.py generic_fns/model_selection.py specific_fns/hybrid.py specific_fns/model_free.py


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

Header


Content

Posted by edward . dauvergne on November 04, 2006 - 08:08:
Author: bugman
Date: Sat Nov  4 08:08:14 2006
New Revision: 2739

URL: http://svn.gna.org/viewcvs/relax?rev=2739&view=rev
Log:
Ported r2738 from the 1.2 line.

The command used was:
svn merge -r2737:2738 svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.2

This fixes the massively important bug #7616 
(https://gna.org/bugs/index.php?7616) which is the
failure of the model selection between the global diffusion models when the 
local tm models are
included.


Modified:
    1.3/dx/isosurface_3D.py
    1.3/generic_fns/model_selection.py
    1.3/specific_fns/hybrid.py
    1.3/specific_fns/model_free.py

Modified: 1.3/dx/isosurface_3D.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/dx/isosurface_3D.py?rev=2739&r1=2738&r2=2739&view=diff
==============================================================================
--- 1.3/dx/isosurface_3D.py (original)
+++ 1.3/dx/isosurface_3D.py Sat Nov  4 08:08:14 2006
@@ -104,7 +104,7 @@
                     self.calculate(run=self.run, res_num=self.res_num, 
print_flag=0)
 
                     # Get the minimisation statistics for the model.
-                    k, n, chi2 = self.model_stats(run=self.run, 
instance=self.index, min_instances=1)
+                    k, n, chi2 = self.model_stats(run=self.run, 
instance=self.index)
 
                     # Set maximum value to 1e20 to stop the OpenDX server 
connection from breaking.
                     if chi2 > 1e20:

Modified: 1.3/generic_fns/model_selection.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/model_selection.py?rev=2739&r1=2738&r2=2739&view=diff
==============================================================================
--- 1.3/generic_fns/model_selection.py (original)
+++ 1.3/generic_fns/model_selection.py Sat Nov  4 08:08:14 2006
@@ -207,8 +207,14 @@
                     if self.skip_function[run](run=run, instance=i, 
min_instances=self.min_instances, num_instances=self.num_instances[j]):
                         continue
 
+                    # Global stats.
+                    if self.num_instances[j] > self.min_instances or 
self.num_instances[j] == 1:
+                        global_stats = 1
+                    else:
+                        global_stats = 0
+
                     # Get the model statistics.
-                    k, n, chi2 = self.model_statistics[run](run=run, 
instance=i, min_instances=self.min_instances)
+                    k, n, chi2 = self.model_statistics[run](run=run, 
instance=i, global_stats=global_stats)
 
                     # Missing data sets.
                     if k == None or n == None or chi2 == None:

Modified: 1.3/specific_fns/hybrid.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/hybrid.py?rev=2739&r1=2738&r2=2739&view=diff
==============================================================================
--- 1.3/specific_fns/hybrid.py (original)
+++ 1.3/specific_fns/hybrid.py Sat Nov  4 08:08:14 2006
@@ -89,7 +89,7 @@
         self.relax.data.hybrid_runs[hybrid] = runs
 
 
-    def model_statistics(self, run=None, instance=None, min_instances=None):
+    def model_statistics(self, run=None, instance=None, global_stats=None):
         """Function for returning the values k, n, and chi2 of the hybrid.
 
         k - number of parameters.
@@ -116,7 +116,7 @@
             # Loop over the instances.
             for i in xrange(num):
                 # Get the statistics.
-                k, n, chi2 = model_statistics(run, instance=i)
+                k, n, chi2 = model_statistics(run, instance=i, 
global_stats=global_stats)
 
                 # Bad stats.
                 if k == None or n == None or chi2 == None:

Modified: 1.3/specific_fns/model_free.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free.py?rev=2739&r1=2738&r2=2739&view=diff
==============================================================================
--- 1.3/specific_fns/model_free.py (original)
+++ 1.3/specific_fns/model_free.py Sat Nov  4 08:08:14 2006
@@ -2505,7 +2505,7 @@
             self.relax.data.res[run][i].params = params
 
 
-    def model_statistics(self, run=None, instance=None, min_instances=None):
+    def model_statistics(self, run=None, instance=None, global_stats=None):
         """Function for returning k, n, and chi2.
 
         k - number of parameters.
@@ -2517,11 +2517,12 @@
         self.run = run
 
         # Determine if local or global statistics will be returned.
-        global_stats = 1
-        for i in xrange(len(self.relax.data.res[self.run])):
-            if hasattr(self.relax.data.res[self.run][i], 'chi2') and 
self.relax.data.res[self.run][i].chi2 != None:
-                global_stats = 0
-                break
+        if global_stats == None:
+            global_stats = 1
+            for i in xrange(len(self.relax.data.res[self.run])):
+                if hasattr(self.relax.data.res[self.run][i], 'chi2') and 
self.relax.data.res[self.run][i].chi2 != None:
+                    global_stats = 0
+                    break
 
         # Determine the parameter set type.
         self.param_set = self.determine_param_set_type()
@@ -2554,6 +2555,7 @@
 
             # Count the number of data points.
             n = 0
+            chi2 = 0
             for i in xrange(len(self.relax.data.res[self.run])):
                 # Skip unselected residues.
                 if not self.relax.data.res[self.run][i].select:
@@ -2565,8 +2567,13 @@
 
                 n = n + len(self.relax.data.res[self.run][i].relax_data)
 
+                # Local tm models.
+                if self.param_set == 'local_tm':
+                    chi2 = chi2 + self.relax.data.res[self.run][i].chi2
+
             # The chi2 value.
-            chi2 = self.relax.data.chi2[self.run]
+            if self.param_set != 'local_tm':
+                chi2 = self.relax.data.chi2[self.run]
 
         # Return the data.
         return k, n, chi2




Related Messages


Powered by MHonArc, Updated Sat Nov 04 08:40:05 2006