mailr21265 - in /branches/relax_disp/specific_analyses/relax_disp: api.py 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:49:
Author: bugman
Date: Sun Oct 27 19:49:33 2013
New Revision: 21265

URL: http://svn.gna.org/viewcvs/relax?rev=21265&view=rev
Log:
Reverted r21251 as this solution was no good - functions called by 
loop_parameters still required the cdp.

The command used was:
svn merge -r21251:r21250 .


Modified:
    branches/relax_disp/specific_analyses/relax_disp/api.py
    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/api.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/api.py?rev=21265&r1=21264&r2=21265&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/api.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp/api.py Sun Oct 27 
19:49:33 2013
@@ -1048,7 +1048,7 @@
             scaling_matrix = assemble_scaling_matrix(spins=spins, 
scaling=scaling)
 
             # Set up the slave command object.
-            command = Disp_minimise_command(model_type=cdp.model_type, 
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)
+            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, sim_index=sim_index, 
scaling_matrix=scaling_matrix, verbosity=verbosity)

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=21265&r1=21264&r2=21265&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:49:33 2013
@@ -94,7 +94,7 @@
             # Loop over each spectrometer frequency and dispersion point.
             for exp_type, frq, point in loop_exp_frq_point():
                 # Loop over the parameters.
-                for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins, model_type=cdp.model_type):
+                for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins):
                     # R2eff relaxation rate (from 1 to 40 s^-1).
                     if param_name == 'r2eff':
                         lower.append(1.0)
@@ -108,7 +108,7 @@
         # All other models.
         else:
             # Loop over the parameters.
-            for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins, model_type=cdp.model_type):
+            for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins):
                 # Cluster specific parameter.
                 if spin_index == None:
                     spin_index = 0
@@ -147,7 +147,7 @@
                     upper.append(1.0)
 
     # Pre-set parameters.
-    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins, model_type=cdp.model_type):
+    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins):
         # Cluster specific parameter.
         if spin_index == None:
             spin_index = 0
@@ -216,14 +216,12 @@
 class Disp_minimise_command(Slave_command):
     """Command class for relaxation dispersion optimisation on the slave 
processor."""
 
-    def __init__(self, model_type=None, 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):
         """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.
 
 
-        @keyword model_type:        The model type.
-        @type model_type:           str
         @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 spin_ids:          The list of spin ID strings 
corresponding to the spins argument.
@@ -260,7 +258,6 @@
         super(Disp_minimise_command, self).__init__()
 
         # Store the arguments needed by the run() method.
-        self.model_type = model_type
         self.spins = spins
         self.spin_ids = spin_ids
         self.sim_index = sim_index
@@ -353,7 +350,7 @@
         # Optimisation printout.
         if self.verbosity:
             print("\nOptimised parameter values:")
-            for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=self.spins, model_type=self.model_type):
+            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']:

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=21265&r1=21264&r2=21265&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:49:33 2013
@@ -54,7 +54,7 @@
     param_vector = []
 
     # Loop over the parameters of the cluster.
-    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins, model_type=cdp.model_type):
+    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins):
         # Get the value.
         value = get_value(key=key, spins=spins, sim_index=sim_index, 
param_name=param_name, spin_index=spin_index, frq_index=frq_index)
 
@@ -93,7 +93,7 @@
         return scaling_matrix
 
     # Loop over the parameters of the cluster.
-    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins, model_type=cdp.model_type):
+    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins):
         # Transversal relaxation rate scaling.
         if param_name in ['r2', 'r2a', 'r2b']:
             scaling_matrix[param_index, param_index] = 10
@@ -336,7 +336,7 @@
                     spin.r2b.append(None)
 
     # Loop over the parameters of the cluster, setting the values.
-    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins, model_type=cdp.model_type):
+    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins):
         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)
 
 
@@ -497,7 +497,7 @@
     j = 0
 
     # Loop over the parameters of the cluster.
-    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins, model_type=cdp.model_type):
+    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins):
         # Effective transversal relaxation rate.
         if param_name == 'r2eff':
             A.append(zero_array * 0.0)
@@ -587,22 +587,20 @@
     return A, b
 
 
-def loop_parameters(spins=None, model_type=None):
+def loop_parameters(spins=None):
     """Generator function for looping of the parameters of the cluster.
 
-    @keyword spins:         The list of spin data containers for the block.
-    @type spins:            list of SpinContainer instances
-    @keyword model_type:    The current model type.  This is necessary to 
allow this to run on a slave processor by removing the cdp dependence.
-    @type model_type:       str
-    @return:                The parameter name, the parameter index (for the 
parameter vector), the spin index (for the cluster), and the frequency index 
(for parameters with different values per spectrometer field strength).
-    @rtype:                 str, int, int, int
+    @keyword spins: The list of spin data containers for the block.
+    @type spins:    list of SpinContainer instances
+    @return:        The parameter name, the parameter index (for the 
parameter vector), the spin index (for the cluster), and the frequency index 
(for parameters with different values per spectrometer field strength).
+    @rtype:         str, int, int, int
     """
 
     # The parameter index.
     param_index = -1
 
     # The R2eff model.
-    if model_type == 'R2eff':
+    if cdp.model_type == 'R2eff':
         # Loop over the spins.
         for spin_index in range(len(spins)):
             # Yield the two parameters.
@@ -704,7 +702,7 @@
     """
 
     # Loop over the parameters of the cluster.
-    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins, model_type=cdp.model_type):
+    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins):
         # Get the value.
         value = get_value(key=key, spins=spins, sim_index=sim_index, 
param_name=param_name, spin_index=spin_index, frq_index=frq_index)
 
@@ -754,7 +752,7 @@
     """
 
     # Loop over the parameters, yielding when a match is found.
-    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins, model_type=cdp.model_type):
+    for param_name, param_index, spin_index, frq_index in 
loop_parameters(spins=spins):
         if param_index == index:
             return param_name, spin_index, frq_index
 




Related Messages


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