mailr23455 - /branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_tp02.py


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

Header


Content

Posted by tlinnet on May 27, 2014 - 12:24:
Author: tlinnet
Date: Tue May 27 12:24:56 2014
New Revision: 23455

URL: http://svn.gna.org/viewcvs/relax?rev=23455&view=rev
Log:
Modified unit tests demonstrating edge cases 'no Rex' failures of the model 
'TP02'.

The cathing of errors for off-resonance R1rho models was implemented wrong.

This follows from the ideas in the post 
http://article.gmane.org/gmane.science.nmr.relax.devel/5858.
This is related to: task #7793: (https://gna.org/task/?7793) Speed-up of 
dispersion models.
This was pointed out in the post 
http://article.gmane.org/gmane.science.nmr.relax.devel/5938.

This is to implement catching of math domain errors, before they occur.

These tests cover all parameter value combinations which result in no 
exchange:

    - dw = 0.0,
    - pA = 1.0,
    - kex = 0.0,
    - dw = 0.0 and pA = 1.0,
    - dw = 0.0 and kex = 0.0,
    - pA = 1.0 and kex = 0.0,
    - dw = 0.0, pA = 1.0, and kex = 0.0.
    - kex = 1e5,

Modified:
    branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_tp02.py

Modified: 
branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_tp02.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_tp02.py?rev=23455&r1=23454&r2=23455&view=diff
==============================================================================
--- branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_tp02.py   
  (original)
+++ branches/disp_speed/test_suite/unit_tests/_lib/_dispersion/test_tp02.py   
  Tue May 27 12:24:56 2014
@@ -21,7 +21,7 @@
 
###############################################################################
 
 # Python module imports.
-from numpy import array, float64, int16, pi, zeros
+from numpy import arctan2, array, cos, float64, int16, pi, sin, zeros
 from unittest import TestCase
 
 # relax module imports.
@@ -70,14 +70,17 @@
         # Calculate the R1rho values.
         R1rho = r1rho_TP02(r1rho_prime=self.r1rho_prime, omega=self.omega, 
offset=self.offset, pA=self.pA, pB=pB, dw=dw_frq, kex=self.kex, R1=self.r1, 
spin_lock_fields=spin_lock_omega1, 
spin_lock_fields2=spin_lock_omega1_squared, num_points=self.num_points)
 
+        # Compare to function value.
+        Wa = self.omega                         # Larmor frequency [s^-1].
+        Wb = self.omega + dw_frq                # Larmor frequency [s^-1].
+        W = self.pA * Wa + pB * Wb              # Pop-averaged Larmor 
frequency [s^-1].
+        d = W - self.offset                     # Offset of spin-lock from 
pop-average.
+        theta = arctan2(spin_lock_omega1, d)    # The rotating frame flip 
angle.
+        r1rho_no_rex = self.r1 * cos(theta)**2 + self.r1rho_prime * 
sin(theta)**2
 
         # Check all R1rho values.
-        if self.kex > 1.e5:
-            for i in range(self.num_points):
-                self.assertAlmostEqual(R1rho[i], self.r1, 6)
-        else:
-            for i in range(self.num_points):
-                self.assertAlmostEqual(R1rho[i], self.r1rho_prime)
+        for i in range(self.num_points):
+            self.assertAlmostEqual(R1rho[i], r1rho_no_rex[i])
 
 
     def param_conversion(self, pA=None, dw=None, sfrq=None, 
spin_lock_nu1=None):




Related Messages


Powered by MHonArc, Updated Tue May 27 12:40:02 2014