mailr24114 - in /branches/disp_spin_speed: lib/dispersion/ns_mmq_2site.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 tlinnet on June 18, 2014 - 17:52:
Author: tlinnet
Date: Wed Jun 18 17:52:07 2014
New Revision: 24114

URL: http://svn.gna.org/viewcvs/relax?rev=24114&view=rev
Log:
Moved the paramter conversions of k_AB, k_BA and pB into lib function of NS 
MMQ 2site.

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

Modified:
    branches/disp_spin_speed/lib/dispersion/ns_mmq_2site.py
    branches/disp_spin_speed/target_functions/relax_disp.py

Modified: branches/disp_spin_speed/lib/dispersion/ns_mmq_2site.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/ns_mmq_2site.py?rev=24114&r1=24113&r2=24114&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/ns_mmq_2site.py     (original)
+++ branches/disp_spin_speed/lib/dispersion/ns_mmq_2site.py     Wed Jun 18 
17:52:07 2014
@@ -83,7 +83,7 @@
     matrix[1, 1] = -k_BA + 1.j*dw - R20B
 
 
-def r2eff_ns_mmq_2site_mq(M0=None, F_vector=array([1, 0], float64), m1=None, 
m2=None, R20A=None, R20B=None, pA=None, pB=None, dw=None, dwH=None, 
k_AB=None, k_BA=None, inv_tcpmg=None, tcp=None, back_calc=None, 
num_points=None, power=None):
+def r2eff_ns_mmq_2site_mq(M0=None, F_vector=array([1, 0], float64), m1=None, 
m2=None, R20A=None, R20B=None, pA=None, dw=None, dwH=None, kex=None, 
inv_tcpmg=None, tcp=None, back_calc=None, num_points=None, power=None):
     """The 2-site numerical solution to the Bloch-McConnell equation for MQ 
data.
 
     The notation used here comes from:
@@ -111,16 +111,12 @@
     @type R20B:             numpy float array of rank [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 [NS][NM][NO][ND]
     @keyword dwH:           The proton chemical exchange difference between 
states A and B in rad/s.
     @type dwH:              numpy float array of rank [NS][NM][NO][ND]
-    @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 kex:           The kex parameter value (the exchange rate in 
rad/s).
+    @type kex:              float
     @keyword inv_tcpmg:     The inverse of the total duration of the CPMG 
element (in inverse seconds).
     @type inv_tcpmg:        numpy float array of rank [NS][NM][NO][ND]
     @keyword tcp:           The tau_CPMG times (1 / 4.nu1).
@@ -133,6 +129,15 @@
     @type power:            numpy int array of rank [NS][NM][NO][ND]
     """
 
+    # Once off parameter conversions.
+    pB = 1.0 - pA
+    k_BA = pA * kex
+    k_AB = pB * kex
+
+    # This is a vector that contains the initial magnetizations 
corresponding to the A and B state transverse magnetizations.
+    M0[0] = pA
+    M0[1] = pB
+
     # Extract shape of experiment.
     NS, NM, NO = num_points.shape
 
@@ -236,7 +241,7 @@
                         back_calc[si, mi, oi, i]= -inv_tcpmg[si, mi, oi, i] 
* log(Mx / pA)
 
 
-def r2eff_ns_mmq_2site_sq_dq_zq(M0=None, F_vector=array([1, 0], float64), 
m1=None, m2=None, R20A=None, R20B=None, pA=None, pB=None, dw=None, dwH=None, 
k_AB=None, k_BA=None, inv_tcpmg=None, tcp=None, back_calc=None, 
num_points=None, power=None):
+def r2eff_ns_mmq_2site_sq_dq_zq(M0=None, F_vector=array([1, 0], float64), 
m1=None, m2=None, R20A=None, R20B=None, pA=None, dw=None, dwH=None, kex=None, 
inv_tcpmg=None, tcp=None, back_calc=None, num_points=None, power=None):
     """The 2-site numerical solution to the Bloch-McConnell equation for SQ, 
ZQ, and DQ data.
 
     The notation used here comes from:
@@ -260,16 +265,12 @@
     @type R20B:             numpy float array of rank [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 combined chemical exchange difference 
between states A and B in rad/s.  It should be set to dwH for 1H SQ data, dw 
for heteronuclear SQ data, dwH-dw for ZQ data, and dwH+dw for DQ data.
     @type dw:               numpy float array of rank [NS][NM][NO][ND]
     @keyword dwH:           Unused - this is simply to match the 
r2eff_ns_mmq_2site_mq() function arguments.
     @type dwH:              numpy float array of rank [NS][NM][NO][ND]
-    @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 kex:           The kex parameter value (the exchange rate in 
rad/s).
+    @type kex:              float
     @keyword inv_tcpmg:     The inverse of the total duration of the CPMG 
element (in inverse seconds).
     @type inv_tcpmg:        numpy float array of rank [NS][NM][NO][ND]
     @keyword tcp:           The tau_CPMG times (1 / 4.nu1).
@@ -282,6 +283,14 @@
     @type power:            numpy int array of rank [NS][NM][NO][ND]
     """
 
+    # Once off parameter conversions.
+    pB = 1.0 - pA
+    k_BA = pA * kex
+    k_AB = pB * kex
+
+    # This is a vector that contains the initial magnetizations 
corresponding to the A and B state transverse magnetizations.
+    M0[0] = pA
+    M0[1] = pB
 
     # Extract shape of experiment.
     NS, NM, NO = num_points.shape

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=24114&r1=24113&r2=24114&view=diff
==============================================================================
--- branches/disp_spin_speed/target_functions/relax_disp.py     (original)
+++ branches/disp_spin_speed/target_functions/relax_disp.py     Wed Jun 18 
17:52:07 2014
@@ -1497,20 +1497,11 @@
         pA = params[self.end_index[2]]
         kex = params[self.end_index[2]+1]
 
-        # Once off parameter conversions.
-        pB = 1.0 - pA
-        k_BA = pA * kex
-        k_AB = pB * kex
-
         multiply( multiply.outer( dw.reshape(1, self.NS), self.nm_no_nd_ones 
), self.frqs, out=self.dw_struct )
         multiply( multiply.outer( dwH.reshape(1, self.NS), 
self.nm_no_nd_ones ), self.frqs_H, out=self.dwH_struct )
 
         # Reshape R20 to per experiment, spin and frequency.
         self.r20_struct[:] = multiply.outer( R20.reshape(self.NE, self.NS, 
self.NM), self.no_nd_ones )
-
-        # This is a vector that contains the initial magnetizations 
corresponding to the A and B state transverse magnetizations.
-        self.M0[0] = pA
-        self.M0[1] = pB
 
         # Initialise.
         chi2_sum = 0.0
@@ -1540,7 +1531,7 @@
                 aliased_dwH = dw_frq
 
             # Back calculate the R2eff values for each experiment type.
-            self.r2eff_ns_mmq[ei](M0=self.M0, m1=self.m1, m2=self.m2, 
R20A=r20, R20B=r20, pA=pA, pB=pB, dw=aliased_dw, dwH=aliased_dwH, k_AB=k_AB, 
k_BA=k_BA, inv_tcpmg=self.inv_relax_times[ei], tcp=self.tau_cpmg[ei], 
back_calc=self.back_calc[ei], num_points=self.num_disp_points[ei], 
power=self.power[ei])
+            self.r2eff_ns_mmq[ei](M0=self.M0, m1=self.m1, m2=self.m2, 
R20A=r20, R20B=r20, pA=pA, dw=aliased_dw, dwH=aliased_dwH, kex=kex, 
inv_tcpmg=self.inv_relax_times[ei], tcp=self.tau_cpmg[ei], 
back_calc=self.back_calc[ei], num_points=self.num_disp_points[ei], 
power=self.power[ei])
 
         # Clean the data for all values, which is left over at the end of 
arrays.
         self.back_calc = self.back_calc*self.disp_struct




Related Messages


Powered by MHonArc, Updated Wed Jun 18 18:00:03 2014