mailr20905 - in /branches/relax_disp: lib/dispersion/ specific_analyses/relax_disp/ target_functions/ test_suite/system_tests/ u...


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

Header


Content

Posted by edward on September 06, 2013 - 16:12:
Author: bugman
Date: Fri Sep  6 16:12:15 2013
New Revision: 20905

URL: http://svn.gna.org/viewcvs/relax?rev=20905&view=rev
Log:
Converted references of ka and kA to k_AB.

Progress sr #3071: https://gna.org/support/index.php?3071 - Implementation of 
Tollinger/Kay dispersion model (2001)
Following the guide at: 
http://wiki.nmr-relax.com/Tutorial_for_adding_relaxation_dispersion_models_to_relax

Troels E. Linnet provided this patch. Commit by: tlinnet _aaattt_ 
gmail_dot_com

Signed-off-by: Edward d'Auvergne <edward@xxxxxxxxxxxxx>

Modified:
    branches/relax_disp/lib/dispersion/tsmfk01.py
    branches/relax_disp/specific_analyses/relax_disp/api.py
    branches/relax_disp/specific_analyses/relax_disp/parameters.py
    branches/relax_disp/target_functions/relax_disp.py
    branches/relax_disp/test_suite/system_tests/relax_disp.py
    branches/relax_disp/user_functions/relax_disp.py

Modified: branches/relax_disp/lib/dispersion/tsmfk01.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/tsmfk01.py?rev=20905&r1=20904&r2=20905&view=diff
==============================================================================
--- branches/relax_disp/lib/dispersion/tsmfk01.py (original)
+++ branches/relax_disp/lib/dispersion/tsmfk01.py Fri Sep  6 16:12:15 2013
@@ -23,7 +23,7 @@
 
 # Module docstring.
 """The Tollinger, Kay et al. (2001) 2-site very-slow exchange model, range 
of microsecond to second time scale.
-Applicable in the limit of slow exchange, when |R20A-R2bj| << kA,kB << 
1/tau_CP. R20A is the transverse relaxation rate of site A in the absence of 
exchange.
+Applicable in the limit of slow exchange, when |R2A-R2B| << k_AB, kB << 
1/tau_CP. R20A is the transverse relaxation rate of site A in the absence of 
exchange.
 2*tau_CP is is the time between successive 180 deg. pulses.
 
 This module is for the function, gradient and Hessian of the TSMFK01 model.  
The model is named after the reference:
@@ -32,22 +32,22 @@
 
 The equation used is::
 
-                              sin(delta_omega * tau_CP)
-    R2Aeff = R20A + kA - kA * -------------------------  ,
-                               delta_omega * tau_CP
+                                   sin(delta_omega * tau_CP)
+    R2Aeff = R20A + k_AB - k_AB * -------------------------  ,
+                                   delta_omega * tau_CP
 
 where::
 
     tau_CP = 1.0/(4*nu_cpmg) ,
 
-R20A is the transverse relaxation rate of site A in the absence of exchange, 
2*tau_CP is is the time between successive 180 deg. pulses, kA is the forward 
chemical exchange rate constant, delta_omega is the chemical shift difference 
between the two states.
+R20A is the transverse relaxation rate of site A in the absence of exchange, 
2*tau_CP is is the time between successive 180 deg. pulses, k_AB is the 
forward chemical exchange rate constant, delta_omega is the chemical shift 
difference between the two states.
 """
 
 # Python module imports.
 from math import sin
 
 
-def r2eff_TSMFK01(r20a=None, dw=None, kA=None, cpmg_frqs=None, 
back_calc=None, num_points=None):
+def r2eff_TSMFK01(r20a=None, dw=None, k_AB=None, cpmg_frqs=None, 
back_calc=None, num_points=None):
     """Calculate the R2eff values for the TSMFK01 model.
 
     See the module docstring for details.
@@ -57,8 +57,8 @@
     @type r20a:             float
     @keyword dw:            The chemical exchange difference between states 
A and B in rad/s.
     @type dw:               float
-    @keyword kA:            The kA parameter value (the forward exchange 
rate in rad/s).
-    @type kA:               float
+    @keyword k_AB:          The k_AB parameter value (the forward exchange 
rate in rad/s).
+    @type k_AB:             float
     @keyword cpmg_frqs:     The CPMG nu1 frequencies.
     @type cpmg_frqs:        numpy rank-1 float array
     @keyword back_calc:     The array for holding the back calculated R2eff 
values.  Each element corresponds to one of the CPMG nu1 frequencies.
@@ -82,7 +82,7 @@
 
         # Catch zeros (to avoid pointless mathematical operations).
         if numer == 0.0:
-            back_calc[i] = r20a + kA
+            back_calc[i] = r20a + k_AB
             continue
 
         # Denominator.
@@ -95,4 +95,4 @@
 
         # The full formula.
         else:
-            back_calc[i] = r20a + kA - kA * numer / denom
+            back_calc[i] = r20a + k_AB - k_AB * numer / denom

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=20905&r1=20904&r2=20905&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/api.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp/api.py Fri Sep  6 
16:12:15 2013
@@ -96,7 +96,7 @@
         self.PARAMS.add('kB', scope='spin', default=10000.0, 
desc='Approximate chemical exchange rate constant between sites A and B 
(rad.s^-1)', set='params', py_type=float, grace_string='\\qk\\sB\\N\\Q 
(rad.s\\S-1\\N)', err=True, sim=True)
         self.PARAMS.add('kC', scope='spin', default=10000.0, 
desc='Approximate chemical exchange rate constant between sites A and C 
(rad.s^-1)', set='params', py_type=float, grace_string='\\qk\\sC\\N\\Q 
(rad.s\\S-1\\N)', err=True, sim=True)
         self.PARAMS.add('tex', scope='spin', default=1.0/20000.0, desc='The 
time of exchange (tex = 1/(2kex))', set='params', py_type=float, 
grace_string='\\q\\xt\\B\\sex\\N\\Q (s.rad\\S-1\\N)', err=True, sim=True)
-        self.PARAMS.add('kA', scope='spin', default=10000.0, desc='The 
exchange rate from state A to state B', set='params', py_type=float, 
grace_string='\\qk\\sA\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True)
+        self.PARAMS.add('k_AB', scope='spin', default=10000.0, desc='The 
exchange rate from state A to state B', set='params', py_type=float, 
grace_string='\\qk\\sA\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True)
         self.PARAMS.add('params', scope='spin', desc='The model parameters', 
py_type=list)
 
         # Add the minimisation data.
@@ -382,7 +382,7 @@
                         upper.append(1.0)
 
                     # Exchange rates.
-                    elif spin.params[i] in ['kex', 'kA', 'kB', 'kC']:
+                    elif spin.params[i] in ['kex', 'k_AB', 'kB', 'kC']:
                         lower.append(1.0)
                         upper.append(100000.0)
 
@@ -675,7 +675,7 @@
             params = []
             for frq in loop_frq():
                 params.append('r2a')
-            params += ['dw', 'kA']
+            params += ['dw', 'k_AB']
 
         # Full NS CPMG 2-site 3D model.
         elif model == MODEL_NS_CPMG_2SITE_3D_FULL:
@@ -1382,7 +1382,7 @@
     _table.add_row(["The pA.dw**2 parameter (ppm^2)", "'padw2'"])
     _table.add_row(["Chemical shift difference between states A and B 
(ppm)", "'dw'"])
     _table.add_row(["Exchange rate (rad/s)", "'kex'"])
-    _table.add_row(["Exchange rate from state A to state B (rad/s)", "'kA'"])
+    _table.add_row(["Exchange rate from state A to state B (rad/s)", 
"'k_AB'"])
     _table.add_row(["Time of exchange (s/rad)", "'tex'"])
     _table.add_row(["Peak intensities (series)", "'intensities'"])
     _table.add_row(["CPMG pulse train frequency (series, Hz)", 
"'cpmg_frqs'"])
@@ -1421,7 +1421,7 @@
 
 
     set_doc = Desc_container("Relaxation dispersion curve fitting set 
details")
-    set_doc.add_paragraph("Only three parameters can be set for either the 
slow- or the fast-exchange regime. For the slow-exchange regime, these 
parameters include the transversal relaxation rate for state A (R2A), the 
exchange rate from state A to state (kA) and the chemical shift difference 
between states A and B (dw). For the fast-exchange regime, these include the 
transversal relaxation rate (R2), the chemical exchange contribution to R2 
(Rex) and the exchange rate (kex). Setting parameters for a non selected 
model has no effect.")
+    set_doc.add_paragraph("Only three parameters can be set for either the 
slow- or the fast-exchange regime. For the slow-exchange regime, these 
parameters include the transversal relaxation rate for state A (R2A), the 
exchange rate from state A to state (k_AB) and the chemical shift difference 
between states A and B (dw). For the fast-exchange regime, these include the 
transversal relaxation rate (R2), the chemical exchange contribution to R2 
(Rex) and the exchange rate (kex). Setting parameters for a non selected 
model has no effect.")
 
 
     def set_error(self, model_info, index, error):

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=20905&r1=20904&r2=20905&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/parameters.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp/parameters.py Fri Sep  6 
16:12:15 2013
@@ -113,7 +113,7 @@
             scaling_matrix[param_index, param_index] = 1
 
         # Exchange rate scaling.
-        elif param_name in ['kex', 'ka', 'kB', 'kC']:
+        elif param_name in ['kex', 'k_AB', 'kB', 'kC']:
             scaling_matrix[param_index, param_index] = 10000
 
         # Time of exchange scaling.
@@ -423,7 +423,7 @@
         0 <= kB <= 2e6
         0 <= kC <= 2e6
         tex >= 0
-        kA >= 0
+        k_AB >= 0
 
 
     Matrix notation
@@ -473,7 +473,7 @@
         |         |     |          |      |         |
         | 1  0  0 |     |   tex    |      |    0    |
         |         |     |          |      |         |
-        | 1  0  0 |     |    kA    |      |    0    |
+        | 1  0  0 |     |   k_AB   |      |    0    |
 
 
     @keyword spins:             The list of spin data containers for the 
block.
@@ -555,7 +555,7 @@
                 j += 1
 
         # Exchange rates and times (0 <= k <= 2e6).
-        elif param_name in ['kex', 'ka', 'kB', 'kC']:
+        elif param_name in ['kex', 'k_AB', 'kB', 'kC']:
             A.append(zero_array * 0.0)
             A.append(zero_array * 0.0)
             A[j][param_index] = 1.0

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=20905&r1=20904&r2=20905&view=diff
==============================================================================
--- branches/relax_disp/target_functions/relax_disp.py (original)
+++ branches/relax_disp/target_functions/relax_disp.py Fri Sep  6 16:12:15 
2013
@@ -1084,7 +1084,7 @@
         # Unpack the parameter values.
         R20A = params[:self.end_index[0]]
         dw = params[self.end_index[0]:self.end_index[1]]
-        kA = params[self.end_index[1]]
+        k_AB = params[self.end_index[1]]
 
         # Initialise.
         chi2_sum = 0.0
@@ -1100,15 +1100,15 @@
                 dw_frq = dw[spin_index] * self.frqs[spin_index, frq_index]
 
                 # Back calculate the R2eff values.
-                r2eff_TSMFK01(r20a=R20A[r20a_index], dw=dw_frq, kA=kA, 
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_TSMFK01(r20a=R20A[r20a_index], dw=dw_frq, k_AB=k_AB, 
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

Modified: branches/relax_disp/test_suite/system_tests/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/relax_disp.py?rev=20905&r1=20904&r2=20905&view=diff
==============================================================================
--- branches/relax_disp/test_suite/system_tests/relax_disp.py (original)
+++ branches/relax_disp/test_suite/system_tests/relax_disp.py Fri Sep  6 
16:12:15 2013
@@ -250,7 +250,7 @@
         ]
 
         # List of parameters which do not belong to the model.
-        blacklist = ['cpmg_frqs', 'r2', 'rex', 'kex', 'r2a', 'ka', 'dw']
+        blacklist = ['cpmg_frqs', 'r2', 'rex', 'kex', 'r2a', 'k_AB', 'dw']
 
         # Checks for each residue.
         for i in range(len(res_data)):
@@ -1066,11 +1066,11 @@
 
         {Representative 15N CPMG relaxation dispersion curve measured on the 
cross peaks from residue L61 in folded ACBP at pH 5.3, 1 M GuHCl, and 40C.}
           1. The dotted line represents a residue-specific fit of all 
parameters in Eq. 1.
-            - ka = 11.3 +/- 0.7 s^{-1}
+            - k_AB = 11.3 +/- 0.7 s^{-1}
             - dw = (2.45 +/- 0.09) * 10^3 s^{-1}
             - R2 = 8.0 +/- 0.5 s^{-1}.
-          2. The solid line represents a global fit of ka to all protein 
residues and a residue-specific fit of dw and R2.}
-            -.ka = 10.55 +/- 0.08 s^{-1}
+          2. The solid line represents a global fit of k_AB to all protein 
residues and a residue-specific fit of dw and R2.}
+            -.k_AB = 10.55 +/- 0.08 s^{-1}
             - dw = (2.44 +/- 0.08) * 10^3 s^{-1}
             - R2 = 8.4 +/- 0.3 s^{-1}.
 
@@ -1089,7 +1089,7 @@
         # Set the initial parameter values.
         res61L.r2a = [8]
         res61L.dw = 6.5
-        res61L.kA = 11.0
+        res61L.k_AB = 11.0
 
         # Low precision optimisation.
         self.interpreter.minimise(min_algor='simplex', line_search=None, 
hessian_mod=None, hessian_type=None, func_tol=1e-05, grad_tol=None, 
max_iter=1000, constraints=True, scaling=True, verbosity=1)
@@ -1099,14 +1099,14 @@
         print("%-20s %-20s" % ("Parameter", "Value (:61)"))
         print("%-20s %20.15g" % ("R2A (600 MHz)", res61L.r2a[0]))
         print("%-20s %20.15g" % ("dw", res61L.dw))
-        print("%-20s %20.15g" % ("kA", res61L.kA))
+        print("%-20s %20.15g" % ("k_AB", res61L.k_AB))
         print("%-20s %20.15g\n" % ("chi2", res61L.chi2))
 
         # Checks for residue :61. Reference values from paper
 
         self.assertAlmostEqual(res61L.r2a[0], 8.4, -1)
         self.assertAlmostEqual(res61L.dw, 6.41, 2)
-        self.assertAlmostEqual(res61L.kA, 10.55, 0)
+        self.assertAlmostEqual(res61L.k_AB, 10.55, 0)
         self.assertAlmostEqual(res61L.chi2, 60.0, 5)
 
 

Modified: branches/relax_disp/user_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/user_functions/relax_disp.py?rev=20905&r1=20904&r2=20905&view=diff
==============================================================================
--- branches/relax_disp/user_functions/relax_disp.py (original)
+++ branches/relax_disp/user_functions/relax_disp.py Fri Sep  6 16:12:15 2013
@@ -469,7 +469,7 @@
         u("%s: {R\u2082, ..., pA, d\u03C9, k\u2091\u2093}") % MODEL_CR72,
         u("%s: {R\u2082A, R\u2082B, ..., pA, d\u03C9, k\u2091\u2093}") % 
MODEL_CR72_FULL,
         u("%s: {R\u2082, ..., \u03D5\u2091\u2093, pA.d\u03C9\u00B2, 
k\u2091\u2093}") % MODEL_IT99,
-        u("%s: {R\u2082A, ..., d\u03C9, kA}") % MODEL_TSMFK01,
+        u("%s: {R\u2082A, ..., d\u03C9, k_AB}") % MODEL_TSMFK01,
         u("%s: {R\u2082, ..., pA, d\u03C9, k\u2091\u2093}") % 
MODEL_NS_CPMG_2SITE_3D,
         u("%s: {R\u2082A, R\u2082B, ..., pA, d\u03C9, k\u2091\u2093}") % 
MODEL_NS_CPMG_2SITE_3D_FULL,
         u("%s: {R\u2082, ..., pA, d\u03C9, k\u2091\u2093}") % 
MODEL_NS_CPMG_2SITE_STAR,
@@ -516,7 +516,7 @@
 uf.desc[-1].add_item_list_element("'%s'" % MODEL_CR72, "The reduced Carver 
and Richards (1972) 2-site equation for all time scales whereby the 
simplification R20A = R20B is assumed.  The parameters are {R20, ..., pA, dw, 
kex}.")
 uf.desc[-1].add_item_list_element("'%s'" % MODEL_CR72_FULL, "The full Carver 
and Richards (1972) 2-site equation for all time scales with parameters 
{R20A, R20B, ..., pA, dw, kex}.")
 uf.desc[-1].add_item_list_element("'%s'" % MODEL_IT99, "The Ishima and 
Torchia (1999) 2-site model for all time scales with pA >> pB and with 
parameters {R20, ..., phi_ex, padw2, kex}.")
-uf.desc[-1].add_item_list_element("'%s'" % MODEL_TSMFK01, "The Tollinger, 
Kay et al. (2001) 2-site very-slow exchange model, range of microsecond to 
second time scale.  Applicable in the limit of slow exchange, when 
|R20A-R20B| << kA,kB << 1/tau_CP.  R20A is the transverse relaxation rate of 
site A in the absence of exchange.  2*tau_CP is is the time between 
successive 180 deg. pulses.  The parameters are {R20A, ..., dw, kA}.")
+uf.desc[-1].add_item_list_element("'%s'" % MODEL_TSMFK01, "The Tollinger, 
Kay et al. (2001) 2-site very-slow exchange model, range of microsecond to 
second time scale.  Applicable in the limit of slow exchange, when 
|R20A-R20B| << k_AB,kB << 1/tau_CP.  R20A is the transverse relaxation rate 
of site A in the absence of exchange.  2*tau_CP is is the time between 
successive 180 deg. pulses.  The parameters are {R20A, ..., dw, k_AB}.")
 uf.desc[-1].add_paragraph("For the R1rho-type experiment, the currently 
supported models are:")
 uf.desc[-1].add_item_list_element("'%s'" % MODEL_R2EFF, "This is the same 
model model as for the CPMG-type experiments except that the R1rho and not 
R2eff values are determined.")
 uf.desc[-1].add_item_list_element("'%s'" % MODEL_NOREX, "This is the model 
for no chemical exchange being present,")




Related Messages


Powered by MHonArc, Updated Fri Sep 06 16:40:01 2013