mailr20299 - in /branches/relax_disp: specific_analyses/relax_disp/api.py target_functions/relax_disp.py


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

Header


Content

Posted by edward on July 15, 2013 - 12:03:
Author: bugman
Date: Mon Jul 15 12:03:38 2013
New Revision: 20299

URL: http://svn.gna.org/viewcvs/relax?rev=20299&view=rev
Log:
The fixed relaxation time period is now sent into the 'NS 2-site star' 
dispersion model.


Modified:
    branches/relax_disp/specific_analyses/relax_disp/api.py
    branches/relax_disp/target_functions/relax_disp.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=20299&r1=20298&r2=20299&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/api.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp/api.py Mon Jul 15 
12:03:38 2013
@@ -1109,7 +1109,7 @@
                     print("Unconstrained grid search size: %s (constraints 
may decrease this size).\n" % grid_size)
 
             # Initialise the function to minimise.
-            model = Dispersion(model=spins[0].model, 
num_params=param_num(spins=spins), num_spins=len(spins), num_frq=field_count, 
num_disp_points=cdp.dispersion_points, values=values, errors=errors, 
missing=missing, frqs=frqs, cpmg_frqs=return_cpmg_frqs(ref_flag=False), 
spin_lock_nu1=return_spin_lock_nu1(ref_flag=False), 
scaling_matrix=scaling_matrix)
+            model = Dispersion(model=spins[0].model, 
num_params=param_num(spins=spins), num_spins=len(spins), num_frq=field_count, 
num_disp_points=cdp.dispersion_points, values=values, errors=errors, 
missing=missing, frqs=frqs, cpmg_frqs=return_cpmg_frqs(ref_flag=False), 
spin_lock_nu1=return_spin_lock_nu1(ref_flag=False), 
relax_time=cdp.relax_time_list[0], scaling_matrix=scaling_matrix)
 
             # Grid search.
             if search('^[Gg]rid', min_algor):

Modified: branches/relax_disp/target_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/target_functions/relax_disp.py?rev=20299&r1=20298&r2=20299&view=diff
==============================================================================
--- branches/relax_disp/target_functions/relax_disp.py (original)
+++ branches/relax_disp/target_functions/relax_disp.py Mon Jul 15 12:03:38 
2013
@@ -40,7 +40,7 @@
 
 
 class Dispersion:
-    def __init__(self, model=None, num_params=None, num_spins=None, 
num_frq=None, num_disp_points=None, values=None, errors=None, missing=None, 
frqs=None, cpmg_frqs=None, spin_lock_nu1=None, scaling_matrix=None):
+    def __init__(self, model=None, num_params=None, num_spins=None, 
num_frq=None, num_disp_points=None, values=None, errors=None, missing=None, 
frqs=None, cpmg_frqs=None, spin_lock_nu1=None, relax_time=None, 
scaling_matrix=None):
         """Relaxation dispersion target functions for optimisation.
 
         Models
@@ -83,6 +83,8 @@
         @type cpmg_frqs:            numpy rank-1 float array
         @keyword spin_lock_nu1:     The spin-lock field strengths in Hertz 
for each separate dispersion point.  This will be ignored for CPMG 
experiments.
         @type spin_lock_nu1:        numpy rank-1 float array
+        @keyword relax_time:        The fixed time period for relaxation (in 
seconds).
+        @type relax_time:           float
         @keyword scaling_matrix:    The square and diagonal scaling matrix.
         @type scaling_matrix:       numpy rank-2 float array
         """
@@ -108,6 +110,7 @@
         self.frqs = frqs
         self.cpmg_frqs = cpmg_frqs
         self.spin_lock_nu1 = spin_lock_nu1
+        self.relax_time = relax_time
         self.scaling_matrix = scaling_matrix
 
         # Scaling initialisation.
@@ -514,15 +517,15 @@
                 dw_frq = dw[spin_index] * self.frqs[spin_index, frq_index]
 
                 # Back calculate the R2eff values.
-                r2eff_ns_2site_star(r20a=R20A[r20_index], 
r20b=R20B[r20_index], pA=pA, pB=pB, fA=dw_frq, kex=kex, k_AB=k_AB, k_BA=k_BA, 
cpmg_frqs=self.cpmg_frqs, back_calc=self.back_calc[spin_index, frq_index], 
num_points=self.num_disp_points)
-
-                # For all missing data points, set the back-calculated value 
to the measured values so that it has no effect on the chi-squared value.
-                for point_index in range(self.num_disp_points):
-                    if self.missing[spin_index, frq_index, point_index]:
-                        self.back_calc[spin_index, frq_index, point_index] = 
self.values[spin_index, frq_index, point_index]
-
-                # Calculate and return the chi-squared value.
-                chi2_sum += chi2(self.values[spin_index, frq_index], 
self.back_calc[spin_index, frq_index], self.errors[spin_index, frq_index])
-
-        # Return the total chi-squared value.
-        return chi2_sum
+                r2eff_ns_2site_star(r20a=R20A[r20_index], 
r20b=R20B[r20_index], pA=pA, pB=pB, fA=dw_frq, kex=kex, k_AB=k_AB, k_BA=k_BA, 
tcpmg=self.relax_time, cpmg_frqs=self.cpmg_frqs, 
back_calc=self.back_calc[spin_index, frq_index], 
num_points=self.num_disp_points)
+
+                # For all missing data points, set the back-calculated value 
to the measured values so that it has no effect on the chi-squared value.
+                for point_index in range(self.num_disp_points):
+                    if self.missing[spin_index, frq_index, point_index]:
+                        self.back_calc[spin_index, frq_index, point_index] = 
self.values[spin_index, frq_index, point_index]
+
+                # Calculate and return the chi-squared value.
+                chi2_sum += chi2(self.values[spin_index, frq_index], 
self.back_calc[spin_index, frq_index], self.errors[spin_index, frq_index])
+
+        # Return the total chi-squared value.
+        return chi2_sum




Related Messages


Powered by MHonArc, Updated Mon Jul 15 14:00:02 2013