mailr6937 - /branches/rdc_analysis/maths_fns/n_state_model.py


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

Header


Content

Posted by edward on July 10, 2008 - 13:51:
Author: bugman
Date: Thu Jul 10 13:51:21 2008
New Revision: 6937

URL: http://svn.gna.org/viewcvs/relax?rev=6937&view=rev
Log:
The minimisation code now uses the scaling matrix.


Modified:
    branches/rdc_analysis/maths_fns/n_state_model.py

Modified: branches/rdc_analysis/maths_fns/n_state_model.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/rdc_analysis/maths_fns/n_state_model.py?rev=6937&r1=6936&r2=6937&view=diff
==============================================================================
--- branches/rdc_analysis/maths_fns/n_state_model.py (original)
+++ branches/rdc_analysis/maths_fns/n_state_model.py Thu Jul 10 13:51:21 2008
@@ -33,7 +33,7 @@
 class N_state_opt:
     """Class containing the target function of the optimisation of the 
N-state model."""
 
-    def __init__(self, model=None, N=None, init_params=None, 
full_tensors=None, red_data=None, red_errors=None, full_in_ref_frame=None, 
rdcs=None, rdc_errors=None, xh_vect=None):
+    def __init__(self, model=None, N=None, init_params=None, 
full_tensors=None, red_data=None, red_errors=None, full_in_ref_frame=None, 
rdcs=None, rdc_errors=None, xh_vect=None, scaling_matrix=None):
         """Set up the class instance for optimisation.
 
         All constant data required for the N-state model are initialised 
here.
@@ -66,12 +66,21 @@
                                 spin systems and the second index to each 
structure (its size being
                                 equal to the number of states).
         @type xh_vect:          numpy matrix
+        @scaling_matrix:        The square and diagonal scaling matrix.
+        @scaling_matrix:        numpy rank-2 array
         """
 
         # Store the data inside the class instance namespace.
         self.N = N
         self.params = 1.0 * init_params    # Force a copy of the data to be 
stored.
         self.total_num_params = len(init_params)
+
+        # Scaling initialisation.
+        self.scaling_matrix = scaling_matrix
+        if self.scaling_matrix != None:
+            self.scaling_flag = True
+        else:
+            self.scaling_flag = False
 
         # The 2-domain N-state model.
         if model == '2-domain':
@@ -148,6 +157,10 @@
         @rtype:         float
         """
 
+        # Scaling.
+        if self.scaling_flag:
+            params = dot(params, self.scaling_matrix)
+
         # Reset the back-calculated the reduced tensor structure.
         self.red_bc = self.red_bc * 0.0
 
@@ -206,6 +219,10 @@
         @rtype:         float
         """
 
+        # Scaling.
+        if self.scaling_flag:
+            params = dot(params, self.scaling_matrix)
+
         # Initial chi-squared (or SSE) value.
         chi2_sum = 0.0
 




Related Messages


Powered by MHonArc, Updated Thu Jul 10 15:00:20 2008