mailr4747 - in /branches/N_state_model: ./ specific_fns/base_class.py specific_fns/model_free/mf_minimise.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 - 14:51:
Author: bugman
Date: Tue Jan 15 14:51:37 2008
New Revision: 4747

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

........
  r4745 | bugman | 2008-01-15 14:40:06 +0100 (Tue, 15 Jan 2008) | 3 lines
  
  Shifted the grid ops tests into the test_grid_ops() base class function.
........

Modified:
    branches/N_state_model/   (props changed)
    branches/N_state_model/specific_fns/base_class.py
    branches/N_state_model/specific_fns/model_free/mf_minimise.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=4747&r1=4746&r2=4747&view=diff
==============================================================================
--- branches/N_state_model/specific_fns/base_class.py (original)
+++ branches/N_state_model/specific_fns/base_class.py Tue Jan 15 14:51:37 2008
@@ -410,3 +410,36 @@
 
         # Return the array.
         return spin.select_sim
+
+
+    def test_grid_ops(self, lower=None, upper=None, inc=None, n=n):
+        """Function for testing that the grid search options are reasonable.
+
+        @param lower:       The lower bounds of the grid search which must 
be equal to the number of
+                            parameters in the model.
+        @type lower:        array of numbers
+        @param upper:       The upper bounds of the grid search which must 
be equal to the number of
+                            parameters in the model.
+        @type upper:        array of numbers
+        @param inc:         The increments for each dimension of the space 
for the grid search.  The
+                            number of elements in the array must equal to 
the number of parameters
+                            in the model.
+        @type inc:          array of int
+        @param n:           The number of parameters in the model.
+        @type n:            int
+        """
+
+        # Lower bounds test.
+        if lower != None:
+            if len(lower) != n:
+                raise RelaxLenError, ('lower bounds', n)
+
+        # Upper bounds.
+        if upper != None:
+            if len(upper) != n:
+                raise RelaxLenError, ('upper bounds', n)
+
+        # Increment.
+        if type(inc) == list:
+            if len(inc) != n:
+                raise RelaxLenError, ('increment', n)

Modified: branches/N_state_model/specific_fns/model_free/mf_minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/N_state_model/specific_fns/model_free/mf_minimise.py?rev=4747&r1=4746&r2=4747&view=diff
==============================================================================
--- branches/N_state_model/specific_fns/model_free/mf_minimise.py (original)
+++ branches/N_state_model/specific_fns/model_free/mf_minimise.py Tue Jan 15 
14:51:37 2008
@@ -239,22 +239,11 @@
         if n == 0:
             print "Cannot run a grid search on a model with zero parameters, 
skipping the grid search."
 
-        # Lower bounds.
-        if lower != None:
-            if len(lower) != n:
-                raise RelaxLenError, ('lower bounds', n)
-
-        # Upper bounds.
-        if upper != None:
-            if len(upper) != n:
-                raise RelaxLenError, ('upper bounds', n)
-
-        # Increment.
-        if type(inc) == list:
-            if len(inc) != n:
-                raise RelaxLenError, ('increment', n)
-            inc = inc
-        elif type(inc) == int:
+        # Test the grid search options.
+        self.test_grid_ops(lower=lower, upper=upper, inc=inc, n=n)
+
+        # If inc is a single int, convert it into an array of that value.
+        if type(inc) == int:
             temp = []
             for j in xrange(n):
                 temp.append(inc)




Related Messages


Powered by MHonArc, Updated Tue Jan 15 15:00:14 2008