mailr24711 - in /branches/frame_order_cleanup/specific_analyses/frame_order: 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 July 24, 2014 - 16:04:
Author: bugman
Date: Thu Jul 24 16:04:13 2014
New Revision: 24711

URL: http://svn.gna.org/viewcvs/relax?rev=24711&view=rev
Log:
Fixes for the parameter scaling changes in the trunk.

The scaling flag is no longer part of the specific analysis API optimisation 
methods.  Instead the
pre-assembled scaling matrices are passed into all three API optimisation 
methods.


Modified:
    branches/frame_order_cleanup/specific_analyses/frame_order/api.py
    branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py

Modified: branches/frame_order_cleanup/specific_analyses/frame_order/api.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/api.py?rev=24711&r1=24710&r2=24711&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/api.py   
(original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/api.py   Thu 
Jul 24 16:04:13 2014
@@ -126,11 +126,8 @@
         # Set up the data structures for the target function.
         param_vector, full_tensors, full_in_ref_frame, rdcs, rdc_err, 
rdc_weight, rdc_vect, rdc_const, pcs, pcs_err, pcs_weight, atomic_pos, temp, 
frq, paramag_centre, com, ave_pos_pivot, pivot, pivot_opt = 
target_fn_data_setup(sim_index=sim_index, verbosity=verbosity)
 
-        # Parameter scaling.
-        scaling_matrix = assemble_scaling_matrix(scaling=True)
-
         # Set up the optimisation target function class.
-        target_fn = frame_order.Frame_order(model=cdp.model, 
init_params=param_vector, full_tensors=full_tensors, 
full_in_ref_frame=full_in_ref_frame, rdcs=rdcs, rdc_errors=rdc_err, 
rdc_weights=rdc_weight, rdc_vect=rdc_vect, dip_const=rdc_const, pcs=pcs, 
pcs_errors=pcs_err, pcs_weights=pcs_weight, atomic_pos=atomic_pos, temp=temp, 
frq=frq, paramag_centre=paramag_centre, scaling_matrix=scaling_matrix, 
com=com, ave_pos_pivot=ave_pos_pivot, pivot=pivot, pivot_opt=pivot_opt, 
num_int_pts=cdp.num_int_pts)
+        target_fn = frame_order.Frame_order(model=cdp.model, 
init_params=param_vector, full_tensors=full_tensors, 
full_in_ref_frame=full_in_ref_frame, rdcs=rdcs, rdc_errors=rdc_err, 
rdc_weights=rdc_weight, rdc_vect=rdc_vect, dip_const=rdc_const, pcs=pcs, 
pcs_errors=pcs_err, pcs_weights=pcs_weight, atomic_pos=atomic_pos, temp=temp, 
frq=frq, paramag_centre=paramag_centre, scaling_matrix=scaling_matrix[0], 
com=com, ave_pos_pivot=ave_pos_pivot, pivot=pivot, pivot_opt=pivot_opt, 
num_int_pts=cdp.num_int_pts)
 
         # Make a single function call.  This will cause back calculation and 
the data will be stored in the class instance.
         chi2 = target_fn.func(param_vector)
@@ -365,9 +362,6 @@
         # Test if the pivot has been set.
         check_pivot()
 
-        # Parameter scaling.
-        scaling_matrix = assemble_scaling_matrix(scaling=True)
-
         # The number of parameters.
         n = param_num()
 
@@ -478,10 +472,10 @@
         # Loop over each grid subdivision, with all points violating 
constraints being eliminated.
         for subdivision in 
grid_split_array(divisions=processor.processor_size(), points=pts, A=A, b=b, 
verbosity=verbosity):
             # Set up the memo for storage on the master.
-            memo = Frame_order_memo(sim_index=sim_index, scaling=True, 
scaling_matrix=scaling_matrix)
+            memo = Frame_order_memo(sim_index=sim_index, 
scaling_matrix=scaling_matrix[0])
 
             # Set up the command object to send to the slave and execute.
-            command = Frame_order_grid_command(points=subdivision, 
scaling_matrix=scaling_matrix, sim_index=sim_index, model=cdp.model, 
param_vector=param_vector, full_tensors=full_tensors, 
full_in_ref_frame=full_in_ref_frame, rdcs=rdcs, rdc_err=rdc_err, 
rdc_weight=rdc_weight, rdc_vect=rdc_vect, rdc_const=rdc_const, pcs=pcs, 
pcs_err=pcs_err, pcs_weight=pcs_weight, atomic_pos=atomic_pos, temp=temp, 
frq=frq, paramag_centre=paramag_centre, com=com, ave_pos_pivot=ave_pos_pivot, 
pivot=pivot, pivot_opt=pivot_opt, num_int_pts=cdp.num_int_pts, 
verbosity=verbosity)
+            command = Frame_order_grid_command(points=subdivision, 
scaling_matrix=scaling_matrix[0], sim_index=sim_index, model=cdp.model, 
param_vector=param_vector, full_tensors=full_tensors, 
full_in_ref_frame=full_in_ref_frame, rdcs=rdcs, rdc_err=rdc_err, 
rdc_weight=rdc_weight, rdc_vect=rdc_vect, rdc_const=rdc_const, pcs=pcs, 
pcs_err=pcs_err, pcs_weight=pcs_weight, atomic_pos=atomic_pos, temp=temp, 
frq=frq, paramag_centre=paramag_centre, com=com, ave_pos_pivot=ave_pos_pivot, 
pivot=pivot, pivot_opt=pivot_opt, num_int_pts=cdp.num_int_pts, 
verbosity=verbosity)
 
             # Add the slave command and memo to the processor queue.
             processor.add_to_queue(command, memo)
@@ -561,9 +555,6 @@
         if algor not in allowed:
             raise RelaxError("Only the 'simplex' minimisation algorithm is 
supported for the relaxation dispersion analysis as function gradients are 
not implemented.")
 
-        # Obtain the scaling matrix.
-        scaling_matrix = assemble_scaling_matrix()
-
         # Set up the data structures for the target function.
         param_vector, full_tensors, full_in_ref_frame, rdcs, rdc_err, 
rdc_weight, rdc_vect, rdc_const, pcs, pcs_err, pcs_weight, atomic_pos, temp, 
frq, paramag_centre, com, ave_pos_pivot, pivot, pivot_opt = 
target_fn_data_setup(sim_index=sim_index, verbosity=verbosity)
 
@@ -572,10 +563,10 @@
         processor = processor_box.processor
 
         # Set up the memo for storage on the master.
-        memo = Frame_order_memo(sim_index=sim_index, scaling=scaling, 
scaling_matrix=scaling_matrix)
+        memo = Frame_order_memo(sim_index=sim_index, 
scaling_matrix=scaling_matrix[0])
 
         # Set up the command object to send to the slave and execute.
-        command = Frame_order_minimise_command(min_algor=min_algor, 
min_options=min_options, func_tol=func_tol, grad_tol=grad_tol, 
max_iterations=max_iterations, scaling_matrix=scaling_matrix, 
constraints=constraints, sim_index=sim_index, model=cdp.model, 
param_vector=param_vector, full_tensors=full_tensors, 
full_in_ref_frame=full_in_ref_frame, rdcs=rdcs, rdc_err=rdc_err, 
rdc_weight=rdc_weight, rdc_vect=rdc_vect, rdc_const=rdc_const, pcs=pcs, 
pcs_err=pcs_err, pcs_weight=pcs_weight, atomic_pos=atomic_pos, temp=temp, 
frq=frq, paramag_centre=paramag_centre, com=com, ave_pos_pivot=ave_pos_pivot, 
pivot=pivot, pivot_opt=pivot_opt, num_int_pts=cdp.num_int_pts, 
verbosity=verbosity)
+        command = Frame_order_minimise_command(min_algor=min_algor, 
min_options=min_options, func_tol=func_tol, grad_tol=grad_tol, 
max_iterations=max_iterations, scaling_matrix=scaling_matrix[0], 
constraints=constraints, sim_index=sim_index, model=cdp.model, 
param_vector=param_vector, full_tensors=full_tensors, 
full_in_ref_frame=full_in_ref_frame, rdcs=rdcs, rdc_err=rdc_err, 
rdc_weight=rdc_weight, rdc_vect=rdc_vect, rdc_const=rdc_const, pcs=pcs, 
pcs_err=pcs_err, pcs_weight=pcs_weight, atomic_pos=atomic_pos, temp=temp, 
frq=frq, paramag_centre=paramag_centre, com=com, ave_pos_pivot=ave_pos_pivot, 
pivot=pivot, pivot_opt=pivot_opt, num_int_pts=cdp.num_int_pts, 
verbosity=verbosity)
 
         # Add the slave command and memo to the processor queue.
         processor.add_to_queue(command, memo)

Modified: 
branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py?rev=24711&r1=24710&r2=24711&view=diff
==============================================================================
--- 
branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py  
(original)
+++ 
branches/frame_order_cleanup/specific_analyses/frame_order/optimisation.py  
Thu Jul 24 16:04:13 2014
@@ -704,7 +704,7 @@
     return param_vector, full_tensors, full_in_ref_frame, rdcs, rdc_err, 
rdc_weight, rdc_vect, rdc_const, pcs, pcs_err, pcs_weight, atomic_pos, temp, 
frq, paramag_centre, com, ave_pos_pivot, pivot, pivot_opt
 
 
-def unpack_opt_results(param_vector=None, func=None, iter_count=None, 
f_count=None, g_count=None, h_count=None, warning=None, scaling_matrix=None, 
scaling_matrix=None, sim_index=None):
+def unpack_opt_results(param_vector=None, func=None, iter_count=None, 
f_count=None, g_count=None, h_count=None, warning=None, scaling_matrix=None, 
sim_index=None):
     """Unpack and store the Frame Order optimisation results.
 
     @keyword param_vector:      The model-free parameter vector.
@@ -907,7 +907,7 @@
 class Frame_order_memo(Memo):
     """The frame order memo class."""
 
-    def __init__(self, spins=None, spin_ids=None, sim_index=None, 
scaling_matrix=None, verbosity=None, scaling=False):
+    def __init__(self, spins=None, spin_ids=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.
@@ -923,8 +923,6 @@
         @type scaling_matrix:       numpy diagonal matrix
         @keyword verbosity:         The verbosity level.  This is used by 
the result command returned to the master for printouts.
         @type verbosity:            int
-        @keyword scaling:           If True, diagonal scaling is enabled 
during optimisation to allow the problem to be better conditioned.
-        @type scaling:              bool
         """
 
         # Execute the base class __init__() method.
@@ -935,7 +933,6 @@
         self.spin_ids = spin_ids
         self.sim_index = sim_index
         self.scaling_matrix = scaling_matrix
-        self.scaling = scaling
 
 
 
@@ -1144,7 +1141,7 @@
                 print("Storing the optimisation results, no optimised values 
currently exist.")
 
         # Unpack the results.
-        unpack_opt_results(param_vector, func, iter_count, f_count, g_count, 
h_count, warning, memo.scaling, memo.scaling_matrix, memo.sim_index)
+        unpack_opt_results(param_vector, func, iter_count, f_count, g_count, 
h_count, warning, memo.scaling_matrix, memo.sim_index)
 
         # Store the back-calculated data.
         store_bc_data(A_5D_bc=self.A_5D_bc, pcs_theta=self.pcs_theta, 
rdc_theta=self.rdc_theta)




Related Messages


Powered by MHonArc, Updated Thu Jul 24 16:40:02 2014