mailr4718 - in /branches/N_state_model: ./ specific_fns/base_class.py


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

Header


Content

Posted by edward on January 15, 2008 - 11:13:
Author: bugman
Date: Tue Jan 15 11:13:58 2008
New Revision: 4718

URL: http://svn.gna.org/viewcvs/relax?rev=4718&view=rev
Log:
Merged revisions 4712-4716 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r4712 | bugman | 2008-01-15 10:46:52 +0100 (Tue, 15 Jan 2008) | 3 lines
  
  Removed the empty __init__() method and shifted its docstring to that of 
the class.
........
  r4713 | bugman | 2008-01-15 10:47:09 +0100 (Tue, 15 Jan 2008) | 3 lines
  
  Removed an orphaned comment.
........
  r4714 | bugman | 2008-01-15 10:50:04 +0100 (Tue, 15 Jan 2008) | 3 lines
  
  Updated the base class method has_errors() to the new relax design.
........
  r4715 | bugman | 2008-01-15 10:52:45 +0100 (Tue, 15 Jan 2008) | 3 lines
  
  Updated the return_data() and return_error() base class methods to the new 
relax design.
........
  r4716 | bugman | 2008-01-15 10:54:47 +0100 (Tue, 15 Jan 2008) | 3 lines
  
  Updated the base class method sim_return_selected() to the new relax design.
........

Modified:
    branches/N_state_model/   (props changed)
    branches/N_state_model/specific_fns/base_class.py

Propchange: branches/N_state_model/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: branches/N_state_model/specific_fns/base_class.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/specific_fns/base_class.py?rev=4718&r1=4717&r2=4718&view=diff
==============================================================================
--- branches/N_state_model/specific_fns/base_class.py (original)
+++ branches/N_state_model/specific_fns/base_class.py Tue Jan 15 11:13:58 2008
@@ -25,58 +25,71 @@
 
 # relax module imports.
 from data import Data as relax_data_store
+from generic_fns.selection import spin_loop
 from relax_errors import RelaxError, RelaxParamSetError
 
 
-# The relax data storage object.
-
 
 class Common_functions:
-    def __init__(self):
-        """Base class containing functions common to the specific 
functions."""
-
+    """Base class containing simple methods used by some a number of the 
specific analysis types."""
 
     def has_errors(self):
-        """Function for testing if errors exist for the run."""
+        """Function for testing if errors exist for the run.
+
+        @return:    The answer to the question of whether errors exist.
+        @rtype:     bool
+        """
+
+        # Alias the current data pipe.
+        cdp = relax_data_store[relax_data_store.current_pipe]
 
         # Diffusion tensor errors.
-        if relax_data_store.diff.has_key(self.run):
-            for object_name in dir(relax_data_store.diff[self.run]):
+        if hasattr(cdp, 'diff'):
+            for object_name in dir(cdp.diff):
                 # The object error name.
                 object_error = object_name + '_err'
 
                 # Error exists.
-                if hasattr(relax_data_store.diff[self.run], object_error):
-                    return 1
+                if hasattr(cdp.diff, object_error):
+                    return True
 
         # Loop over the sequence.
-        for i in xrange(len(relax_data_store.res[self.run])):
-            # Reassign data structure.
-            data = relax_data_store.res[self.run][i]
-
+        for spin in spin_loop():
             # Parameter errors.
-            for object_name in dir(data):
+            for object_name in dir(spin):
                 # The object error name.
                 object_error = object_name + '_err'
 
                 # Error exists.
-                if hasattr(data, object_error):
-                    return 1
+                if hasattr(spin, object_error):
+                    return True
 
         # No errors found.
-        return 0
-
-
-    def return_data(self, run, i):
-        """Function for returning the Ri data structure."""
-
-        return relax_data_store.res[run][i].relax_data
-
-
-    def return_error(self, run, i):
-        """Function for returning the Ri error structure."""
-
-        return relax_data_store.res[run][i].relax_error
+        return False
+
+
+    def return_data(self, spin):
+        """Function for returning the Ri data structure for the given spin.
+
+        @param spin:    The SpinContainer object.
+        @type spin:     SpinContainer instance
+        @return:        The array of relaxation data values.
+        @rtype:         list of float
+        """
+
+        return spin.relax_data
+
+
+    def return_error(self, spin):
+        """Function for returning the Ri error structure for the given spin.
+
+        @param spin:    The SpinContainer object.
+        @type spin:     SpinContainer instance
+        @return:        The array of relaxation data error values.
+        @rtype:         list of float
+        """
+
+        return spin.relax_error
 
 
     def return_value(self, spin, param, sim=None):
@@ -382,11 +395,14 @@
             inc = inc + 1
 
 
-    def sim_return_selected(self, run, index):
-        """Function for returning the array of selected simulation flags."""
-
-        # Arguments.
-        self.run = run
+    def sim_return_selected(self, spin):
+        """Function for returning the array of selected simulation flags for 
the given spin.
+
+        @param spin:    The SpinContainer object.
+        @type spin:     SpinContainer instance
+        @return:        The array of selected simulation flags.
+        @rtype:         list of int
+        """
 
         # Return the array.
-        return relax_data_store.res[self.run][index].select_sim
+        return spin.select_sim




Related Messages


Powered by MHonArc, Updated Tue Jan 15 11:20:06 2008