mailr5790 - /1.3/specific_fns/model_free/model_free.py


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

Header


Content

Posted by edward on April 16, 2008 - 17:32:
Author: bugman
Date: Wed Apr 16 17:32:14 2008
New Revision: 5790

URL: http://svn.gna.org/viewcvs/relax?rev=5790&view=rev
Log:
Fixes and improvements to the model-free model_statistics() method.


Modified:
    1.3/specific_fns/model_free/model_free.py

Modified: 1.3/specific_fns/model_free/model_free.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/model_free.py?rev=5790&r1=5789&r2=5790&view=diff
==============================================================================
--- 1.3/specific_fns/model_free/model_free.py (original)
+++ 1.3/specific_fns/model_free/model_free.py Wed Apr 16 17:32:14 2008
@@ -1561,16 +1561,20 @@
                 spin.params = params
 
 
-    def model_statistics(self, instance=None, global_stats=None):
-        """Function for returning k, n, and chi2.
+    def model_statistics(self, instance=None, spin_id=None, 
global_stats=None):
+        """Return the k, n, and chi2 model statistics.
 
         k - number of parameters.
         n - number of data points.
         chi2 - the chi-squared value.
 
 
-        @keyword instance:      This is the optimisation instance index.
-        @type instance:         int
+        @keyword instance:      This is the optimisation instance index.  
Either this or the spin_id
+                                keyword argument must be supplied.
+        @type instance:         None or int
+        @keyword spin_id:       The spin identification string.  Either this 
or the instance keyword
+                                argument must be supplied.
+        @type spin_id:          None or str
         @keyword global_stats:  A parameter which determines if global or 
local statistics are
                                 returned.  If None, then the appropriateness 
of global or local
                                 statistics is automatically determined.
@@ -1581,6 +1585,12 @@
         @rtype:                 tuple of (int, int, float)
         """
 
+        # Bad argument combination.
+        if instance == None and spin_id == None:
+            raise RelaxError, "Either the instance or spin_id argument must 
be supplied."
+        elif instance != None and spin_id != None:
+            raise RelaxError, "The instance arg " + `instance` + " and 
spin_id arg " + `spin_id` + " clash.  Only one should be supplied."
+
         # Determine if local or global statistics will be returned.
         if global_stats == None:
             global_stats = 1
@@ -1595,7 +1605,10 @@
         # Statistics for a single residue.
         if not global_stats:
             # Get the SpinContainer.
-            spin = return_spin_from_index(instance)
+            if spin_id:
+                spin = return_spin(spin_id)
+            else:
+                spin = return_spin_from_index(instance)
 
             # Skip unselected residues.
             if not spin.select:
@@ -1606,7 +1619,7 @@
                 return None, None, None
 
             # Count the number of parameters.
-            param_vector = self.assemble_param_vector(index=instance)
+            param_vector = self.assemble_param_vector(spin=spin)
             k = len(param_vector)
 
             # Count the number of data points.




Related Messages


Powered by MHonArc, Updated Wed Apr 16 18:40:11 2008