mailr5730 - /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 15, 2008 - 22:17:
Author: bugman
Date: Tue Apr 15 22:12:42 2008
New Revision: 5730

URL: http://svn.gna.org/viewcvs/relax?rev=5730&view=rev
Log:
Updated the model-free num_instances() method to the new relax design.


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=5730&r1=5729&r2=5730&view=diff
==============================================================================
--- 1.3/specific_fns/model_free/model_free.py (original)
+++ 1.3/specific_fns/model_free/model_free.py Tue Apr 15 22:12:42 2008
@@ -33,7 +33,7 @@
 from data import Data as relax_data_store
 from float import isNaN,isInf
 from generic_fns import diffusion_tensor
-from generic_fns.selection import exists_mol_res_spin_data, spin_loop
+from generic_fns.selection import count_spins, exists_mol_res_spin_data, 
spin_loop
 from maths_fns.mf import Mf
 from minimise.generic import generic_minimise
 from physical_constants import N15_CSA, NH_BOND_LENGTH
@@ -1627,25 +1627,28 @@
         return k, n, chi2
 
 
-    def num_instances(self, run=None):
-        """Function for returning the number of instances."""
-
-        # Arguments.
-        self.run = run
-
-        # Test if sequence data is loaded.
-        if not relax_data_store.res.has_key(self.run):
+    def num_instances(self):
+        """Function for returning the number of instances.
+
+        @return:    The number of instances used for optimisation.  Either 
the number of spins if
+                    the local optimisations are setup ('mf' and 'local_tm'), 
or 1 for the global
+                    models.
+        @rtype:     int
+        """
+
+        # Test if sequence data exists.
+        if not exists_mol_res_spin_data():
             return 0
 
         # Determine the parameter set type.
-        self.param_set = self.determine_param_set_type()
+        param_set = self.determine_param_set_type()
 
         # Sequence specific data.
-        if self.param_set == 'mf' or self.param_set == 'local_tm':
-            return len(relax_data_store.res[self.run])
+        if param_set == 'mf' or param_set == 'local_tm':
+            return count_spins()
 
         # Other data.
-        elif self.param_set == 'diff' or self.param_set == 'all':
+        elif param_set == 'diff' or param_set == 'all':
             return 1
 
         # Should not be here.




Related Messages


Powered by MHonArc, Updated Tue Apr 15 22:40:19 2008