mailr26279 - in /branches/frame_order_cleanup: ./ pipe_control/ test_suite/system_tests/


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

Header


Content

Posted by edward on October 14, 2014 - 13:44:
Author: bugman
Date: Tue Oct 14 13:44:21 2014
New Revision: 26279

URL: http://svn.gna.org/viewcvs/relax?rev=26279&view=rev
Log:
Merged revisions 26261-26267 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r26261 | tlinnet | 2014-10-13 18:19:34 +0200 (Mon, 13 Oct 2014) | 1 line
  
  Inserted a z_axis limit for the plotting of 2D surfaces in matplotlib.
........
  r26262 | tlinnet | 2014-10-13 18:19:36 +0200 (Mon, 13 Oct 2014) | 1 line
  
  Added better figure control of chi2 values on z-axis for surface plots.
........
  r26263 | tlinnet | 2014-10-13 18:19:38 +0200 (Mon, 13 Oct 2014) | 5 lines
  
  Narrowed in dx_map in systemtest 
Relax_disp.test_dx_map_clustered_create_par_file()
  
  This is to illustrate the failure of relax finding the global minimum.
  
  It seems there is a shallow barrier, which relax failed to climb over, in 
order to find the minimum value.
........
  r26264 | bugman | 2014-10-13 19:07:30 +0200 (Mon, 13 Oct 2014) | 3 lines
  
  Removed a debugging printout.
........
  r26265 | bugman | 2014-10-13 22:57:11 +0200 (Mon, 13 Oct 2014) | 6 lines
  
  Added the verbosity argument to the pipe_control.minimise.reset_min_stats() 
function.
  
  All of the minimisation code which calls this now send in their verbosity 
arguments.  This allows
  the text "Resetting the minimisation statistics." to be suppressed.
........
  r26266 | bugman | 2014-10-13 22:58:22 +0200 (Mon, 13 Oct 2014) | 6 lines
  
  Added the verbosity argument to the pipe_control.value.set() function.
  
  This is passed into the pipe_control.minimise.reset_min_stats() function so 
its printouts can be
  silenced.
........
  r26267 | bugman | 2014-10-13 22:59:51 +0200 (Mon, 13 Oct 2014) | 6 lines
  
  The pipe_control.opendx space mapping code now calls the value.set() 
function with verbosity=0.
  
  This is to silence the very repetitive statistics resetting messages when 
executing the dx.map user
  function.
........

Modified:
    branches/frame_order_cleanup/   (props changed)
    branches/frame_order_cleanup/pipe_control/minimise.py
    branches/frame_order_cleanup/pipe_control/opendx.py
    branches/frame_order_cleanup/pipe_control/value.py
    branches/frame_order_cleanup/test_suite/system_tests/palmer.py
    branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py

Propchange: branches/frame_order_cleanup/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Oct 14 13:44:21 2014
@@ -1 +1 @@
-/trunk:1-26205,26208-26260
+/trunk:1-26278

Modified: branches/frame_order_cleanup/pipe_control/minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/pipe_control/minimise.py?rev=26279&r1=26278&r2=26279&view=diff
==============================================================================
--- branches/frame_order_cleanup/pipe_control/minimise.py       (original)
+++ branches/frame_order_cleanup/pipe_control/minimise.py       Tue Oct 14 
13:44:21 2014
@@ -96,7 +96,7 @@
     check_pipe()
 
     # Reset the minimisation statistics.
-    reset_min_stats()
+    reset_min_stats(verbosity=verbosity)
 
     # The specific analysis API object.
     api = return_api()
@@ -183,7 +183,7 @@
         # Loop over the simulations.
         for i in range(cdp.sim_number):
             # Reset the minimisation statistics.
-            reset_min_stats(sim_index=i)
+            reset_min_stats(sim_index=i, verbosity=verbosity)
 
             # Status.
             if status.current_analysis:
@@ -207,7 +207,7 @@
     # Grid search.
     else:
         # Reset the minimisation statistics.
-        reset_min_stats()
+        reset_min_stats(verbosity=verbosity)
 
         # Optimise.
         api.grid_search(lower=model_lower, upper=model_upper, inc=model_inc, 
scaling_matrix=scaling_matrix, constraints=constraints, verbosity=verbosity)
@@ -489,7 +489,7 @@
     # Single Monte Carlo simulation.
     if sim_index != None:
         # Reset the minimisation statistics.
-        reset_min_stats(sim_index=sim_index)
+        reset_min_stats(sim_index=sim_index, verbosity=verbosity)
 
         # Optimise.
         api.minimise(min_algor=min_algor, min_options=min_options, 
func_tol=func_tol, grad_tol=grad_tol, max_iterations=max_iter, 
constraints=constraints, scaling_matrix=scaling_matrix, verbosity=verbosity, 
sim_index=sim_index)
@@ -498,7 +498,7 @@
     elif hasattr(cdp, 'sim_state') and cdp.sim_state == 1:
         for i in range(cdp.sim_number):
             # Reset the minimisation statistics.
-            reset_min_stats(sim_index=i)
+            reset_min_stats(sim_index=i, verbosity=verbosity)
 
             # Status.
             if status.current_analysis:
@@ -522,7 +522,7 @@
     # Standard minimisation.
     else:
         # Reset the minimisation statistics.
-        reset_min_stats()
+        reset_min_stats(verbosity=verbosity)
 
         # Optimise.
         api.minimise(min_algor=min_algor, min_options=min_options, 
func_tol=func_tol, grad_tol=grad_tol, max_iterations=max_iter, 
constraints=constraints, scaling_matrix=scaling_matrix, verbosity=verbosity)
@@ -531,13 +531,15 @@
     processor.run_queue()
 
 
-def reset_min_stats(data_pipe=None, sim_index=None):
+def reset_min_stats(data_pipe=None, sim_index=None, verbosity=1):
     """Function for resetting all minimisation statistics.
 
     @keyword data_pipe:     The name of the data pipe to reset the 
minimisation statistics of.  This defaults to the current data pipe.
     @type data_pipe:        str
     @keyword sim_index:     The optional Monte Carlo simulation index.
     @type sim_index:        int
+    @keyword verbosity:     The amount of information to print.  The higher 
the value, the greater the verbosity.
+    @type verbosity:        int
     """
 
     # The data pipe.
@@ -600,7 +602,7 @@
                         sim_obj[sim_index] = None
 
     # Printout.
-    if flag and sim_index == None:
+    if verbosity and flag and sim_index == None:
         print("Resetting the minimisation statistics.")
 
 

Modified: branches/frame_order_cleanup/pipe_control/opendx.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/pipe_control/opendx.py?rev=26279&r1=26278&r2=26279&view=diff
==============================================================================
--- branches/frame_order_cleanup/pipe_control/opendx.py (original)
+++ branches/frame_order_cleanup/pipe_control/opendx.py Tue Oct 14 13:44:21 
2014
@@ -356,9 +356,9 @@
                 for k in range((self.inc + 1)):
                     # Set the parameter values.
                     if self.spin_id:
-                        value.set(val=values, param=self.params, 
spin_id=self.spin_id, force=True)
+                        value.set(val=values, param=self.params, 
spin_id=self.spin_id, verbosity=0, force=True)
                     else:
-                        value.set(val=values, param=self.params, force=True)
+                        value.set(val=values, param=self.params, 
verbosity=0, force=True)
 
                     # Calculate the function values.
                     if self.spin_id:
@@ -470,6 +470,7 @@
         plot_file = open_write_file(file_name=self.file_prefix+'.py', 
dir=self.dir, force=True)
 
         matplotlib_file = [
+            'from copy import deepcopy'+"\n",
             'import numpy as np'+"\n",
             'import scipy.interpolate'+"\n",
             'from numpy.ma import masked_where'+"\n",
@@ -565,21 +566,24 @@
             '    # Set which x, y, z to plot'+"\n",
             '    x_p = xi'+"\n",
             '    y_p = yi'+"\n",
-            '    c_p = ci'+"\n",
+            '    c_p = deepcopy(ci)'+"\n",
             ''+"\n",
             '    # Cut map at a certain height.'+"\n",
             '    # First get index os largest values'+"\n",
-            '    #out_val = 5*map_mask_c_min'+"\n",
-            '    out_val = map_mask_c_max'+"\n",
-            '    ci_mask = masked_where(ci >= out_val, ci)'+"\n",
+            '    #z_max = map_mask_c_max'+"\n",
+            '    z_max = map_mask_c_min + 0.5*map_mask_c_min'+"\n",
+            '    ci_mask = masked_where(ci >= z_max, ci)'+"\n",
             ''+"\n",
             '    # Replace with 0.0'+"\n",
-            '    ci[ci_mask.mask] = 0.0'+"\n",
+            '    c_p[ci_mask.mask] = 0.0'+"\n",
             '    # Find new max'+"\n",
-            '    new_max = np.max(ci)'+"\n",
+            '    new_max = np.max(c_p)'+"\n",
             ''+"\n",
             '    # Insert values in array.'+"\n",
-            '    ci[ci_mask.mask] = new_max'+"\n",
+            '    c_p[ci_mask.mask] = new_max'+"\n",
+            ''+"\n",
+            '    # Define min.'+"\n",
+            '    z_min = map_mask_c_min - 0.5*map_mask_c_min'+"\n",
             ''+"\n",
             '    # Create figure and plot'+"\n",
             '    ax = fig.add_subplot(nr_rows, nr_cols, 1, 
projection="3d")'+"\n",
@@ -592,7 +596,7 @@
             '    ##ax.scatter(x_p, y_p, c_p, c="y", marker="o", s=5)'+"\n",
             ''+"\n",
             '    # Add contour levels on sides.'+"\n",
-            '    ax.contour(x_p, y_p, c_p, zdir="z", offset=0, 
cmap=cm.coolwarm)'+"\n",
+            '    ax.contour(x_p, y_p, c_p, zdir="z", offset=z_min, 
cmap=cm.coolwarm)'+"\n",
             '    ax.contour(x_p, y_p, c_p, zdir="x", offset=map_mask_x_min, 
cmap=cm.coolwarm)'+"\n",
             '    ax.contour(x_p, y_p, c_p, zdir="y", offset=map_mask_y_min, 
cmap=cm.coolwarm)'+"\n",
             ''+"\n",
@@ -651,6 +655,11 @@
             '    ax.set_ylabel("%s"%y_par)'+"\n",
             '    ax.set_zlabel("%s"%c_par)'+"\n",
             ''+"\n",
+            ''+"\n",
+            '    # Set limits'+"\n",
+            '    ax.set_zlim(z_min, z_max)'+"\n",
+            ''+"\n",
+            ''+"\n",
             '    # Create figure and plot'+"\n",
             '    ax = fig.add_subplot(nr_rows, nr_cols, 2)'+"\n",
             '    fig_imshow = ax.imshow(ci, vmin=map_mask_c_min, 
vmax=map_mask_c_max, origin="lower", extent=[map_mask_x_min, map_mask_x_max, 
map_mask_y_min, map_mask_y_max])'+"\n",

Modified: branches/frame_order_cleanup/pipe_control/value.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/pipe_control/value.py?rev=26279&r1=26278&r2=26279&view=diff
==============================================================================
--- branches/frame_order_cleanup/pipe_control/value.py  (original)
+++ branches/frame_order_cleanup/pipe_control/value.py  Tue Oct 14 13:44:21 
2014
@@ -351,7 +351,7 @@
         minimise.reset_min_stats()
 
 
-def set(val=None, param=None, index=None, pipe=None, spin_id=None, 
error=False, force=True, reset=True):
+def set(val=None, param=None, index=None, pipe=None, spin_id=None, 
verbosity=1, error=False, force=True, reset=True):
     """Set global or spin specific data values.
 
     @keyword val:       The parameter values.
@@ -364,6 +364,8 @@
     @type pipe:         None or str
     @keyword spin_id:   The spin identification string.
     @type spin_id:      str
+    @keyword verbosity: The amount of information to print.  The higher the 
value, the greater the verbosity.
+    @type verbosity:    int
     @keyword error:     A flag which if True will allow the parameter errors 
to be set instead of the values.
     @type error:        bool
     @keyword force:     A flag forcing the overwriting of current values.
@@ -425,7 +427,7 @@
 
     # Reset all minimisation statistics.
     if reset:
-        minimise.reset_min_stats()
+        minimise.reset_min_stats(verbosity=verbosity)
 
     # Switch back.
     if pipe:

Modified: branches/frame_order_cleanup/test_suite/system_tests/palmer.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/system_tests/palmer.py?rev=26279&r1=26278&r2=26279&view=diff
==============================================================================
--- branches/frame_order_cleanup/test_suite/system_tests/palmer.py      
(original)
+++ branches/frame_order_cleanup/test_suite/system_tests/palmer.py      Tue 
Oct 14 13:44:21 2014
@@ -225,7 +225,6 @@
 
                 # Get the spin.
                 spin = return_spin(spin_names[spin_index], 
pipe=models[model_index])
-                print spin
 
                 # Conversions.
                 if rex[model_index][spin_index]:

Modified: branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py?rev=26279&r1=26278&r2=26279&view=diff
==============================================================================
--- branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py  
(original)
+++ branches/frame_order_cleanup/test_suite/system_tests/relax_disp.py  Tue 
Oct 14 13:44:21 2014
@@ -3204,9 +3204,7 @@
         self.assertAlmostEqual(pre_chi2, calc_chi2)
 
         # Define dx.map settings.
-        dx_inc = 2
-        dx_inc_sides = dx_inc / 2
-
+        dx_inc = 5
         dx_params = ['dw', 'k_AB', 'r2a']
         dx_point_clustered_min = [cur_spin.dw, cur_spin.k_AB, 
cur_spin.r2a['SQ CPMG - 499.86214000 MHz']]
 
@@ -3220,36 +3218,15 @@
         file_name_map = "%s_map%s" % (cur_model, cur_spin_id_str)
         file_name_point = "%s_point%s" % (cur_model, cur_spin_id_str)
 
-        # Step-size of parameter is 10 %
-        param_delta = 0.1
-
         # Determine bounds for lower and upper
-        #lower = [0.0, 0.0, 5.0]
-        #upper = [20.0, 6.0, 15.0]
-
-        lower = []
-        upper = []
-        for i, param_val in enumerate(dx_point_clustered_min):
-            param = dx_params[i]
-            step_val = param_delta * param_val
-            step_length = step_val * dx_inc_sides
-
-            # Calculate value
-            low_val = param_val - step_length
-            lower.append(low_val)
-
-            upp_val = param_val + step_length
-            upper.append(upp_val)
-
-            print("For param %s, lower=%3.3f, upper=%3.3f, step_value=%3.3f, 
steps=%i, centered at=%3.3f"% (param, low_val, upp_val, step_val, dx_inc, 
param_val))
+        lower = [dx_point_clustered_min[0], dx_point_clustered_min[1], 
dx_point_clustered_min[2]]
+        upper = [19.0, 2.4, 9.5]
 
         # Define temporary folder.
         result_dir = self.tmpdir
 
         # For testing.
         #result_dir = None
-        #lower = None
-        #upper = None
         #self.interpreter.relax_disp.cluster(cluster_id='free spins', 
spin_id=cur_spin_id)
 
         # Then do the map.




Related Messages


Powered by MHonArc, Updated Tue Oct 14 18:00:02 2014