mailr25878 - /branches/frame_order_cleanup/auto_analyses/frame_order.py


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

Header


Content

Posted by edward on September 17, 2014 - 17:11:
Author: bugman
Date: Wed Sep 17 17:11:39 2014
New Revision: 25878

URL: http://svn.gna.org/viewcvs/relax?rev=25878&view=rev
Log:
Converted the frame order auto-analysis to use the new 
frame_order.sobol_setup user function design.

The auto-analysis Optimisation_settings object has also been modified so that 
all num_int_pts
arguments and internal structures have been split into the two new 
sobol_max_points and
sobol_oversample names and objects.

Modified:
    branches/frame_order_cleanup/auto_analyses/frame_order.py

Modified: branches/frame_order_cleanup/auto_analyses/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/auto_analyses/frame_order.py?rev=25878&r1=25877&r2=25878&view=diff
==============================================================================
--- branches/frame_order_cleanup/auto_analyses/frame_order.py   (original)
+++ branches/frame_order_cleanup/auto_analyses/frame_order.py   Wed Sep 17 
17:11:39 2014
@@ -133,7 +133,8 @@
 
                 # The numerical optimisation settings.
                 opt = self.opt_mc
-                
self.interpreter.frame_order.num_int_pts(num=opt.get_min_num_int_pts(0))
+                max_num, oversample = opt.get_min_sobol_info(0)
+                self.interpreter.frame_order.sobol_setup(max_num=max_num, 
oversample=oversample)
 
                 # Monte Carlo simulations.
                 self.interpreter.monte_carlo.setup(number=self.mc_sim_num)
@@ -220,9 +221,9 @@
                 pass
 
             # The numerical optimisation settings.
-            num_int_pts = opt.get_min_num_int_pts(i)
-            if num_int_pts != None:
-                self.interpreter.frame_order.num_int_pts(num=num_int_pts)
+            max_num, oversample = opt.get_min_sobol_info(i)
+            if max_num != None:
+                self.interpreter.frame_order.sobol_setup(max_num=max_num, 
oversample=oversample)
 
             # Perform the optimisation.
             
self.interpreter.minimise.execute(min_algor=opt.get_min_algor(i), 
func_tol=opt.get_min_func_tol(i), max_iter=opt.get_min_max_iter(i))
@@ -596,9 +597,9 @@
                     self.interpreter.minimise.grid_zoom(level=zoom)
 
                 # The numerical optimisation settings.
-                num_int_pts = opt.get_grid_num_int_pts(i)
-                if num_int_pts != None:
-                    self.interpreter.frame_order.num_int_pts(num=num_int_pts)
+                max_num, oversample = opt.get_grid_sobol_info(i)
+                if max_num != None:
+                    
self.interpreter.frame_order.sobol_setup(max_num=max_num, 
oversample=oversample)
 
                 # Set up the custom grid increments.
                 incs = self.custom_grid_incs(model, inc=opt.get_grid_inc(i))
@@ -609,9 +610,9 @@
             # Minimise (for the PCS data subset and full RDC set).
             for i in opt.loop_min():
                 # The numerical optimisation settings.
-                num_int_pts = opt.get_min_num_int_pts(i)
-                if num_int_pts != None:
-                    self.interpreter.frame_order.num_int_pts(num=num_int_pts)
+                max_num, oversample = opt.get_min_sobol_info(i)
+                if max_num != None:
+                    
self.interpreter.frame_order.sobol_setup(max_num=max_num, 
oversample=oversample)
 
                 # Perform the optimisation.
                 
self.interpreter.minimise.execute(min_algor=opt.get_min_algor(i), 
func_tol=opt.get_min_func_tol(i), max_iter=opt.get_min_max_iter(i))
@@ -631,9 +632,9 @@
             opt = self.opt_full
             for i in opt.loop_min():
                 # The numerical optimisation settings.
-                num_int_pts = opt.get_min_num_int_pts(i)
-                if num_int_pts != None:
-                    self.interpreter.frame_order.num_int_pts(num=num_int_pts)
+                max_num, oversample = opt.get_min_sobol_info(i)
+                if max_num != None:
+                    
self.interpreter.frame_order.sobol_setup(max_num=max_num, 
oversample=oversample)
 
                 # Perform the optimisation.
                 
self.interpreter.minimise.execute(min_algor=opt.get_min_algor(i), 
func_tol=opt.get_min_func_tol(i), max_iter=opt.get_min_max_iter(i))
@@ -702,9 +703,9 @@
                 self.interpreter.minimise.grid_zoom(level=zoom)
 
             # The numerical optimisation settings.
-            num_int_pts = opt.get_grid_num_int_pts(i)
-            if num_int_pts != None:
-                self.interpreter.frame_order.num_int_pts(num=num_int_pts)
+            max_num, oversample = opt.get_grid_sobol_info(i)
+            if max_num != None:
+                self.interpreter.frame_order.sobol_setup(max_num=max_num, 
oversample=oversample)
 
             # The number of increments.
             inc = opt.get_grid_inc(i)
@@ -718,9 +719,9 @@
         # Minimise.
         for i in opt.loop_min():
             # The numerical optimisation settings.
-            num_int_pts = opt.get_min_num_int_pts(i)
-            if num_int_pts != None:
-                self.interpreter.frame_order.num_int_pts(num=num_int_pts)
+            max_num, oversample = opt.get_min_sobol_info(i)
+            if max_num != None:
+                self.interpreter.frame_order.sobol_setup(max_num=max_num, 
oversample=oversample)
 
             # Perform the optimisation.
             
self.interpreter.minimise.execute(min_algor=opt.get_min_algor(i), 
func_tol=opt.get_min_func_tol(i), max_iter=opt.get_min_max_iter(i))
@@ -929,14 +930,16 @@
         self._grid_count = 0
         self._grid_incs = []
         self._grid_zoom = []
-        self._grid_num_int_pts = []
+        self._grid_sobol_max_points = []
+        self._grid_sobol_oversample = []
 
         # Initialise some private structures for the minimisation.
         self._min_count = 0
         self._min_algor = []
         self._min_func_tol = []
         self._min_max_iter = []
-        self._min_num_int_pts = []
+        self._min_sobol_max_points = []
+        self._min_sobol_oversample = []
 
 
     def _check_index(self, i, iter_type=None):
@@ -959,55 +962,63 @@
             raise RelaxError("The iteration index %i is too high, only %i 
minimisations are set up." % (i, self._min_count))
 
 
-    def add_grid(self, inc=None, zoom=None, num_int_pts=None):
+    def add_grid(self, inc=None, zoom=None, sobol_max_points=None, 
sobol_oversample=None):
         """Add a grid search step.
 
-        @keyword inc:           The grid search size (the number of 
increments per dimension).
-        @type inc:              int
-        @keyword zoom:          The grid zoom level for this grid search.
-        @type zoom:             None or int
-        @keyword num_int_pts:   The list of the number of Sobol' points for 
the PCS numerical integration to use in the grid search.  If not supplied, 
then the previous value will be used.
-        @type num_int_pts:      None or int
+        @keyword inc:               The grid search size (the number of 
increments per dimension).
+        @type inc:                  int
+        @keyword zoom:              The grid zoom level for this grid search.
+        @type zoom:                 None or int
+        @keyword sobol_max_points:  The maximum number of Sobol' points for 
the PCS numerical integration to use in the grid search.  See the 
frame_order.sobol_setup user function for details.  If not supplied, then the 
previous value will be used.
+        @type sobol_max_points:     None or int
+        @keyword sobol_oversample:  The Sobol' oversampling factor.  See the 
frame_order.sobol_setup user function for details.
+        @type sobol_oversample:     None or int
         """
 
         # Value checking, as this will be set up by a user.
         is_int(inc, name='inc', can_be_none=False)
         is_int(zoom, name='zoom', can_be_none=True)
-        is_int(num_int_pts, name='num_int_pts', can_be_none=True)
+        is_int(sobol_max_points, name='sobol_max_points', can_be_none=True)
+        is_int(sobol_oversample, name='sobol_oversample', can_be_none=True)
 
         # Store the values.
         self._grid_incs.append(inc)
         self._grid_zoom.append(zoom)
-        self._grid_num_int_pts.append(num_int_pts)
+        self._grid_sobol_max_points.append(sobol_max_points)
+        self._grid_sobol_oversample.append(sobol_oversample)
 
         # Increment the count.
         self._grid_count += 1
 
 
-    def add_min(self, min_algor='simplex', func_tol=1e-25, max_iter=1000000, 
num_int_pts=None):
+    def add_min(self, min_algor='simplex', func_tol=1e-25, max_iter=1000000, 
sobol_max_points=None, sobol_oversample=None):
         """Add an optimisation step.
 
-        @keyword min_algor:     The optimisation technique.
-        @type min_algor:        str
-        @keyword func_tol:      The minimisation function tolerance cutoff 
to terminate optimisation (see the minimise.execute user function).
-        @type func_tol:         int
-        @keyword max_iter:      The maximum number of iterations for the 
optimisation.
-        @type max_iter:         int
-        @keyword num_int_pts:   The list of the number of Sobol' points for 
the PCS numerical integration to use in the optimisations after the grid 
search.  If not supplied, then the previous value will be used.
-        @type num_int_pts:      None or int
+        @keyword min_algor:         The optimisation technique.
+        @type min_algor:            str
+        @keyword func_tol:          The minimisation function tolerance 
cutoff to terminate optimisation (see the minimise.execute user function).
+        @type func_tol:             int
+        @keyword max_iter:          The maximum number of iterations for the 
optimisation.
+        @type max_iter:             int
+        @keyword sobol_max_points:  The maximum number of Sobol' points for 
the PCS numerical integration to use in the optimisations after the grid 
search.  See the frame_order.sobol_setup user function for details.  If not 
supplied, then the previous value will be used.
+        @type sobol_max_points:     None or int
+        @keyword sobol_oversample:  The Sobol' oversampling factor.  See the 
frame_order.sobol_setup user function for details.
+        @type sobol_oversample:     None or int
         """
 
         # Value checking, as this will be set up by a user.
         is_str(min_algor, name='min_algor', can_be_none=False)
         is_float(func_tol, name='func_tol', can_be_none=True)
         is_int(max_iter, name='max_iter', can_be_none=True)
-        is_int(num_int_pts, name='num_int_pts', can_be_none=True)
+        is_int(sobol_max_points, name='sobol_max_points', can_be_none=True)
+        is_int(sobol_oversample, name='sobol_oversample', can_be_none=True)
 
         # Store the values.
         self._min_algor.append(min_algor)
         self._min_func_tol.append(func_tol)
         self._min_max_iter.append(max_iter)
-        self._min_num_int_pts.append(num_int_pts)
+        self._min_sobol_max_points.append(sobol_max_points)
+        self._min_sobol_oversample.append(sobol_oversample)
 
         # Increment the count.
         self._min_count += 1
@@ -1029,20 +1040,20 @@
         return self._grid_incs[i]
 
 
-    def get_grid_num_int_pts(self, i):
-        """Return the number of numerical integration points for the given 
iteration.
+    def get_grid_sobol_info(self, i):
+        """Return the number of numerical integration points and 
oversampling factor for the given iteration.
 
         @param i:   The grid search iteration from the loop_grid() method.
         @type i:    int
-        @return:    The number of numerical integration points for the 
iteration.
-        @rtype:     int
+        @return:    The number of numerical integration points for the 
iteration and the oversampling factor.
+        @rtype:     int, int
         """
 
         # Check the index.
         self._check_index(i, iter_type='grid')
 
         # Return the value.
-        return self._grid_num_int_pts[i]
+        return self._grid_sobol_max_points[i], self._grid_sobol_oversample[i]
 
 
     def get_grid_zoom_level(self, i):
@@ -1109,20 +1120,20 @@
         return self._min_max_iter[i]
 
 
-    def get_min_num_int_pts(self, i):
-        """Return the number of numerical integration points for the given 
iteration.
+    def get_min_sobol_info(self, i):
+        """Return the number of numerical integration points and 
oversampling factor for the given iteration.
 
         @param i:   The minimisation iteration from the loop_min() method.
         @type i:    int
-        @return:    The number of numerical integration points for the 
iteration.
-        @rtype:     int
+        @return:    The number of numerical integration points for the 
iteration and the oversampling factor.
+        @rtype:     int, int
         """
 
         # Check the index.
         self._check_index(i, iter_type='min')
 
         # Return the value.
-        return self._min_num_int_pts[i]
+        return self._min_sobol_max_points[i], self._min_sobol_oversample[i]
 
 
     def loop_grid(self):




Related Messages


Powered by MHonArc, Updated Wed Sep 17 17:20:03 2014