mailRe: r22901 - /trunk/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 d'Auvergne on May 02, 2014 - 09:15:
Here again the date order is used.  Except the func_B14() method is in
the correct position as all functions or methods are alphabetically
ordered.

Cheers,

Edward



On 1 May 2014 09:18,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Thu May  1 09:18:41 2014
New Revision: 22901

URL: http://svn.gna.org/viewcvs/relax?rev=22901&view=rev
Log:
Added model B14 to be found as target function.

sr #3154: (https://gna.org/support/?3154) Implementation of Baldwin (2014) 
B14 model - 2-site exact solution model for all time scales.

Modified:
    trunk/target_functions/relax_disp.py

Modified: trunk/target_functions/relax_disp.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/target_functions/relax_disp.py?rev=22901&r1=22900&r2=22901&view=diff
==============================================================================
--- trunk/target_functions/relax_disp.py        (original)
+++ trunk/target_functions/relax_disp.py        Thu May  1 09:18:41 2014
@@ -2,6 +2,7 @@
 #                                                                          
   #
 # Copyright (C) 2013-2014 Edward d'Auvergne                                
   #
 # Copyright (C) 2009 Sebastien Morin                                       
   #
+# Copyright (C) 2014 Troels E. Linnet                                      
   #
 #                                                                          
   #
 # This file is part of the program relax (http://www.nmr-relax.com).       
   #
 #                                                                          
   #
@@ -29,6 +30,7 @@
 from numpy import complex64, dot, float64, int16, zeros

 # relax module imports.
+from lib.dispersion.b14 import r2eff_B14
 from lib.dispersion.cr72 import r2eff_CR72
 from lib.dispersion.dpl94 import r1rho_DPL94
 from lib.dispersion.it99 import r2eff_IT99
@@ -52,7 +54,7 @@
 from lib.errors import RelaxError
 from lib.float import isNaN
 from target_functions.chi2 import chi2
-from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_DQ, 
EXP_TYPE_CPMG_MQ, EXP_TYPE_CPMG_PROTON_MQ, EXP_TYPE_CPMG_PROTON_SQ, 
EXP_TYPE_CPMG_SQ, EXP_TYPE_CPMG_ZQ, EXP_TYPE_R1RHO, MODEL_CR72, 
MODEL_CR72_FULL, MODEL_DPL94, MODEL_IT99, MODEL_LIST_CPMG, MODEL_LIST_FULL, 
MODEL_LIST_MMQ, MODEL_LIST_MQ_CPMG, MODEL_LIST_R1RHO, MODEL_LM63, 
MODEL_LM63_3SITE, MODEL_M61, MODEL_M61B, MODEL_MP05, MODEL_MMQ_CR72, 
MODEL_NOREX, MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL, 
MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR, 
MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_MMQ_2SITE, MODEL_NS_MMQ_3SITE, 
MODEL_NS_MMQ_3SITE_LINEAR, MODEL_NS_R1RHO_2SITE, MODEL_NS_R1RHO_3SITE, 
MODEL_NS_R1RHO_3SITE_LINEAR, MODEL_TAP03, MODEL_TP02, MODEL_TSMFK01
+from specific_analyses.relax_disp.variables import EXP_TYPE_CPMG_DQ, 
EXP_TYPE_CPMG_MQ, EXP_TYPE_CPMG_PROTON_MQ, EXP_TYPE_CPMG_PROTON_SQ, 
EXP_TYPE_CPMG_SQ, EXP_TYPE_CPMG_ZQ, EXP_TYPE_R1RHO, MODEL_B14, MODEL_CR72, 
MODEL_CR72_FULL, MODEL_DPL94, MODEL_IT99, MODEL_LIST_CPMG, MODEL_LIST_FULL, 
MODEL_LIST_MMQ, MODEL_LIST_MQ_CPMG, MODEL_LIST_R1RHO, MODEL_LM63, 
MODEL_LM63_3SITE, MODEL_M61, MODEL_M61B, MODEL_MP05, MODEL_MMQ_CR72, 
MODEL_NOREX, MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL, 
MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR, 
MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_MMQ_2SITE, MODEL_NS_MMQ_3SITE, 
MODEL_NS_MMQ_3SITE_LINEAR, MODEL_NS_R1RHO_2SITE, MODEL_NS_R1RHO_3SITE, 
MODEL_NS_R1RHO_3SITE_LINEAR, MODEL_TAP03, MODEL_TP02, MODEL_TSMFK01


 class Dispersion:
@@ -67,6 +69,7 @@
             - 'No Rex':  The model for no chemical exchange relaxation.
             - 'LM63':  The Luz and Meiboom (1963) 2-site fast exchange 
model.
             - 'LM63 3-site':  The Luz and Meiboom (1963) 3-site fast 
exchange model.
+            - 'B14':  The Baldwin (2014) 2-site exact solution model for 
all time scales.
             - 'CR72':  The reduced Carver and Richards (1972) 2-site model 
for all time scales with R20A = R20B.
             - 'CR72 full':  The full Carver and Richards (1972) 2-site 
model for all time scales.
             - 'IT99':  The Ishima and Torchia (1999) 2-site model for all 
time scales with skewed populations (pA >> pB).
@@ -225,7 +228,7 @@

         # The spin and frequency dependent R2 parameters.
         self.end_index.append(self.num_exp * self.num_spins * self.num_frq)
-        if model in [MODEL_CR72_FULL, MODEL_NS_CPMG_2SITE_3D_FULL, 
MODEL_NS_CPMG_2SITE_STAR_FULL]:
+        if model in [MODEL_B14, MODEL_CR72_FULL, 
MODEL_NS_CPMG_2SITE_3D_FULL, MODEL_NS_CPMG_2SITE_STAR_FULL]:
             self.end_index.append(2 * self.num_exp * self.num_spins * 
self.num_frq)

         # The spin and dependent parameters (phi_ex, dw, padw2).
@@ -340,6 +343,8 @@
             self.func = self.func_LM63
         if model == MODEL_LM63_3SITE:
             self.func = self.func_LM63_3site
+        if model == MODEL_B14:
+            self.func = self.func_B14
         if model == MODEL_CR72_FULL:
             self.func = self.func_CR72_full
         if model == MODEL_CR72:
@@ -758,6 +763,33 @@
                 raise RelaxError("The '%s' CPMG model is not compatible 
with the '%s' experiment type." % (self.model, self.exp_types[0]))


+    def func_B14(self, params):
+        """Target function for the Baldwin (2014) 2-site exact solution 
model for all time scales.
+
+        This assumes that pA > pB, and hence this must be implemented as a 
constraint.
+
+
+        @param params:  The vector of parameter values.
+        @type params:   numpy rank-1 float array
+        @return:        The chi-squared value.
+        @rtype:         float
+        """
+
+        # Scaling.
+        if self.scaling_flag:
+            params = dot(params, self.scaling_matrix)
+
+        # Unpack the parameter values.
+        R20A = params[:self.end_index[0]]
+        R20B = params[self.end_index[0]:self.end_index[1]]
+        dw = params[self.end_index[1]:self.end_index[2]]
+        pA = params[self.end_index[2]]
+        kex = params[self.end_index[2]+1]
+
+        # Calculate and return the chi-squared value.
+        return self.calc_CR72_chi2(R20A=R20A, R20B=R20B, dw=dw, pA=pA, 
kex=kex)
+
+
     def func_CR72(self, params):
         """Target function for the reduced Carver and Richards (1972) 
2-site exchange model on all time scales.



_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits



Related Messages


Powered by MHonArc, Updated Fri May 02 09:40:08 2014