mailr21250 - in /branches/relax_disp/specific_analyses/relax_disp: api.py optimisation.py


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

Header


Content

Posted by edward on October 27, 2013 - 15:20:
Author: bugman
Date: Sun Oct 27 15:20:03 2013
New Revision: 21250

URL: http://svn.gna.org/viewcvs/relax?rev=21250&view=rev
Log:
Shifted the optimisation printouts for the dispersion analysis out of the 
memo.

This improved the ordering of the printed out messages when running on a 
cluster.  Instead of having
multiple optimisation printouts followed by a list of the corresponding 
optimised values, now they
are interleaved as they should be.


Modified:
    branches/relax_disp/specific_analyses/relax_disp/api.py
    branches/relax_disp/specific_analyses/relax_disp/optimisation.py

Modified: branches/relax_disp/specific_analyses/relax_disp/api.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/api.py?rev=21250&r1=21249&r2=21250&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/api.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp/api.py Sun Oct 27 
15:20:03 2013
@@ -1050,7 +1050,7 @@
             command = Disp_minimise_command(spins=spins, spin_ids=spin_ids, 
sim_index=sim_index, scaling_matrix=scaling_matrix, min_algor=min_algor, 
min_options=min_options, func_tol=func_tol, grad_tol=grad_tol, 
max_iterations=max_iterations, constraints=constraints, verbosity=verbosity, 
lower=lower, upper=upper, inc=inc, fields=fields)
 
             # Set up the memo.
-            memo = Disp_memo(spins=spins, cluster_name=spin_ids, 
sim_index=sim_index, scaling_matrix=scaling_matrix, verbosity=verbosity)
+            memo = Disp_memo(spins=spins, sim_index=sim_index, 
scaling_matrix=scaling_matrix, verbosity=verbosity)
 
             # Add the slave command and memo to the processor queue.
             processor.add_to_queue(command, memo)

Modified: branches/relax_disp/specific_analyses/relax_disp/optimisation.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/optimisation.py?rev=21250&r1=21249&r2=21250&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/optimisation.py 
(original)
+++ branches/relax_disp/specific_analyses/relax_disp/optimisation.py Sun Oct 
27 15:20:03 2013
@@ -186,7 +186,7 @@
 class Disp_memo(Memo):
     """The relaxation dispersion memo class."""
 
-    def __init__(self, spins=None, cluster_name=None, sim_index=None, 
scaling_matrix=None, verbosity=None):
+    def __init__(self, spins=None, sim_index=None, scaling_matrix=None, 
verbosity=None):
         """Initialise the relaxation dispersion memo class.
 
         This is used for handling the optimisation results returned from a 
slave processor.  It runs on the master processor and is used to store data 
which is passed to the slave processor and then passed back to the master via 
the results command.
@@ -194,8 +194,6 @@
 
         @keyword spins:             The list of spin data container for the 
cluster.  If this argument is supplied, then the spin_id argument will be 
ignored.
         @type spins:                list of SpinContainer instances
-        @keyword cluster_name:      The name of the cluster to optimise.  
This is used for printouts.
-        @type cluster_name:         list of str
         @keyword sim_index:         The optional MC simulation index.
         @type sim_index:            int
         @keyword scaling_matrix:    The diagonal, square scaling matrix.
@@ -209,7 +207,6 @@
 
         # Store the arguments.
         self.spins = spins
-        self.cluster_name = cluster_name
         self.sim_index = sim_index
         self.scaling_matrix = scaling_matrix
         self.verbosity = verbosity
@@ -350,6 +347,25 @@
                 return
             param_vector, chi2, iter_count, f_count, g_count, h_count, 
warning = results
 
+        # Optimisation printout.
+        if self.verbosity:
+            print("\nOptimised parameter values:")
+            for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=self.spins):
+                # The parameter with additional details.
+                param_text = param_name
+                if param_name in ['r2', 'r2a', 'r2b']:
+                    frq = return_value_from_frq_index(frq_index)
+                    if frq:
+                        param_text += " (%.3f MHz)" % (frq / 1e6) 
+                param_text += ":"
+
+                # The printout.
+                print("%-20s %25.15f" % (param_text, 
param_vector[param_index]))
+
+        # Printout.
+        if self.sim_index != None:
+            print("Simulation %s, cluster %s" % (self.sim_index+1, 
self.spin_ids))
+
         # Create the result command object to send back to the master.
         processor.return_object(Disp_result_command(processor=processor, 
memo_id=self.memo_id, param_vector=param_vector, chi2=chi2, 
iter_count=iter_count, f_count=f_count, g_count=g_count, h_count=h_count, 
warning=warning, missing=self.missing, back_calc=model.back_calc, 
completed=False))
 
@@ -499,22 +515,3 @@
                         spin.r2eff_bc[key] = self.back_calc[exp_type_index, 
spin_index, frq_index, disp_pt_index]
                     else:
                         spin.r2eff_bc[key] = self.back_calc[spin_index, 
frq_index, disp_pt_index]
-
-        # Optimisation printout.
-        if memo.verbosity:
-            print("\nOptimised parameter values:")
-            for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=memo.spins):
-                # The parameter with additional details.
-                param_text = param_name
-                if param_name in ['r2', 'r2a', 'r2b']:
-                    frq = return_value_from_frq_index(frq_index)
-                    if frq:
-                        param_text += " (%.3f MHz)" % (frq / 1e6) 
-                param_text += ":"
-
-                # The printout.
-                print("%-20s %25.15f" % (param_text, 
param_vector[param_index]))
-
-        # Printout.
-        if memo.sim_index != None:
-            print("Simulation %s, cluster %s" % (memo.sim_index+1, 
memo.cluster_name))




Related Messages


Powered by MHonArc, Updated Sun Oct 27 17:00:02 2013