mailr24591 - /branches/zooming_grid_search/pipe_control/minimise.py


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

Header


Content

Posted by edward on July 22, 2014 - 10:43:
Author: bugman
Date: Tue Jul 22 10:43:19 2014
New Revision: 24591

URL: http://svn.gna.org/viewcvs/relax?rev=24591&view=rev
Log:
The grid search setup function now prints out the grid search bounds to be 
used.

This is in the pipe_control.minimise.grid_setup() function, hence it is 
analysis independent.  This
is useful feedback for the user to know what the grid search is doing.  And 
it will be even more
useful for the zooming grid search to understand what is happening.


Modified:
    branches/zooming_grid_search/pipe_control/minimise.py

Modified: branches/zooming_grid_search/pipe_control/minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/zooming_grid_search/pipe_control/minimise.py?rev=24591&r1=24590&r2=24591&view=diff
==============================================================================
--- branches/zooming_grid_search/pipe_control/minimise.py       (original)
+++ branches/zooming_grid_search/pipe_control/minimise.py       Tue Jul 22 
10:43:19 2014
@@ -24,9 +24,11 @@
 
 # Python module imports.
 from numpy import float64, identity
+import sys
 
 # relax module imports.
 from lib.errors import RelaxError, RelaxIntListIntError, RelaxLenError
+from lib.io import write_data
 from multi import Processor_box
 from pipe_control.mol_res_spin import return_spin, spin_loop
 from pipe_control import pipes
@@ -160,7 +162,7 @@
     api.overfit_deselect()
 
     # Determine the model specific grid bounds, and allow for the zooming 
grid search, and check the inc argument.
-    model_lower, model_upper, model_inc = grid_setup(lower, upper, inc)
+    model_lower, model_upper, model_inc = grid_setup(lower, upper, inc, 
verbosity=verbosity)
 
     # Create the scaling matrix.
     scaling_matrix = assemble_scaling_matrix()
@@ -200,7 +202,7 @@
     processor.run_queue()
 
 
-def grid_setup(lower=None, upper=None, inc=None):
+def grid_setup(lower=None, upper=None, inc=None, verbosity=1):
     """Determine the per-model grid bounds, allowing for the zooming grid 
search.
 
     @keyword lower:     The user supplied lower bounds of the grid search 
which must be equal to the number of parameters in the model.
@@ -209,6 +211,8 @@
     @type upper:        list of numbers
     @keyword inc:       The user supplied grid search increments.
     @type inc:          int or list of int
+    @param verbosity:   The amount of information to print.  The higher the 
value, the greater the verbosity.
+    @type verbosity:    int
     @return:            The per-model grid upper and lower bounds.  The 
first dimension of each structure corresponds to the model, the second the 
model parameters.
     @rtype:             tuple of lists of lists of float, lists of lists of 
float, list of lists of int
     """
@@ -272,6 +276,7 @@
         model_upper.append([])
 
         # Loop over the parameters.
+        data = []
         for i in range(n):
             # The lower bound for this parameter.
             if lower != None:
@@ -295,6 +300,13 @@
             # Append.
             model_lower[-1].append(lower_i)
             model_upper[-1].append(upper_i)
+
+            # Add to the data list for printing out.
+            data.append([names[i], "%20s" % lower_i, "%20s" % upper_i])
+
+        # Printout.
+        if verbosity:
+            write_data(out=sys.stdout, headings=["Parameter", "Lower", 
"Upper"], data=data)
 
     # Return the bounds.
     return model_lower, model_upper, model_inc




Related Messages


Powered by MHonArc, Updated Tue Jul 22 11:00:04 2014