mailr23919 - in /branches/disp_spin_speed: lib/dispersion/ target_functions/ test_suite/unit_tests/_lib/_dispersion/


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

Header


Content

Posted by tlinnet on June 13, 2014 - 11:47:
Author: tlinnet
Date: Fri Jun 13 11:47:38 2014
New Revision: 23919

URL: http://svn.gna.org/viewcvs/relax?rev=23919&view=rev
Log:
Removed number of points, pB, k_AB, k_BA to be send to lib function of model 
B14.

Number of points are not used anymore.
pB is calculated in lib function insted.
k_AB, and k_BA are calculated in lib functions instead.

Fixed in target function.
Fixed in lib function.
Fixed in corresponding unit tests.

Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion 
models for Clustered analysis.

Modified:
    branches/disp_spin_speed/lib/dispersion/b14.py
    branches/disp_spin_speed/target_functions/relax_disp.py
    
branches/disp_spin_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py

Modified: branches/disp_spin_speed/lib/dispersion/b14.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/b14.py?rev=23919&r1=23918&r2=23919&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/b14.py      (original)
+++ branches/disp_spin_speed/lib/dispersion/b14.py      Fri Jun 13 11:47:38 
2014
@@ -116,7 +116,7 @@
 # Repetitive calculations (to speed up calculations).
 g_fact = 1/sqrt(2)
 
-def r2eff_B14(r20a=None, r20b=None, pA=None, pB=None, dw=None, dw_orig=None, 
kex=None, k_AB=None, k_BA=None, ncyc=None, inv_tcpmg=None, tcp=None, 
back_calc=None, num_points=None):
+def r2eff_B14(r20a=None, r20b=None, pA=None, dw=None, dw_orig=None, 
kex=None, ncyc=None, inv_tcpmg=None, tcp=None, back_calc=None):
     """Calculate the R2eff values for the CR72 model.
 
     See the module docstring for details.
@@ -128,18 +128,12 @@
     @type r20b:             numpy float array of rank [NE][NS][[NM][NO][ND]
     @keyword pA:            The population of state A.
     @type pA:               float
-    @keyword pB:            The population of state B.
-    @type pB:               float
     @keyword dw:            The chemical exchange difference between states 
A and B in rad/s.
     @type dw:               numpy float array of rank [NE][NS][[NM][NO][ND]
     @keyword dw_orig:       The chemical exchange difference between states 
A and B in ppm. This is only for faster checking of zero value, which result 
in no exchange.
     @type dw_orig:          numpy float array of rank-1
     @keyword kex:           The kex parameter value (the exchange rate in 
rad/s).
     @type kex:              float
-    @keyword k_AB:          The rate of exchange from site A to B (rad/s).
-    @type k_AB:             float
-    @keyword k_BA:          The rate of exchange from site B to A (rad/s).
-    @type k_BA:             float
     @keyword ncyc:          The matrix exponential power array. The number 
of CPMG blocks.
     @type ncyc:             numpy int16 array of rank [NE][NS][[NM][NO][ND]
     @keyword inv_tcpmg:     The inverse of the total duration of the CPMG 
element (in inverse seconds).
@@ -148,8 +142,6 @@
     @type tcp:              numpy float array of rank [NE][NS][[NM][NO][ND]
     @keyword back_calc:     The array for holding the back calculated R2eff 
values.  Each element corresponds to one of the CPMG nu1 frequencies.
     @type back_calc:        numpy float array of rank [NE][NS][[NM][NO][ND]
-    @keyword num_points:    The number of points on the dispersion curve, 
equal to the length of the cpmg_frqs and back_calc arguments.
-    @type num_points:       numpy int array of rank [NE][NS][[NM][NO][ND]
     """
 
     # Flag to tell if values should be replaced if math function is violated.
@@ -168,6 +160,11 @@
     if min(fabs(dw_orig)) == 0.0:
         t_dw_zero = True
         mask_dw_zero = masked_where(dw == 0.0, dw)
+
+    # Parameter conversions.
+    pB = 1.0 - pA
+    k_BA = pA * kex
+    k_AB = pB * kex
 
     # Repetitive calculations (to speed up calculations).
     deltaR2 = r20a - r20b

Modified: branches/disp_spin_speed/target_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/target_functions/relax_disp.py?rev=23919&r1=23918&r2=23919&view=diff
==============================================================================
--- branches/disp_spin_speed/target_functions/relax_disp.py     (original)
+++ branches/disp_spin_speed/target_functions/relax_disp.py     Fri Jun 13 
11:47:38 2014
@@ -542,11 +542,6 @@
         @rtype:         float
         """
 
-        # Once off parameter conversions.
-        pB = 1.0 - pA
-        k_BA = pA * kex
-        k_AB = pB * kex
-
         # Convert dw from ppm to rad/s. Use the out argument, to pass 
directly to structure.
         multiply( multiply.outer( dw.reshape(self.NE, self.NS), 
self.nm_no_nd_struct ), self.frqs_a, out=self.dw_struct )
 
@@ -555,7 +550,7 @@
         self.r20b_struct[:] = multiply.outer( R20B.reshape(self.NE, self.NS, 
self.NM), self.no_nd_struct )
 
         # Back calculate the R2eff values.
-        r2eff_B14(r20a=self.r20a_struct, r20b=self.r20b_struct, pA=pA, 
pB=pB, dw=self.dw_struct, dw_orig=dw, kex=kex, k_AB=k_AB, k_BA=k_BA, 
ncyc=self.power_a, inv_tcpmg=self.inv_relax_times_a, tcp=self.tau_cpmg_a, 
back_calc=self.back_calc_a, num_points=self.num_disp_points_a)
+        r2eff_B14(r20a=self.r20a_struct, r20b=self.r20b_struct, pA=pA, 
dw=self.dw_struct, dw_orig=dw, kex=kex, ncyc=self.power_a, 
inv_tcpmg=self.inv_relax_times_a, tcp=self.tau_cpmg_a, 
back_calc=self.back_calc_a)
 
         # Clean the data for all values, which is left over at the end of 
arrays.
         self.back_calc_a = self.back_calc_a*self.disp_struct

Modified: 
branches/disp_spin_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py?rev=23919&r1=23918&r2=23919&view=diff
==============================================================================
--- 
branches/disp_spin_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py 
(original)
+++ 
branches/disp_spin_speed/test_suite/unit_tests/_lib/_dispersion/test_b14.py 
Fri Jun 13 11:47:38 2014
@@ -63,7 +63,7 @@
         a = ones([self.num_points])
 
         # Calculate the R2eff values.
-        r2eff_B14(r20a=self.r20a*a, r20b=self.r20b*a, pA=self.pA, pB=pB, 
dw=dw_frq*a, dw_orig=dw_frq*a, kex=self.kex, k_AB=k_AB, k_BA=k_BA, 
ncyc=self.ncyc, inv_tcpmg=self.inv_relax_times, tcp=self.tau_cpmg, 
back_calc=self.R2eff, num_points=self.num_points)
+        r2eff_B14(r20a=self.r20a*a, r20b=self.r20b*a, pA=self.pA, 
dw=dw_frq*a, dw_orig=dw_frq*a, kex=self.kex, ncyc=self.ncyc, 
inv_tcpmg=self.inv_relax_times, tcp=self.tau_cpmg, back_calc=self.R2eff)
 
         # Check all R2eff values.
         for i in range(self.num_points):




Related Messages


Powered by MHonArc, Updated Fri Jun 13 12:00:03 2014