mailr21266 - in /branches/relax_disp/specific_analyses/relax_disp: optimisation.py parameters.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 - 19:55:
Author: bugman
Date: Sun Oct 27 19:55:06 2013
New Revision: 21266

URL: http://svn.gna.org/viewcvs/relax?rev=21266&view=rev
Log:
Proper fix for the printout of the optimised dispersion parameters.

The loop_parameters() dispersion function is no longer used, avoiding all 
requirements on the
current data pipe existing.  This allows for proper printouts on a MPI 
cluster.


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

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=21266&r1=21265&r2=21266&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/optimisation.py 
(original)
+++ branches/relax_disp/specific_analyses/relax_disp/optimisation.py Sun Oct 
27 19:55:06 2013
@@ -216,7 +216,7 @@
 class Disp_minimise_command(Slave_command):
     """Command class for relaxation dispersion optimisation on the slave 
processor."""
 
-    def __init__(self, spins=None, spin_ids=None, sim_index=None, 
scaling_matrix=None, min_algor=None, min_options=None, func_tol=None, 
grad_tol=None, max_iterations=None, constraints=False, verbosity=0, 
lower=None, upper=None, inc=None, fields=None):
+    def __init__(self, spins=None, spin_ids=None, sim_index=None, 
scaling_matrix=None, min_algor=None, min_options=None, func_tol=None, 
grad_tol=None, max_iterations=None, constraints=False, verbosity=0, 
lower=None, upper=None, inc=None, fields=None, param_names=None):
         """Initialise the base class, storing all the master data to be sent 
to the slave processor.
 
         This method is run on the master processor whereas the run() method 
is run on the slave processor.
@@ -252,6 +252,8 @@
         @type inc:                  array of int
         @keyword fields:            The list of unique of spectrometer field 
strengths.
         @type fields:               int
+        @keyword param_names:       The list of parameter names to use in 
printouts.
+        @type param_names:          str
         """
 
         # Execute the base class __init__() method.
@@ -269,6 +271,7 @@
         self.grad_tol = grad_tol
         self.max_iterations = max_iterations
         self.fields = fields
+        self.param_names = param_names
 
         # Create the initial parameter vector.
         self.param_vector = assemble_param_vector(spins=self.spins)
@@ -350,17 +353,8 @@
         # 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]*self.scaling_matrix[param_index, param_index]))
+            for i in range(len(param_vector)):
+                print("%-20s %25.15f" % (self.param_names, 
param_vector[i]*self.scaling_matrix[i, i]))
 
         # Printout.
         if self.sim_index != None:

Modified: branches/relax_disp/specific_analyses/relax_disp/parameters.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/parameters.py?rev=21266&r1=21265&r2=21266&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/parameters.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp/parameters.py Sun Oct 27 
19:55:06 2013
@@ -340,6 +340,34 @@
         set_value(value=param_vector[param_index], key=key, spins=spins, 
sim_index=sim_index, param_name=param_name, spin_index=spin_index, 
frq_index=frq_index)
 
 
+def get_param_names(spins=None):
+    """Generate a list of dispersion parameter names for the given spins.
+
+    @keyword spins:         The list of spin data containers for the block.
+    @type spins:            list of SpinContainer instances
+    """
+
+    # Initialise the structure.
+    names = []
+
+    # Loop over the parameters.
+    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=self.spins, model_type=self.model_type):
+        # Set the initial text.
+        param_text = param_name
+
+        # The parameters with additional details.
+        if param_name in ['r2', 'r2a', 'r2b']:
+            frq = return_value_from_frq_index(frq_index)
+            if frq:
+                param_text += " (%.3f MHz)" % (frq / 1e6) 
+ 
+        # Append the text.
+        names.append(param_text)
+
+    # Return the structure.
+    return names
+
+
 def get_value(key=None, spins=None, sim_index=None, param_name=None, 
spin_index=None, frq_index=None):
     """Return the value for the given parameter.
 




Related Messages


Powered by MHonArc, Updated Sun Oct 27 20:00:01 2013