mailr20338 - in /branches/relax_disp: lib/dispersion/ specific_analyses/relax_disp/ target_functions/ user_functions/


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

Header


Content

Posted by edward on July 16, 2013 - 17:16:
Author: bugman
Date: Tue Jul 16 17:16:09 2013
New Revision: 20338

URL: http://svn.gna.org/viewcvs/relax?rev=20338&view=rev
Log:
Converted the 'NS 2-site' model to 'NS 2-site 3D' to be more specific.

This might change again in the future.


Added:
    branches/relax_disp/lib/dispersion/ns_2site_3d.py
      - copied unchanged from r20335, 
branches/relax_disp/lib/dispersion/ns_2site.py
Removed:
    branches/relax_disp/lib/dispersion/ns_2site.py
Modified:
    branches/relax_disp/lib/dispersion/__init__.py
    branches/relax_disp/specific_analyses/relax_disp/variables.py
    branches/relax_disp/target_functions/relax_disp.py
    branches/relax_disp/user_functions/relax_disp.py

Modified: branches/relax_disp/lib/dispersion/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/__init__.py?rev=20338&r1=20337&r2=20338&view=diff
==============================================================================
--- branches/relax_disp/lib/dispersion/__init__.py (original)
+++ branches/relax_disp/lib/dispersion/__init__.py Tue Jul 16 17:16:09 2013
@@ -29,7 +29,7 @@
     'lm63',
     'm61',
     'm61b',
-    'ns_2site',
+    'ns_2site_3d',
     'ns_2site_star',
     'ns_matrices',
     'two_point'

Removed: branches/relax_disp/lib/dispersion/ns_2site.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/ns_2site.py?rev=20337&view=auto
==============================================================================
--- branches/relax_disp/lib/dispersion/ns_2site.py (original)
+++ branches/relax_disp/lib/dispersion/ns_2site.py (removed)
@@ -1,101 +1,0 @@
-###############################################################################
-#                                                                            
 #
-# Copyright (C) 2010-2013 Paul Schanda (https://gna.org/users/pasa)          
 #
-# Copyright (C) 2013 Edward d'Auvergne                                       
 #
-#                                                                            
 #
-# This file is part of the program relax (http://www.nmr-relax.com).         
 #
-#                                                                            
 #
-# This program is free software: you can redistribute it and/or modify       
 #
-# it under the terms of the GNU General Public License as published by       
 #
-# the Free Software Foundation, either version 3 of the License, or          
 #
-# (at your option) any later version.                                        
 #
-#                                                                            
 #
-# This program is distributed in the hope that it will be useful,            
 #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
-# GNU General Public License for more details.                               
 #
-#                                                                            
 #
-# You should have received a copy of the GNU General Public License          
 #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
-#                                                                            
 #
-###############################################################################
-
-# Module docstring.
-"""This function performs a numerical fit of 2-site Bloch-McConnell 
equations for CPMG-type experiments.
-
-The function uses an explicit matrix that contains relaxation, exchange and 
chemical shift terms.  It does the 180deg pulses in the CPMG train.  The 
approach of Bloch-McConnell can be found in chapter 3.1 of Palmer, A. G. Chem 
Rev 2004, 104, 3623-3640.  This function was written, initially in MATLAB, in 
2010.
-
-This is the model of the numerical solution for the 2-site Bloch-McConnell 
equations.  It originates as optimization function number 1 from the 
fitting_main_kex.py script from Mathilde Lescanne, Paul Schanda, and 
Dominique Marion (see 
http://thread.gmane.org/gmane.science.nmr.relax.devel/4138, 
https://gna.org/task/?7712#comment2 and 
https://gna.org/support/download.php?file_id=18262).
-"""
-
-# Dependency check module.
-import dep_check
-
-# Python module imports.
-from math import fabs, log
-if dep_check.scipy_module:
-    from scipy.linalg import expm
-
-# relax module imports.
-from lib.dispersion.ns_matrices import r180x_3d, rcpmg_3d
-
-
-def r2eff_ns_2site_3D(M0=None, r10a=0.0, r10b=0.0, r20a=None, r20b=None, 
pA=None, dw=None, k_AB=None, k_BA=None, inv_tcpmg=None, tcp=None, 
back_calc=None, num_points=None, power=None):
-    """The 2-site numerical solution to the Bloch-McConnell equation.
-
-    This function calculates and stores the R2eff values.
-
-
-    @keyword M0:            This is a vector that contains the initial 
magnetizations corresponding to the A and B state transverse magnetizations.
-    @type M0:               numpy float64, rank-1, 2D array
-    @keyword r10a:          The R1 value for state A.
-    @type r10a:             float
-    @keyword r10b:          The R1 value for state B.
-    @type r10b:             float
-    @keyword r20a:          The R2 value for state A in the absence of 
exchange.
-    @type r20a:             float
-    @keyword r20b:          The R2 value for state B in the absence of 
exchange.
-    @type r20b:             float
-    @keyword pA:            The population of state A.
-    @type pA:               float
-    @keyword dw:            The chemical exchange difference between states 
A and B in rad/s.
-    @type dw:               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 inv_tcpmg:     The inverse of the total duration of the CPMG 
element (in inverse seconds).
-    @type inv_tcpmg:        float
-    @keyword tcp:           The tau_CPMG times (1 / 4.nu1).
-    @type tcp:              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.
-    @type back_calc:        numpy rank-1 float array
-    @keyword num_points:    The number of points on the dispersion curve, 
equal to the length of the tcp and back_calc arguments.
-    @type num_points:       int
-    @keyword power:         The matrix exponential power array.
-    @type power:            numpy int16, rank-1 array
-    """
-
-    # The matrix R that contains all the contributions to the evolution, 
i.e. relaxation, exchange and chemical shift evolution.
-    R = rcpmg_3d(R1A=r10a, R1B=r10b, R2A=r20a, R2B=r20b, df=dw, k_AB=k_AB, 
k_BA=k_BA)
-
-    # Loop over the time points, back calculating the R2eff values.
-    for i in range(num_points):
-        # Initial magnetisation.
-        Mint = M0
-
-        # This matrix is a propagator that will evolve the magnetization 
with the matrix R for a delay tcp.
-        Rexpo = expm(R*tcp[i])
-
-        # Loop over the CPMG elements, propagating the magnetisation.
-        for j in range(2*power[i]):
-                       Mint = Rexpo * Mint
-                       Mint = r180x_3d() * Mint
-                       Mint = Rexpo * Mint
-
-        # The next lines calculate the R2eff using a two-point 
approximation, i.e. assuming that the decay is mono-exponential.
-        Mgx = fabs((Mint[1])/pA)
-        if Mgx == 0.0:
-            back_calc[i] = 1e99
-        else:
-            back_calc[i]= -inv_tcpmg * log(Mgx)

Modified: branches/relax_disp/specific_analyses/relax_disp/variables.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/variables.py?rev=20338&r1=20337&r2=20338&view=diff
==============================================================================
--- branches/relax_disp/specific_analyses/relax_disp/variables.py (original)
+++ branches/relax_disp/specific_analyses/relax_disp/variables.py Tue Jul 16 
17:16:09 2013
@@ -67,8 +67,8 @@
 
 
 # The Numerical model names.
-MODEL_NS_2SITE = 'NS 2-site'
-"""The numerical solution for the 2-site Bloch-McConnell equations."""
+MODEL_NS_2SITE_3D = 'NS 2-site 3D'
+"""The numerical solution for the 2-site Bloch-McConnell equations using 3D 
magnetisation vectors."""
 
 MODEL_NS_2SITE_STAR_RED = 'NS 2-site star red'
 """The numerical solution for the 2-site Bloch-McConnell equations using 
complex conjugate matrices, whereby the simplification R20A = R20B is 
assumed."""
@@ -78,16 +78,16 @@
 
 
 # The model lists.
-MODEL_LIST_DISP = [MODEL_NOREX, MODEL_LM63, MODEL_CR72_RED, MODEL_CR72, 
MODEL_IT99, MODEL_M61, MODEL_DPL94, MODEL_M61B, MODEL_NS_2SITE, 
MODEL_NS_2SITE_STAR_RED, MODEL_NS_2SITE_STAR]
+MODEL_LIST_DISP = [MODEL_NOREX, MODEL_LM63, MODEL_CR72_RED, MODEL_CR72, 
MODEL_IT99, MODEL_M61, MODEL_DPL94, MODEL_M61B, MODEL_NS_2SITE_3D, 
MODEL_NS_2SITE_STAR_RED, MODEL_NS_2SITE_STAR]
 """The list of all dispersion models (excluding the R2eff model)."""
 
-MODEL_LIST_FULL = [MODEL_R2EFF, MODEL_NOREX, MODEL_LM63, MODEL_CR72_RED, 
MODEL_CR72, MODEL_IT99, MODEL_M61, MODEL_DPL94, MODEL_M61B, MODEL_NS_2SITE, 
MODEL_NS_2SITE_STAR_RED, MODEL_NS_2SITE_STAR]
+MODEL_LIST_FULL = [MODEL_R2EFF, MODEL_NOREX, MODEL_LM63, MODEL_CR72_RED, 
MODEL_CR72, MODEL_IT99, MODEL_M61, MODEL_DPL94, MODEL_M61B, 
MODEL_NS_2SITE_3D, MODEL_NS_2SITE_STAR_RED, MODEL_NS_2SITE_STAR]
 """The list of the R2eff model together with all dispersion models."""
 
-MODEL_LIST_CPMG = [MODEL_NOREX, MODEL_LM63, MODEL_CR72_RED, MODEL_CR72, 
MODEL_IT99, MODEL_NS_2SITE, MODEL_NS_2SITE_STAR_RED, MODEL_NS_2SITE_STAR]
+MODEL_LIST_CPMG = [MODEL_NOREX, MODEL_LM63, MODEL_CR72_RED, MODEL_CR72, 
MODEL_IT99, MODEL_NS_2SITE_3D, MODEL_NS_2SITE_STAR_RED, MODEL_NS_2SITE_STAR]
 """The list of all dispersion models specifically for CPMG-type experiments 
(excluding the R2eff model)."""
 
-MODEL_LIST_CPMG_FULL = [MODEL_R2EFF, MODEL_NOREX, MODEL_LM63, 
MODEL_CR72_RED, MODEL_CR72, MODEL_IT99, MODEL_NS_2SITE, 
MODEL_NS_2SITE_STAR_RED, MODEL_NS_2SITE_STAR]
+MODEL_LIST_CPMG_FULL = [MODEL_R2EFF, MODEL_NOREX, MODEL_LM63, 
MODEL_CR72_RED, MODEL_CR72, MODEL_IT99, MODEL_NS_2SITE_3D, 
MODEL_NS_2SITE_STAR_RED, MODEL_NS_2SITE_STAR]
 """The list of the R2eff model together with all dispersion models 
specifically for CPMG-type experiments."""
 
 MODEL_LIST_R1RHO = [MODEL_NOREX, MODEL_M61, MODEL_DPL94, MODEL_M61B]

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=20338&r1=20337&r2=20338&view=diff
==============================================================================
--- branches/relax_disp/target_functions/relax_disp.py (original)
+++ branches/relax_disp/target_functions/relax_disp.py Tue Jul 16 17:16:09 
2013
@@ -33,7 +33,7 @@
 from lib.dispersion.lm63 import r2eff_LM63
 from lib.dispersion.m61 import r1rho_M61
 from lib.dispersion.m61b import r1rho_M61b
-from lib.dispersion.ns_2site import r2eff_ns_2site_3D
+from lib.dispersion.ns_2site_3d import r2eff_ns_2site_3D
 from lib.dispersion.ns_2site_star import r2eff_ns_2site_star
 from lib.errors import RelaxError
 from target_functions.chi2 import chi2

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=20338&r1=20337&r2=20338&view=diff
==============================================================================
--- branches/relax_disp/user_functions/relax_disp.py (original)
+++ branches/relax_disp/user_functions/relax_disp.py Tue Jul 16 17:16:09 2013
@@ -39,7 +39,7 @@
 from specific_analyses.relax_disp.disp_data import cpmg_frq, 
plot_disp_curves, plot_exp_curves, relax_time, spin_lock_field
 from specific_analyses.relax_disp.nessy import nessy_input
 from specific_analyses.relax_disp.sherekhan import sherekhan_input
-from specific_analyses.relax_disp.variables import MODEL_CR72, 
MODEL_CR72_RED, MODEL_DPL94, MODEL_IT99, MODEL_LM63, MODEL_M61, MODEL_M61B, 
MODEL_NOREX, MODEL_R2EFF, MODEL_NS_2SITE, MODEL_NS_2SITE_STAR, 
MODEL_NS_2SITE_STAR_RED
+from specific_analyses.relax_disp.variables import MODEL_CR72, 
MODEL_CR72_RED, MODEL_DPL94, MODEL_IT99, MODEL_LM63, MODEL_M61, MODEL_M61B, 
MODEL_NOREX, MODEL_R2EFF, MODEL_NS_2SITE_3D, MODEL_NS_2SITE_STAR, 
MODEL_NS_2SITE_STAR_RED
 from specific_analyses.setup import relax_disp_obj
 from user_functions.data import Uf_info; uf_info = Uf_info()
 from user_functions.objects import Desc_container
@@ -443,7 +443,7 @@
         "%s: {R20, ..., pA, dw, kex}" % MODEL_CR72_RED,
         "%s: {R20A, R20B, ..., pA, dw, kex}" % MODEL_CR72,
         "%s: {R20, ..., phi_ex, padw2, kex}" % MODEL_IT99,
-        "%s: {R20A, R20B, ..., pA, dw, kex}" % MODEL_NS_2SITE,
+        "%s: {R20A, R20B, ..., pA, dw, kex}" % MODEL_NS_2SITE_3D,
         "%s: {R20, ..., pA, dw, kex}" % MODEL_NS_2SITE_STAR_RED,
         "%s: {R20A, R20B, ..., pA, dw, kex}" % MODEL_NS_2SITE_STAR,
         "%s: {R1rho', ..., phi_ex, kex}" % MODEL_M61,
@@ -457,7 +457,7 @@
         MODEL_CR72_RED,
         MODEL_CR72,
         MODEL_IT99,
-        MODEL_NS_2SITE,
+        MODEL_NS_2SITE_3D,
         MODEL_NS_2SITE_STAR_RED,
         MODEL_NS_2SITE_STAR,
         MODEL_M61,
@@ -490,7 +490,7 @@
 uf.desc[-1].add_paragraph("The Bloch-McConnell equations can also be solved 
numerically.  The numeric models are also dependent upon whether the data 
originates from a CPMG-type or R1rho-type experiment.  For the CPMG-type 
experiments, the currently supported models are:")
 uf.desc[-1].add_item_list_element("'%s'" % MODEL_R2EFF, "This is the model 
used to determine the R2eff values and errors required as the base data for 
all other models,")
 uf.desc[-1].add_item_list_element("'%s'" % MODEL_NOREX, "This is the model 
for no chemical exchange being present,")
-uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_2SITE, "The numerical 
solution for the 2-site Bloch-McConnell equations with parameters {R20A, 
R20B, ..., pA, dw, kex}.")
+uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_2SITE_3D, "The numerical 
solution for the 2-site Bloch-McConnell equations using 3D magnetisation 
vectors.  Its parameters are {R20A, R20B, ..., pA, dw, kex}.")
 uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_2SITE_STAR_RED, "The 
numerical solution for the 2-site Bloch-McConnell equations using complex 
conjugate matrices whereby the simplification R20A = R20B is assumed.  It has 
the parameters {R20, ..., pA, dw, kex}.")
 uf.desc[-1].add_item_list_element("'%s'" % MODEL_NS_2SITE_STAR, "The 
numerical solution for the 2-site Bloch-McConnell equations using complex 
conjugate matrices with parameters {R20A, R20B, ..., pA, dw, kex}.")
 uf.desc[-1].add_paragraph("For the R1rho-type experiment, only the base 
models are currently supported:")




Related Messages


Powered by MHonArc, Updated Tue Jul 16 17:20:02 2013