mailr24141 - /branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_lm63.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 - 20:17:
Author: tlinnet
Date: Wed Jun 18 20:17:29 2014
New Revision: 24141

URL: http://svn.gna.org/viewcvs/relax?rev=24141&view=rev
Log:
Implemented profiling script for LM63.

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

Modified:
    
branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_lm63.py

Modified: 
branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_lm63.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_lm63.py?rev=24141&r1=24140&r2=24141&view=diff
==============================================================================
--- 
branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_lm63.py
      (original)
+++ 
branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/profiling_lm63.py
      Wed Jun 18 20:17:29 2014
@@ -55,7 +55,7 @@
 from lib.physical_constants import g1H, g15N
 from target_functions.chi2 import chi2
 from target_functions.relax_disp import Dispersion
-from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_SQ, 
MODEL_B14_FULL, MODEL_CR72, MODEL_CR72_FULL, MODEL_NS_CPMG_2SITE_3D_FULL, 
MODEL_NS_CPMG_2SITE_STAR_FULL
+from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_SQ, 
MODEL_B14_FULL, MODEL_CR72, MODEL_CR72_FULL, MODEL_LM63, 
MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_STAR_FULL
 
 
 # Alter setup.
@@ -110,7 +110,7 @@
     Class Profile inherits the Dispersion container class object.
     """
 
-    def __init__(self, num_spins=1, model=None, r2=None, r2a=None, r2b=None, 
dw=None, pA=None, kex=None, spins_params=None):
+    def __init__(self, num_spins=1, model=None, r2=None, r2a=None, r2b=None, 
phi_ex=None, dw=None, pA=None, kex=None, spins_params=None):
         """
         Special method __init__() is called first (acts as Constructor).
         It brings in data from outside the class like the variable num_spins.
@@ -130,6 +130,8 @@
         @type r2a:              float
         @keyword r2b:           The transversal relaxation rate for state B 
in the absence of exchange.
         @type r2b:              float
+        @keyword phi_ex:        The phi_ex = pA.pB.dw**2 value (ppm^2)
+        @type phi_ex:           float
         @keyword dw:            The chemical exchange difference between 
states A and B in ppm.
         @type dw:               float
         @keyword pA:            The population of state A.
@@ -168,7 +170,7 @@
             self.error.append([1.0]*len(cpmg_point))
 
         # Assemble param vector.
-        self.params = self.assemble_param_vector(r2=r2, r2a=r2a, r2b=r2b, 
dw=dw, pA=pA, kex=kex, spins_params=spins_params)
+        self.params = self.assemble_param_vector(r2=r2, r2a=r2a, r2b=r2b, 
phi_ex=phi_ex, dw=dw, pA=pA, kex=kex, spins_params=spins_params)
 
         # Make nested list arrays of data. And return them.
         values, errors, cpmg_frqs, missing, frqs, exp_types, relax_times, 
offsets = self.return_r2eff_arrays()
@@ -292,7 +294,7 @@
         return values, errors, cpmg_frqs, missing, frqs, exp_types, 
relax_times, offsets
 
 
-    def assemble_param_vector(self, r2=None, r2a=None, r2b=None, dw=None, 
pA=None, kex=None, spins_params=None):
+    def assemble_param_vector(self, r2=None, r2a=None, r2b=None, 
phi_ex=None, dw=None, pA=None, kex=None, spins_params=None):
         """Assemble the dispersion relaxation dispersion curve fitting 
parameter vector.
 
         @keyword r2:            The transversal relaxation rate.
@@ -301,6 +303,8 @@
         @type r2a:              float
         @keyword r2b:           The transversal relaxation rate for state B 
in the absence of exchange.
         @type r2b:              float
+        @keyword phi_ex:        The phi_ex = pA.pB.dw**2 value (ppm^2)
+        @type phi_ex:           float
         @keyword dw:            The chemical exchange difference between 
states A and B in ppm.
         @type dw:               float
         @keyword pA:            The population of state A.
@@ -327,6 +331,8 @@
             elif param_name == 'r2b':
                 value = r2b
                 value = value + mi + spin_index*0.1
+            elif param_name == 'phi_ex':
+                value = phi_ex + spin_index
             elif param_name == 'dw':
                 value = dw + spin_index
             elif param_name == 'pA':
@@ -377,6 +383,15 @@
         # Then the chemical shift difference parameters 'phi_ex', 
'phi_ex_B', 'phi_ex_C', 'padw2', 'dw', 'dw_AB', 'dw_BC', 'dw_AB' (one per 
spin).
         for spin_index in range(self.num_spins):
 
+            # Yield the data.
+            if 'phi_ex' in spins_params:
+                yield 'phi_ex', spin_index, 0
+            if 'phi_ex_B' in spins_params:
+                yield 'phi_ex_B', spin_index, 0
+            if 'phi_ex_C' in spins_params:
+                yield 'phi_ex_C', spin_index, 0
+            if 'padw2' in spins_params:
+                yield 'padw2', pspin_index, 0
             if 'dw' in spins_params:
                 yield 'dw', spin_index, 0
 
@@ -399,11 +414,11 @@
         """
 
         # Return chi2 value.
-        chi2 = self.model.func_CR72(params)
+        chi2 = self.model.func_LM63(params)
         return chi2
 
 
-def single(num_spins=1, model=MODEL_CR72, iter=None):
+def single(num_spins=1, model=MODEL_LM63, iter=None):
     """Calculate for a single spin.
 
     @keyword num_spins:     Number of spins in the cluster.
@@ -417,7 +432,7 @@
     """
 
     # Instantiate class
-    C1 = Profile(num_spins=num_spins, model=model, r2=5.0, dw=3.0, pA=0.9, 
kex=1000.0, spins_params=['r2', 'dw', 'pA', 'kex'])
+    C1 = Profile(num_spins=num_spins, model=model, r2=5.0, phi_ex=3.0, 
kex=1000.0, spins_params=['r2', 'phi_ex', 'kex'])
 
     # Loop 100 times for each spin in the clustered analysis (to make the 
timing numbers equivalent).
     for spin_index in xrange(100):
@@ -427,7 +442,7 @@
     print("chi2 single:", chi2)
 
 
-def cluster(num_spins=100, model=MODEL_CR72, iter=None):
+def cluster(num_spins=100, model=MODEL_LM63, iter=None):
     """Calculate for a number of clustered spins.
 
     @keyword num_spins:     Number of spins in the cluster.
@@ -441,7 +456,7 @@
     """
 
     # Instantiate class
-    C1 = Profile(num_spins=num_spins, model=model, r2=5.0, dw=3.0, pA=0.9, 
kex=1000.0, spins_params=['r2', 'dw', 'pA', 'kex'])
+    C1 = Profile(num_spins=num_spins, model=model, r2=5.0, phi_ex=3.0, 
kex=1000.0, spins_params=['r2', 'phi_ex', 'kex'])
 
     # Repeat the function call, to simulate minimisation.
     for i in xrange(iter):




Related Messages


Powered by MHonArc, Updated Wed Jun 18 20:40:02 2014